use of org.opensaml.saml.metadata.resolver.MetadataResolver in project cas by apereo.
the class SamlRegisteredServiceMetadataResolverCacheLoader method load.
@Override
@Synchronized
@SneakyThrows
public ChainingMetadataResolver load(final SamlRegisteredService service) {
final ChainingMetadataResolver metadataResolver = new ChainingMetadataResolver();
final List<MetadataResolver> metadataResolvers = new ArrayList<>();
final Collection<SamlRegisteredServiceMetadataResolver> availableResolvers = this.metadataResolutionPlan.getRegisteredMetadataResolvers();
availableResolvers.stream().filter(Objects::nonNull).filter(r -> r.supports(service)).map(r -> r.resolve(service)).forEach(metadataResolvers::addAll);
if (metadataResolvers.isEmpty()) {
throw new SamlException("No metadata resolvers could be configured for service " + service.getName() + " with metadata location " + service.getMetadataLocation());
}
metadataResolver.setId(ChainingMetadataResolver.class.getCanonicalName());
metadataResolver.setResolvers(metadataResolvers);
metadataResolver.initialize();
LOGGER.debug("Metadata resolvers active for this request are [{}]", metadataResolver);
return metadataResolver;
}
use of org.opensaml.saml.metadata.resolver.MetadataResolver in project verify-hub by alphagov.
the class IdpSingleSignOnServiceHelperTest method shouldThrowExceptionWhenMetadataProviderThrowsOne.
@Test(expected = RuntimeException.class)
public void shouldThrowExceptionWhenMetadataProviderThrowsOne() throws ResolverException {
MetadataResolver metadataResolver = mock(MetadataResolver.class);
when(metadataResolver.resolveSingle(any(CriteriaSet.class))).thenThrow(new ResolverException());
idpSingleSignOnServiceHelper = new IdpSingleSignOnServiceHelper(metadataResolver);
idpSingleSignOnServiceHelper.getSingleSignOn(idpEntityId);
}
Aggregations