本文整理汇总了Java中org.opensaml.xml.ConfigurationException类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationException类的具体用法?Java ConfigurationException怎么用?Java ConfigurationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationException类属于org.opensaml.xml包,在下文中一共展示了ConfigurationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SAMLContext
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public SAMLContext(final HttpServletRequest request, final SAMLConfig configuration) throws ConfigurationException, CertificateException, UnsupportedEncodingException, MetadataProviderException, ServletException, ResourceException {
configuration.setDefaultBaseUrl(getDefaultBaseURL(request));
idpKeyManager = new IdpKeyManager(configuration.getIdpEntityId(), configuration.getX509Certificate());
SpMetadataGenerator spMetadataGenerator = new SpMetadataGenerator();
MetadataProvider spMetadataProvider = spMetadataGenerator.generate(configuration);
IdpMetadataGenerator idpMetadataGenerator = new IdpMetadataGenerator();
MetadataProvider idpMetadataProvider = idpMetadataGenerator.generate(configuration);
metadataManager = new MetadataManager(Arrays.asList(spMetadataProvider, idpMetadataProvider));
metadataManager.setKeyManager(idpKeyManager);
metadataManager.setHostedSPName(configuration.getSpEntityId());
metadataManager.refreshMetadata();
messageContextProvider = new SAMLContextProviderImpl();
messageContextProvider.setMetadata(metadataManager);
messageContextProvider.setKeyManager(idpKeyManager);
messageContextProvider.afterPropertiesSet();
}
示例2: doBootstrap
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public static void doBootstrap() {
/* Initializing the OpenSAML library */
if (!bootStrapped) {
Thread thread = Thread.currentThread();
ClassLoader loader = thread.getContextClassLoader();
thread.setContextClassLoader(new DefaultSAML2SSOManager().getClass().getClassLoader());
try {
DefaultBootstrap.bootstrap();
bootStrapped = true;
} catch (ConfigurationException e) {
log.error("Error in bootstrapping the OpenSAML2 library", e);
} finally {
thread.setContextClassLoader(loader);
}
}
}
示例3: init
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
@Override
public void init() throws IdentityOAuth2Exception {
super.init();
Thread thread = Thread.currentThread();
ClassLoader loader = thread.getContextClassLoader();
thread.setContextClassLoader(this.getClass().getClassLoader());
try {
DefaultBootstrap.bootstrap();
} catch (ConfigurationException e) {
log.error("Error in bootstrapping the OpenSAML2 library", e);
throw new IdentityOAuth2Exception("Error in bootstrapping the OpenSAML2 library");
} finally {
thread.setContextClassLoader(loader);
}
profileValidator = new SAMLSignatureProfileValidator();
}
示例4: initializeVelocity
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
/**
* Intializes the Apache Velocity template engine.
*
* @throws ConfigurationException thrown if there is a problem initializing Velocity
*/
protected static void initializeVelocity() throws ConfigurationException {
try {
log.debug("Initializing Velocity template engine");
Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
"org.apache.velocity.runtime.log.NullLogChute");
Velocity.setProperty(RuntimeConstants.ENCODING_DEFAULT, "UTF-8");
Velocity.setProperty(RuntimeConstants.OUTPUT_ENCODING, "UTF-8");
Velocity.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
Velocity.setProperty("classpath.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
Velocity.init();
} catch (Exception e) {
throw new ConfigurationException("Unable to initialize Velocity template engine", e);
}
}
示例5: getSAMLBuilder
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
private static XMLObjectBuilderFactory getSAMLBuilder() throws ConfigurationException {
if (builderFactory == null) {
// OpenSAML 2.3
DefaultBootstrap.bootstrap();
builderFactory = Configuration.getBuilderFactory();
nameIdBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(NameID.DEFAULT_ELEMENT_NAME);
confirmationMethodBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
subjectConfirmationBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
subjectBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Subject.DEFAULT_ELEMENT_NAME);
attrStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME);
audienceRestrictionnBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AudienceRestriction.DEFAULT_ELEMENT_NAME);
audienceBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Audience.DEFAULT_ELEMENT_NAME);
authStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnStatement.DEFAULT_ELEMENT_NAME);
authContextBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContext.DEFAULT_ELEMENT_NAME);
authContextClassRefBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
issuerBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
assertionBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
}
return builderFactory;
}
示例6: getClaims
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
private static List<Claim> getClaims(
org.opensaml.saml2.core.Assertion samlAssertion)
throws SecurityException, ValidationException,
ConfigurationException, UnmarshallingException,
CertificateException, KeyException {
ArrayList<Claim> claims = new ArrayList<Claim>();
List<org.opensaml.saml2.core.AttributeStatement> attributeStmts = samlAssertion
.getAttributeStatements();
for (org.opensaml.saml2.core.AttributeStatement attributeStmt : attributeStmts) {
List<org.opensaml.saml2.core.Attribute> attributes = attributeStmt
.getAttributes();
for (org.opensaml.saml2.core.Attribute attribute : attributes) {
String claimType = attribute.getName();
String claimValue = getValueFrom(attribute.getAttributeValues());
claims.add(new Claim(claimType, claimValue));
}
}
return claims;
}
示例7: testShouldValidateSaml11TokenWithRSTRAndReturnClaims
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public void testShouldValidateSaml11TokenWithRSTRAndReturnClaims()
throws URISyntaxException, CertificateException, KeyException,
ParserConfigurationException, SAXException, IOException,
ConfigurationException, SecurityException, ValidationException,
UnmarshallingException, FederationException,
NoSuchAlgorithmException {
String validTestToken = "<trust:RequestSecurityTokenResponseCollection xmlns:trust=\"http://docs.oasis-open.org/ws-sx/ws-trust/200512\"><trust:RequestSecurityTokenResponse Context=\"rm=0&id=passive\"><trust:Lifetime><wsu:Created xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">2010-12-09T19:28:38.440Z</wsu:Created><wsu:Expires xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">2010-12-09T20:28:38.440Z</wsu:Expires></trust:Lifetime><wsp:AppliesTo xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><EndpointReference xmlns=\"http://www.w3.org/2005/08/addressing\"><Address>https://localhost/javafederationtest/</Address></EndpointReference></wsp:AppliesTo><trust:RequestedSecurityToken><saml:Assertion MajorVersion=\"1\" MinorVersion=\"1\" AssertionID=\"_86fa42ed-6ee5-43b9-a8cf-ee3a8147229c\" Issuer=\"SelfSTS\" IssueInstant=\"2010-12-09T19:28:38.440Z\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\"><saml:Conditions NotBefore=\"2010-12-09T19:28:38.440Z\" NotOnOrAfter=\"2010-12-09T20:28:38.440Z\"><saml:AudienceRestrictionCondition><saml:Audience>https://localhost/javafederationtest/</saml:Audience></saml:AudienceRestrictionCondition></saml:Conditions><saml:AttributeStatement><saml:Subject><saml:SubjectConfirmation><saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod></saml:SubjectConfirmation></saml:Subject><saml:Attribute AttributeName=\"emailaddress\" AttributeNamespace=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims\"><saml:AttributeValue>[email protected]</saml:AttributeValue></saml:Attribute><saml:Attribute AttributeName=\"givenname\" AttributeNamespace=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims\"><saml:AttributeValue>Joe</saml:AttributeValue></saml:Attribute><saml:Attribute AttributeName=\"surname\" AttributeNamespace=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims\"><saml:AttributeValue>Doe</saml:AttributeValue></saml:Attribute><saml:Attribute AttributeName=\"otherphone\" AttributeNamespace=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims\"><saml:AttributeValue>555-5555-5555</saml:AttributeValue></saml:Attribute><saml:Attribute AttributeName=\"name\" AttributeNamespace=\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims\"><saml:AttributeValue>joe</saml:AttributeValue></saml:Attribute><saml:Attribute AttributeName=\"Group\" AttributeNamespace=\"http://schemas.xmlsoap.org/claims\"><saml:AttributeValue>Sales</saml:AttributeValue></saml:Attribute></saml:AttributeStatement><ds:Signature xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /><ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><ds:Reference URI=\"#_86fa42ed-6ee5-43b9-a8cf-ee3a8147229c\"><ds:Transforms><ds:Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><ds:Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" /></ds:Transforms><ds:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><ds:DigestValue>57glK3s7BXklywOUC0J0d3w5r9U=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>JrzxId4c+Yic9aI66/cM3NOHXvSSLBiFLlWR8radGW6zBGojWiRHO1HEJB+UGxlpGpkZ58AT1EP3wWPNSmKyxV2L8lKujj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VriIoNAkRN4ljCYKB/T0Ubt/IezlXAbuvJ78G1zJSfbVv6AdrxJXuwkVvJGJBkBDL8esbO6WS54r0qhgCOhAr46ccDm62dDRuaPFYrY5wC4gZ8I7mhkbh2xdt8IVVnNNAUS2TX4ue8JVyty6AwIGgtsweD1145VdK79XejXcgiRCs3zchgKJa7z8YrtTsD9yLXIGj2yB7XnXO6wNcmA==</X509Certificate></X509Data></KeyInfo></ds:Signature></saml:Assertion></trust:RequestedSecurityToken><trust:RequestedAttachedReference><o:SecurityTokenReference xmlns:o=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><o:KeyIdentifier ValueType=\"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID\">_86fa42ed-6ee5-43b9-a8cf-ee3a8147229c</o:KeyIdentifier></o:SecurityTokenReference></trust:RequestedAttachedReference><trust:RequestedUnattachedReference><o:SecurityTokenReference xmlns:o=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><o:KeyIdentifier ValueType=\"http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID\">_86fa42ed-6ee5-43b9-a8cf-ee3a8147229c</o:KeyIdentifier></o:SecurityTokenReference></trust:RequestedUnattachedReference><trust:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</trust:TokenType><trust:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</trust:RequestType><trust:KeyType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType></trust:RequestSecurityTokenResponse></trust:RequestSecurityTokenResponseCollection>";
SamlTokenValidator validator = new SamlTokenValidator();
validator.getTrustedIssuers().add("CN=SelfSTS");
validator.getAudienceUris().add(new URI("https://localhost/javafederationtest/"));
validator.setValidateExpiration(false);
List<Claim> claims = null;
claims = validator.validate(validTestToken);
assertEquals(6, claims.size());
assertEquals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", ((Claim) claims.get(0)).getClaimType());
assertEquals("[email protected]", ((Claim) claims.get(0)).getClaimValue());
}
示例8: testShouldValidateSaml20TokenWithRSTRAndReturnClaims
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public void testShouldValidateSaml20TokenWithRSTRAndReturnClaims()
throws URISyntaxException, CertificateException, KeyException,
ParserConfigurationException, SAXException, IOException,
ConfigurationException, SecurityException, ValidationException,
UnmarshallingException, FederationException,
NoSuchAlgorithmException {
SamlTokenValidator validator = new SamlTokenValidator();
validator.setThumbprint("3F5DFCDF4B3D0EAB9BA49BEFB3CFD760DA9CCCF1");
validator.getAudienceUris()
.add(new URI("spn:[email protected]3a117ea20"));
validator.setValidateExpiration(false);
List<Claim> claims = validator.validate(office365Token);
assertEquals(10, claims.size());
assertEquals("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/domain", ((Claim) claims.get(0)).getClaimType());
assertEquals("globalbank.onmicrosoft.com", ((Claim) claims.get(0)).getClaimValue());
}
示例9: testShouldThrowForTamperedSignature
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public void testShouldThrowForTamperedSignature()
throws URISyntaxException, CertificateException, KeyException,
ParserConfigurationException, SAXException, IOException,
ConfigurationException, SecurityException, ValidationException,
UnmarshallingException, FederationException,
NoSuchAlgorithmException {
SamlTokenValidator validator = new SamlTokenValidator();
try {
validator.validate(office365TokenInvalidSignature);
fail("The signature was tampered this should not validate");
} catch (FederationException e) {
// expected
assertEquals("Invalid signature", e.getMessage());
}
}
示例10: testShouldThrowBecauseTheTokenWasIssuedByUntrustedIssuer
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public void testShouldThrowBecauseTheTokenWasIssuedByUntrustedIssuer()
throws URISyntaxException, CertificateException, KeyException,
ParserConfigurationException, SAXException, IOException,
ConfigurationException, SecurityException, ValidationException,
UnmarshallingException, FederationException,
NoSuchAlgorithmException {
SamlTokenValidator validator = new SamlTokenValidator();
// don't configure trusted issuers.
try {
validator.validate(office365Token);
fail("Trusted issuers were not set, throw");
} catch (FederationException e) {
// expected
assertEquals("The token was issued by an authority that is not trusted", e.getMessage());
}
}
示例11: testShouldThrowBecauseTheTokenAppliesToUnknownAudience
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public void testShouldThrowBecauseTheTokenAppliesToUnknownAudience()
throws URISyntaxException, CertificateException, KeyException,
ParserConfigurationException, SAXException, IOException,
ConfigurationException, SecurityException, ValidationException,
UnmarshallingException, FederationException,
NoSuchAlgorithmException {
SamlTokenValidator validator = new SamlTokenValidator();
String invalidTrustedIssuer = "3F5DFCDF4B3D0EAB9BA49BEFB3CFD760DA9EEEF1";
validator.setThumbprint(invalidTrustedIssuer);
try {
validator.validate(office365Token);
fail("AudienceUris was not set, throw");
} catch (FederationException e) {
// expected
}
}
示例12: testShouldThrowBecauseTokenWasExpired
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
public void testShouldThrowBecauseTokenWasExpired()
throws URISyntaxException, CertificateException, KeyException,
ParserConfigurationException, SAXException, IOException,
ConfigurationException, SecurityException, ValidationException,
UnmarshallingException, FederationException,
NoSuchAlgorithmException {
SamlTokenValidator validator = new SamlTokenValidator();
validator.setThumbprint("3F5DFCDF4B3D0EAB9BA49BEFB3CFD760DA9CCCF1");
validator.getAudienceUris()
.add(new URI("spn:[email protected]3a117ea20"));
try {
validator.validate(office365Token);
fail("Token expired should throw");
} catch (FederationException e) {
// expected
}
}
示例13: init
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
@Override
public void init(FilterConfig filterConfig) throws ServletException {
Configuration.validateJCEProviders();
Configuration.validateNonSunJAXP();
for (Provider jceProvider : Security.getProviders()) {
logger.info(jceProvider.getInfo());
}
try {
logger.info("Bootstrapping");
DefaultBootstrap.bootstrap();
} catch (ConfigurationException e) {
throw new RuntimeException("Bootstrapping failed");
}
}
示例14: initializeXMLSecurity
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
/**
* Initializes the Apache XMLSecurity libary.
*
* @throws ConfigurationException thrown is there is a problem initializing the library
*/
protected static void initializeXMLSecurity() throws ConfigurationException {
Logger log = getLogger();
String lineBreakPropName = "org.apache.xml.security.ignoreLineBreaks";
// Don't override if it was set explicitly
if (System.getProperty(lineBreakPropName) == null) {
System.setProperty(lineBreakPropName, "true");
}
if (!Init.isInitialized()) {
log.debug("Initializing Apache XMLSecurity library");
Init.init();
}
}
示例15: initializeXMLTooling
import org.opensaml.xml.ConfigurationException; //导入依赖的package包/类
/**
* Initializes the XMLTooling library with an explicitly supplied set of object providers.
*
* @param providerConfigs list of provider configuration files located on the classpath
*
* @throws ConfigurationException thrown if there is a problem loading the configuration files
*/
protected static void initializeXMLTooling(String[] providerConfigs) throws ConfigurationException {
Logger log = getLogger();
Class clazz = Configuration.class;
XMLConfigurator configurator = new XMLConfigurator();
for (String config : providerConfigs) {
log.debug("Loading XMLTooling configuration {}", config);
configurator.load(clazz.getResourceAsStream(config));
}
}