本文整理汇总了Java中net.shibboleth.utilities.java.support.component.ComponentInitializationException类的典型用法代码示例。如果您正苦于以下问题:Java ComponentInitializationException类的具体用法?Java ComponentInitializationException怎么用?Java ComponentInitializationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComponentInitializationException类属于net.shibboleth.utilities.java.support.component包,在下文中一共展示了ComponentInitializationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSingleMetadataResolver
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
/**
* Build single metadata resolver.
*
* @param metadataFilterChain the metadata filters chained together
* @param resource the resource
* @param document the xml document to parse
* @return list of resolved metadata from resources.
* @throws IOException the iO exception
*/
private List<MetadataResolver> buildSingleMetadataResolver(final MetadataFilter metadataFilterChain,
final Resource resource, final Document document) throws IOException {
final List<MetadataResolver> resolvers = new ArrayList<>();
final Element metadataRoot = document.getDocumentElement();
final DOMMetadataResolver metadataProvider = new DOMMetadataResolver(metadataRoot);
metadataProvider.setParserPool(this.configBean.getParserPool());
metadataProvider.setFailFastInitialization(true);
metadataProvider.setRequireValidMetadata(this.requireValidMetadata);
metadataProvider.setId(metadataProvider.getClass().getCanonicalName());
if (metadataFilterChain != null) {
metadataProvider.setMetadataFilter(metadataFilterChain);
}
logger.debug("Initializing metadata resolver for [{}]", resource.getURL());
try {
metadataProvider.initialize();
} catch (final ComponentInitializationException ex) {
logger.warn("Could not initialize metadata resolver. Resource will be ignored", ex);
}
resolvers.add(metadataProvider);
return resolvers;
}
示例2: init
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private void init(String request) throws ParseException, ComponentInitializationException {
AuthenticationRequest req = AuthenticationRequest.parse(request);
requestCtx = new RequestContextBuilder().setInboundMessage(req).buildRequestContext();
ProfileRequestContext prc = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
authnCtx = prc.getSubcontext(AuthenticationContext.class, true);
List<AuthenticationResult> results = new ArrayList<AuthenticationResult>();
Subject subject1 = new Subject();
AuthenticationResult result1 = new AuthenticationResult("id1", subject1);
// 10 seconds ago
result1.setAuthenticationInstant(new Date().getTime() - 10000);
Subject subject2 = new Subject();
AuthenticationResult result2 = new AuthenticationResult("id2", subject2);
// 5 seconds ago
result2.setAuthenticationInstant(new Date().getTime() - 5000);
results.add(result1);
results.add(result2);
authnCtx.setActiveResults(results);
action = new FilterActiveAuthenticationResultsByMaxAge();
action.initialize();
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:22,代码来源:FilterActiveAuthenticationResultsByMaxAgeTest.java
示例3: createAssertionTranslator
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
public AssertionTranslator createAssertionTranslator(
MetadataResolver msaMetadataResolver,
DateTimeComparator dateTimeComparator
) throws ComponentInitializationException {
MetadataBackedSignatureValidator metadataBackedSignatureValidator = getMetadataBackedSignatureValidator(msaMetadataResolver);
SamlMessageSignatureValidator samlMessageSignatureValidator = new SamlMessageSignatureValidator(metadataBackedSignatureValidator);
TimeRestrictionValidator timeRestrictionValidator = new TimeRestrictionValidator(dateTimeComparator);
SamlAssertionsSignatureValidator assertionsSignatureValidator = new SamlAssertionsSignatureValidator(samlMessageSignatureValidator);
AssertionValidator assertionValidator = new AssertionValidator(
new InstantValidator(dateTimeComparator),
new SubjectValidator(timeRestrictionValidator),
new ConditionsValidator(timeRestrictionValidator, new AudienceRestrictionValidator())
);
return new AssertionTranslator(
assertionsSignatureValidator,
assertionValidator
);
}
示例4: setUp
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@Before
public void setUp() throws ComponentInitializationException {
// Note: the private key and the encrypting credential need to be from the same keypair
PrivateKey privateKey = new PrivateKeyStoreFactory().create(TestEntityIds.TEST_RP).getEncryptionPrivateKeys().get(0);
encryptionCredentialFactory = new TestCredentialFactory(TEST_RP_PUBLIC_ENCRYPTION_CERT, TEST_RP_PRIVATE_ENCRYPTION_KEY);
testRpSigningCredential = new TestCredentialFactory(TEST_RP_PUBLIC_SIGNING_CERT, TEST_RP_PRIVATE_SIGNING_KEY).getSigningCredential();
hubMetadataResolver = mock(MetadataResolver.class);
ResponseFactory responseFactory = new ResponseFactory(privateKey, privateKey);
DateTimeComparator dateTimeComparator = new DateTimeComparator(Duration.standardSeconds(5));
TimeRestrictionValidator timeRestrictionValidator = new TimeRestrictionValidator(dateTimeComparator);
SamlAssertionsSignatureValidator samlAssertionsSignatureValidator = mock(SamlAssertionsSignatureValidator.class);
InstantValidator instantValidator = new InstantValidator(dateTimeComparator);
SubjectValidator subjectValidator = new SubjectValidator(timeRestrictionValidator);
ConditionsValidator conditionsValidator = new ConditionsValidator(timeRestrictionValidator, new AudienceRestrictionValidator());
AssertionValidator assertionValidator = new AssertionValidator(instantValidator, subjectValidator, conditionsValidator);
AssertionTranslator assertionTranslator = new AssertionTranslator(samlAssertionsSignatureValidator, assertionValidator);
responseService = responseFactory.createResponseService(
hubMetadataResolver,
assertionTranslator,
dateTimeComparator
);
}
示例5: testEncoding
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@Test
public void testEncoding() throws ComponentInitializationException, AttributeEncodingException {
init();
IdPAttribute attribute = new IdPAttribute("test");
List<ScopedStringAttributeValue> stringAttributeValues = new ArrayList<ScopedStringAttributeValue>();
stringAttributeValues.add(new ScopedStringAttributeValue("value1", "scope"));
stringAttributeValues.add(new ScopedStringAttributeValue("value2", "scope"));
attribute.setValues(stringAttributeValues);
JSONObject object = encoder.encode(attribute);
Assert.assertTrue(((String) object.get("attributeName")).split(" ")[0].equals("[email protected]"));
Assert.assertTrue(((String) object.get("attributeName")).split(" ")[1].equals("[email protected]"));
Assert.assertTrue(((String) object.get("attributeName")).split(" ").length == 2);
encoder.setScopeDelimiter(":");
encoder.setStringDelimiter(";");
object = encoder.encode(attribute);
Assert.assertTrue(((String) object.get("attributeName")).split(";")[0].equals("value1:scope"));
Assert.assertTrue(((String) object.get("attributeName")).split(";")[1].equals("value2:scope"));
Assert.assertTrue(((String) object.get("attributeName")).split(";").length == 2);
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:20,代码来源:OIDCScopedStringAttributeEncoderTest.java
示例6: createResponseService
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
public ResponseService createResponseService(
MetadataResolver hubMetadataResolver,
AssertionTranslator assertionTranslator,
DateTimeComparator dateTimeComparator
) throws ComponentInitializationException {
AssertionDecrypter assertionDecrypter = createAssertionDecrypter();
MetadataBackedSignatureValidator metadataBackedSignatureValidator = getMetadataBackedSignatureValidator(hubMetadataResolver);
return new ResponseService(
createStringToResponseTransformer(),
assertionDecrypter,
assertionTranslator,
new SamlResponseSignatureValidator(new SamlMessageSignatureValidator(metadataBackedSignatureValidator)),
new InstantValidator(dateTimeComparator)
);
}
示例7: getVerifyAttributeQueryToInboundMatchingServiceRequestTransformer
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
public VerifyAttributeQueryToInboundMatchingServiceRequestTransformer getVerifyAttributeQueryToInboundMatchingServiceRequestTransformer(
final MetadataResolver metaDataResolver,
final IdaKeyStore keyStore,
final MatchingServiceAdapterConfiguration matchingServiceAdapterConfiguration,
final String hubEntityId,
CertificateChainEvaluableCriterion certificateChainEvaluableCriterion) throws ComponentInitializationException {
HubAssertionUnmarshaller hubAssertionTransformer = coreTransformersFactory.getAssertionToHubAssertionTransformer(hubEntityId);
IdentityProviderAssertionUnmarshaller identityProviderAssertionTransformer = new IdentityProviderAssertionUnmarshaller(
new MatchingDatasetUnmarshaller(new AddressFactory()),
new IdentityProviderAuthnStatementUnmarshaller(new AuthnContextFactory()),
hubEntityId
);
SignatureValidator signatureValidator = getMetadataBackedSignatureValidator(metaDataResolver, certificateChainEvaluableCriterion);
return new VerifyAttributeQueryToInboundMatchingServiceRequestTransformer(
new SamlAttributeQueryValidator(),
new AttributeQuerySignatureValidator(new SamlMessageSignatureValidator(signatureValidator)),
new SamlAssertionsSignatureValidator(new SamlMessageSignatureValidator(signatureValidator)),
new InboundMatchingServiceRequestUnmarshaller(hubAssertionTransformer, identityProviderAssertionTransformer),
new SamlAttributeQueryAssertionsValidator(getAssertionValidator(), getIdentityProviderAssertionValidator(), matchingServiceAdapterConfiguration, hubEntityId),
new AssertionDecrypter(new IdaKeyStoreCredentialRetriever(keyStore), new EncryptionAlgorithmValidator(), new DecrypterFactory()),
hubEntityId);
}
示例8: testRequestFavorSSO
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@Test
public void testRequestFavorSSO() throws ComponentInitializationException {
final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
final List<Principal> principals = Arrays.<Principal> asList(new TestPrincipal("test3"), new TestPrincipal(
"test2"));
final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
rpc.getPrincipalEvalPredicateFactoryRegistry().register(TestPrincipal.class, "exact",
new ExactPrincipalEvalPredicateFactory());
rpc.setOperator("exact");
rpc.setRequestedPrincipals(principals);
authCtx.addSubcontext(rpc, true);
final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
active.getSubject().getPrincipals().add(new TestPrincipal("test2"));
authCtx.setActiveResults(Arrays.asList(active));
authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
action = new SelectAuthenticationFlow();
action.setFavorSSO(true);
action.initialize();
final Event event = action.execute(src);
ActionTestingSupport.assertProceedEvent(event);
Assert.assertEquals(active, authCtx.getAuthenticationResult());
}
示例9: testTags
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@Test
public void testTags() throws ComponentInitializationException, LangTagException {
OIDCClientMetadata request = new OIDCClientMetadata();
String name1 = "client name";
LangTag tag1 = new LangTag("en");
String name2 = "asiakkaan nimi";
LangTag tag2 = new LangTag("fi");
request.setName(name1, tag1);
request.setName(name2, tag2);
OIDCClientMetadata result = new OIDCClientMetadata();
setUpContext(request, result);
Assert.assertNull(action.execute(requestCtx));
Assert.assertNull(result.getName());
Map<LangTag, String> map = result.getNameEntries();
Assert.assertFalse(map.isEmpty());
Assert.assertEquals(map.size(), 2);
Assert.assertEquals(map.get(tag1), name1);
Assert.assertEquals(map.get(tag2), name2);
}
示例10: doInitialize
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doInitialize() throws ComponentInitializationException {
setId(resolver.getId());
super.doInitialize();
if (null == resolver) {
throw new ComponentInitializationException("ProviderMetadataResolver cannot be null");
}
if (null == sortKey) {
synchronized (this) {
sortKeyValue++;
sortKey = new Integer(sortKeyValue);
}
log.info("Top level ProviderMetadata Provider '{}' did not have a sort key; giving it value '{}'", getId(),
sortKey);
}
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:19,代码来源:ServiceableProviderMetadataProvider.java
示例11: assertEvent
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
protected void assertEvent(String expectedEvent, OIDCClientMetadata metadata, URI... redirectUris)
throws ComponentInitializationException {
Set<URI> uris = new HashSet<URI>();
if (redirectUris != null) {
uris = new HashSet<URI>();
for (URI uri : redirectUris) {
uris.add(uri);
}
}
metadata.setRedirectionURIs(uris);
setUpContext(new OIDCClientRegistrationRequest(null, metadata, null));
if (expectedEvent != null) {
ActionTestingSupport.assertEvent(action.execute(requestCtx), expectedEvent);
} else {
Assert.assertNull(action.execute(requestCtx));
}
}
示例12: build
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@Override
public SignatureTrustEngine build() {
final MetadataCredentialResolver metadataCredentialResolver = new MetadataCredentialResolver();
final BasicRoleDescriptorResolver roleResolver = new BasicRoleDescriptorResolver(metadataResolver);
final KeyInfoCredentialResolver keyResolver =
DefaultSecurityConfigurationBootstrap.buildBasicInlineKeyInfoCredentialResolver();
metadataCredentialResolver.setKeyInfoCredentialResolver(keyResolver);
metadataCredentialResolver.setRoleDescriptorResolver(roleResolver);
try {
metadataCredentialResolver.initialize();
roleResolver.initialize();
} catch (final ComponentInitializationException e) {
throw new SAMLException(e);
}
return new ExplicitKeySignatureTrustEngine(metadataCredentialResolver, keyResolver);
}
示例13: testRequestPickActiveInitial
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
@Test
public void testRequestPickActiveInitial() throws ComponentInitializationException {
final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
final List<Principal> principals = Arrays.<Principal> asList(new TestPrincipal("test3"), new TestPrincipal(
"test2"));
final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
rpc.getPrincipalEvalPredicateFactoryRegistry().register(TestPrincipal.class, "exact",
new ExactPrincipalEvalPredicateFactory());
rpc.setOperator("exact");
rpc.setRequestedPrincipals(principals);
authCtx.addSubcontext(rpc, true);
final AuthenticationResult active = new AuthenticationResult("test2", new Subject());
active.getSubject().getPrincipals().add(new TestPrincipal("test2"));
authCtx.setActiveResults(Arrays.asList(active));
authCtx.setInitialAuthenticationResult(active);
authCtx.setForceAuthn(true);
authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(ImmutableList.of(principals.get(0)));
action = new SelectAuthenticationFlow();
action.setFavorSSO(true);
action.initialize();
action.execute(src);
Assert.assertEquals(active, authCtx.getAuthenticationResult());
}
示例14: doInitialize
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
if (name == null) {
throw new ComponentInitializationException("Attribute name cannot be null or empty");
}
if (asObject && (fieldName == null || fieldName.length() == 0)) {
throw new ComponentInitializationException("JSON Object field name cannot be null");
}
}
示例15: doInitialize
import net.shibboleth.utilities.java.support.component.ComponentInitializationException; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected void doInitialize() throws ComponentInitializationException {
super.doInitialize();
if (classRefLookupStrategy == null) {
classRefLookupStrategy = new DefaultPrincipalDeterminationStrategy<>(
AuthenticationContextClassReferencePrincipal.class,
new AuthenticationContextClassReferencePrincipal(
AuthenticationContextClassReferencePrincipal.UNSPECIFIED));
}
}
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:13,代码来源:SetAuthenticationContextClassReferenceToResponseContext.java