本文整理了Java中org.opensaml.Configuration.getGlobalSecurityConfiguration()
方法的一些代码示例,展示了Configuration.getGlobalSecurityConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getGlobalSecurityConfiguration()
方法的具体详情如下:
包路径:org.opensaml.Configuration
类名称:Configuration
方法名:getGlobalSecurityConfiguration
暂无
代码示例来源:origin: cloudfoundry/uaa
@BeforeClass
public static void bootstrap() throws Exception {
Security.addProvider(new BouncyCastleProvider());
DefaultBootstrap.bootstrap();
NamedKeyInfoGeneratorManager keyInfoGeneratorManager = Configuration.getGlobalSecurityConfiguration().getKeyInfoGeneratorManager();
keyInfoGeneratorManager.getManager(SAML_METADATA_KEY_INFO_GENERATOR);
}
代码示例来源:origin: cloudfoundry/uaa
@BeforeClass
public static void bootstrap() throws Exception {
Security.addProvider(new BouncyCastleProvider());
DefaultBootstrap.bootstrap();
NamedKeyInfoGeneratorManager keyInfoGeneratorManager = Configuration.getGlobalSecurityConfiguration().getKeyInfoGeneratorManager();
keyInfoGeneratorManager.getManager(SAMLConstants.SAML_METADATA_KEY_INFO_GENERATOR);
}
代码示例来源:origin: org.opensaml/opensaml
/**
* Constructor.
*
* @param metadataProvider provider of the metadata
*
* @throws IllegalArgumentException thrown if the supplied provider is null
*/
public MetadataCredentialResolver(MetadataProvider metadataProvider) {
super();
if (metadataProvider == null) {
throw new IllegalArgumentException("Metadata provider may not be null");
}
metadata = metadataProvider;
cache = new HashMap<MetadataCacheKey, SoftReference<Collection<Credential>>>();
keyInfoCredentialResolver = Configuration.getGlobalSecurityConfiguration()
.getDefaultKeyInfoCredentialResolver();
rwlock = new ReentrantReadWriteLock();
if (metadata instanceof ObservableMetadataProvider) {
ObservableMetadataProvider observable = (ObservableMetadataProvider) metadataProvider;
observable.getObservers().add(new MetadataProviderObserver());
}
}
代码示例来源:origin: OpenConext/Mujina
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
super.postProcessBeanFactory(beanFactory);
BasicSecurityConfiguration config = (BasicSecurityConfiguration) Configuration.getGlobalSecurityConfiguration();
config.registerSignatureAlgorithmURI("RSA", SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256);
config.setSignatureReferenceDigestMethod(SignatureConstants.ALGO_ID_DIGEST_SHA256);
}
}
代码示例来源:origin: org.springframework.security.extensions/spring-security-saml2-core
/**
* Method registers extension specific KeyInfoGenerator which emits .
*
* @see SAMLConstants#SAML_METADATA_KEY_INFO_GENERATOR
*/
protected void setMetadataKeyInfoGenerator() {
NamedKeyInfoGeneratorManager manager = Configuration.getGlobalSecurityConfiguration().getKeyInfoGeneratorManager();
X509KeyInfoGeneratorFactory generator = new X509KeyInfoGeneratorFactory();
generator.setEmitEntityCertificate(true);
generator.setEmitEntityCertificateChain(true);
manager.registerFactory(SAMLConstants.SAML_METADATA_KEY_INFO_GENERATOR, generator);
}
代码示例来源:origin: org.adeptnet.auth/auth-saml
private Signature getSignature() {
try {
final char[] jksPassword = config.getKeystorePassword();
final String alias = config.getCertificateAlias();
final KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (final FileInputStream fileInputStream = new FileInputStream(config.getKeystore())) {
keyStore.load(fileInputStream, jksPassword);
}
final KeyStore.PrivateKeyEntry privateKeyEntry = (KeyStore.PrivateKeyEntry) keyStore.getEntry(alias, new KeyStore.PasswordProtection(jksPassword));
final PrivateKey privateKey = privateKeyEntry.getPrivateKey();
final X509Certificate certificate = (X509Certificate) privateKeyEntry.getCertificate();
final BasicX509Credential credential = new BasicX509Credential();
credential.setEntityCertificate(certificate);
credential.setPrivateKey(privateKey);
final Signature signature = (Signature) org.opensaml.xml.Configuration.getBuilderFactory()
.getBuilder(org.opensaml.xml.signature.Signature.DEFAULT_ELEMENT_NAME)
.buildObject(org.opensaml.xml.signature.Signature.DEFAULT_ELEMENT_NAME);
signature.setSigningCredential(credential);
final SecurityConfiguration securityConfiguration = Configuration.getGlobalSecurityConfiguration();
final String keyInfoGeneratorProfile = null;
SecurityHelper.prepareSignatureParams(signature, credential, securityConfiguration, keyInfoGeneratorProfile);
return signature;
} catch (KeyStoreException | IOException | NoSuchAlgorithmException | CertificateException | UnrecoverableEntryException | SecurityException ex) {
Logger.getLogger(SAMLClient.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
代码示例来源:origin: spring-projects/spring-security-saml-dsl
private void bootstrap() {
try {
PaosBootstrap.bootstrap();
} catch (ConfigurationException e) {
e.printStackTrace();
}
NamedKeyInfoGeneratorManager manager = Configuration.getGlobalSecurityConfiguration().getKeyInfoGeneratorManager();
X509KeyInfoGeneratorFactory generator = new X509KeyInfoGeneratorFactory();
generator.setEmitEntityCertificate(true);
generator.setEmitEntityCertificateChain(true);
manager.registerFactory(SAMLConstants.SAML_METADATA_KEY_INFO_GENERATOR, generator);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
Configuration.getGlobalSecurityConfiguration(
).getDefaultKeyInfoCredentialResolver();
代码示例来源:origin: OpenConext/Mujina
public static void signAssertion(SignableXMLObject signableXMLObject, Credential signingCredential) throws MarshallingException, SignatureException {
Signature signature = buildSAMLObject(Signature.class, Signature.DEFAULT_ELEMENT_NAME);
signature.setSigningCredential(signingCredential);
signature.setSignatureAlgorithm(Configuration.getGlobalSecurityConfiguration().getSignatureAlgorithmURI(signingCredential));
signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
signableXMLObject.setSignature(signature);
Configuration.getMarshallerFactory().getMarshaller(signableXMLObject).marshall(signableXMLObject);
Signer.signObject(signature);
}
代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2
kekParams.setAlgorithm(EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSA15);
KeyInfoGeneratorFactory kigf = Configuration
.getGlobalSecurityConfiguration().getKeyInfoGeneratorManager()
.getDefaultManager().getFactory(keyEncryptionCredential);
kekParams.setKeyInfoGenerator(kigf.newInstance());
内容来源于网络,如有侵权,请联系作者删除!