use of org.opensaml.core.criterion.EntityIdCriterion in project cas by apereo.
the class SamlRegisteredServiceCacheKeyTests method verifyCacheKeyByMetadataLocation.
@Test
public void verifyCacheKeyByMetadataLocation() {
val entityId = "https://carmenwiki.osu.edu/shibboleth";
val criteriaSet = new CriteriaSet();
criteriaSet.add(new EntityIdCriterion(entityId));
criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
val service = new SamlRegisteredService();
service.setName("Example");
service.setId(1000);
service.setServiceId(".+");
service.setMetadataLocation("classpath:sample-sp.xml");
val results = new SamlRegisteredServiceCacheKey(service, criteriaSet);
assertNotNull(results.getId());
assertNotNull(results.getRegisteredService());
assertNotNull(results.getCriteriaSet());
assertEquals(results.getCacheKey(), service.getMetadataLocation());
}
use of org.opensaml.core.criterion.EntityIdCriterion in project cas by apereo.
the class FileSystemResourceMetadataResolverTests method verifyResolverWithDirectory.
@Test
public void verifyResolverWithDirectory() throws Exception {
val resolver = new FileSystemResourceMetadataResolver(PROPERTIES, openSamlConfigBean);
val service = new SamlRegisteredService();
val file = new FileSystemResource("src/test/resources/md-dir").getFile().getCanonicalPath();
service.setMetadataLocation(file);
val resolvers = resolver.resolve(service);
assertFalse(resolvers.isEmpty());
val directoryResolver = resolvers.iterator().next();
val criteriaSet = new CriteriaSet();
criteriaSet.add(new EntityIdCriterion("https://idp.example.net/idp/shibboleth"));
criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
assertNotNull(directoryResolver.resolve(criteriaSet));
}
use of org.opensaml.core.criterion.EntityIdCriterion in project cas by apereo.
the class InMemoryResourceMetadataResolverTests method verifyInvalidExpiredMetadataResourceIsOkay.
@Test
public void verifyInvalidExpiredMetadataResourceIsOkay() throws Exception {
val resolver = new InMemoryResourceMetadataResolver(new ClassPathResource("metadata/metadata-expired.xml"), configBean);
resolver.setRequireValidMetadata(false);
resolver.setId(UUID.randomUUID().toString());
resolver.initialize();
val criteriaSet = new CriteriaSet();
criteriaSet.add(new EntityIdCriterion("urn:app.e2ma.net"));
criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
val resolved = resolver.resolve(criteriaSet);
assertFalse(Iterables.isEmpty(resolved));
}
use of org.opensaml.core.criterion.EntityIdCriterion in project cas by apereo.
the class InMemoryResourceMetadataResolverTests method verifyExpiredValidUntilMetadataResource.
@Test
public void verifyExpiredValidUntilMetadataResource() throws Exception {
val resolver = new InMemoryResourceMetadataResolver(new ClassPathResource("metadata/metadata-expired.xml"), configBean);
resolver.setId(UUID.randomUUID().toString());
resolver.initialize();
val criteriaSet = new CriteriaSet();
criteriaSet.add(new EntityIdCriterion("urn:app.e2ma.net"));
criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
val resolved = resolver.resolve(criteriaSet);
assertTrue(Iterables.isEmpty(resolved));
}
use of org.opensaml.core.criterion.EntityIdCriterion in project verify-hub by alphagov.
the class IdpSingleSignOnServiceHelperTest method setUp.
@BeforeEach
public void setUp() throws ResolverException, MarshallingException, SignatureException {
CriteriaSet criteria = new CriteriaSet(new EntityIdCriterion(idpEntityId));
EntityDescriptor idpEntityDescriptor = anEntityDescriptor().withIdpSsoDescriptor(anIdpSsoDescriptor().withSingleSignOnService(anEndpoint().withLocation(idpSSOUri.toASCIIString()).buildSingleSignOnService()).build()).build();
when(metadataProvider.resolveSingle(eq(criteria))).thenReturn(idpEntityDescriptor);
when(metadataProvider.resolveSingle(not(eq(criteria)))).thenReturn(null);
idpSingleSignOnServiceHelper = new IdpSingleSignOnServiceHelper(metadataProvider);
}
Aggregations