use of org.opensaml.saml.criterion.EntityRoleCriterion in project cas by apereo.
the class SamlRegisteredServiceCacheKeyTests method verifyCacheKeyNoEntityIdCriteria.
@Test
public void verifyCacheKeyNoEntityIdCriteria() {
val criteriaSet = new CriteriaSet();
criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
val service = new SamlRegisteredService();
service.setName("Example");
service.setId(1000);
service.setServiceId(".+");
service.setMetadataLocation("https://mdq.something.net/entities/{0}");
val results = new SamlRegisteredServiceCacheKey(service, criteriaSet);
assertNotNull(results.getId());
assertEquals(service.getServiceId(), results.getCacheKey());
}
use of org.opensaml.saml.criterion.EntityRoleCriterion 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.saml.criterion.EntityRoleCriterion 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.saml.criterion.EntityRoleCriterion 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.saml.criterion.EntityRoleCriterion 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));
}
Aggregations