Search in sources :

Example 1 with EntityDescriptorCriterionPredicateRegistry

use of org.opensaml.saml.metadata.criteria.entity.impl.EntityDescriptorCriterionPredicateRegistry in project verify-hub by alphagov.

the class HubAsIdpMetadataHandlerTest method initializeMetadata.

private MetadataResolver initializeMetadata() {
    try {
        InitializationService.initialize();
        String content = new MetadataFactory().defaultMetadata();
        StringBackedMetadataResolver metadataResolver = new StringBackedMetadataResolver(content);
        BasicParserPool pool = new BasicParserPool();
        pool.initialize();
        metadataResolver.setParserPool(pool);
        metadataResolver.setId("testResolver");
        metadataResolver.setResolveViaPredicatesOnly(true);
        metadataResolver.setRequireValidMetadata(true);
        EntityDescriptorCriterionPredicateRegistry registry = new EntityDescriptorCriterionPredicateRegistry();
        registry.register(EntitiesDescriptorNameCriterion.class, EntitiesDescriptorNamePredicate.class);
        metadataResolver.setCriterionPredicateRegistry(registry);
        metadataResolver.initialize();
        return metadataResolver;
    } catch (ComponentInitializationException | InitializationException e) {
        throw propagate(e);
    }
}
Also used : MetadataFactory(uk.gov.ida.saml.metadata.test.factories.metadata.MetadataFactory) ComponentInitializationException(net.shibboleth.utilities.java.support.component.ComponentInitializationException) BasicParserPool(net.shibboleth.utilities.java.support.xml.BasicParserPool) StringBackedMetadataResolver(uk.gov.ida.saml.metadata.StringBackedMetadataResolver) ComponentInitializationException(net.shibboleth.utilities.java.support.component.ComponentInitializationException) InitializationException(org.opensaml.core.config.InitializationException) EntityDescriptorCriterionPredicateRegistry(org.opensaml.saml.metadata.criteria.entity.impl.EntityDescriptorCriterionPredicateRegistry)

Aggregations

ComponentInitializationException (net.shibboleth.utilities.java.support.component.ComponentInitializationException)1 BasicParserPool (net.shibboleth.utilities.java.support.xml.BasicParserPool)1 InitializationException (org.opensaml.core.config.InitializationException)1 EntityDescriptorCriterionPredicateRegistry (org.opensaml.saml.metadata.criteria.entity.impl.EntityDescriptorCriterionPredicateRegistry)1 StringBackedMetadataResolver (uk.gov.ida.saml.metadata.StringBackedMetadataResolver)1 MetadataFactory (uk.gov.ida.saml.metadata.test.factories.metadata.MetadataFactory)1