Search in sources :

Example 1 with JsonServiceRegistryDao

use of org.apereo.cas.services.JsonServiceRegistryDao in project cas by apereo.

the class GrouperRegisteredServiceAccessStrategyRegistryTests method checkAccessStrategyJson.

@Test
public void checkAccessStrategyJson() throws Exception {
    final Map<String, Set<String>> attributes = new HashMap<>();
    final Set<String> v1 = new HashSet<>();
    v1.add("admin");
    attributes.put("memberOf", v1);
    final AbstractRegisteredService service = RegisteredServiceTestUtils.getRegisteredService("test");
    final GrouperRegisteredServiceAccessStrategy grouper = new GrouperRegisteredServiceAccessStrategy();
    grouper.setRequiredAttributes(attributes);
    service.setAccessStrategy(grouper);
    final JsonServiceRegistryDao dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
    dao.save(service);
    dao.load();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) JsonServiceRegistryDao(org.apereo.cas.services.JsonServiceRegistryDao) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) AbstractRegisteredService(org.apereo.cas.services.AbstractRegisteredService) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with JsonServiceRegistryDao

use of org.apereo.cas.services.JsonServiceRegistryDao in project cas by apereo.

the class SamlRegisteredServiceTests method verifySavingSamlService.

@Test
public void verifySavingSamlService() throws Exception {
    final SamlRegisteredService service = new SamlRegisteredService();
    service.setName(SAML_SERVICE);
    service.setServiceId("http://mmoayyed.unicon.net");
    service.setMetadataLocation(METADATA_LOCATION);
    final JsonServiceRegistryDao dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
    dao.save(service);
    dao.load();
}
Also used : JsonServiceRegistryDao(org.apereo.cas.services.JsonServiceRegistryDao) SamlRegisteredService(org.apereo.cas.support.saml.services.SamlRegisteredService) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) Test(org.junit.Test)

Example 3 with JsonServiceRegistryDao

use of org.apereo.cas.services.JsonServiceRegistryDao in project cas by apereo.

the class SamlRegisteredServiceTests method verifySavingInCommonSamlService.

@Test
public void verifySavingInCommonSamlService() throws Exception {
    final SamlRegisteredService service = new SamlRegisteredService();
    service.setName(SAML_SERVICE);
    service.setServiceId("http://mmoayyed.unicon.net");
    service.setMetadataLocation(METADATA_LOCATION);
    final InCommonRSAttributeReleasePolicy policy = new InCommonRSAttributeReleasePolicy();
    final ChainingAttributeReleasePolicy chain = new ChainingAttributeReleasePolicy();
    chain.setPolicies(Arrays.asList(policy, new DenyAllAttributeReleasePolicy()));
    service.setAttributeReleasePolicy(chain);
    final JsonServiceRegistryDao dao = new JsonServiceRegistryDao(RESOURCE, false, mock(ApplicationEventPublisher.class));
    dao.save(service);
    dao.load();
}
Also used : InCommonRSAttributeReleasePolicy(org.apereo.cas.support.saml.services.InCommonRSAttributeReleasePolicy) DenyAllAttributeReleasePolicy(org.apereo.cas.services.DenyAllAttributeReleasePolicy) JsonServiceRegistryDao(org.apereo.cas.services.JsonServiceRegistryDao) SamlRegisteredService(org.apereo.cas.support.saml.services.SamlRegisteredService) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) ChainingAttributeReleasePolicy(org.apereo.cas.services.ChainingAttributeReleasePolicy) Test(org.junit.Test)

Aggregations

JsonServiceRegistryDao (org.apereo.cas.services.JsonServiceRegistryDao)3 Test (org.junit.Test)3 ApplicationEventPublisher (org.springframework.context.ApplicationEventPublisher)3 SamlRegisteredService (org.apereo.cas.support.saml.services.SamlRegisteredService)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 AbstractRegisteredService (org.apereo.cas.services.AbstractRegisteredService)1 ChainingAttributeReleasePolicy (org.apereo.cas.services.ChainingAttributeReleasePolicy)1 DenyAllAttributeReleasePolicy (org.apereo.cas.services.DenyAllAttributeReleasePolicy)1 InCommonRSAttributeReleasePolicy (org.apereo.cas.support.saml.services.InCommonRSAttributeReleasePolicy)1