use of org.apereo.cas.services.JsonServiceRegistry in project cas by apereo.
the class SamlRegisteredServiceTests method verifySavingSamlService.
@Test
public void verifySavingSamlService() throws Exception {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val registeredService = new SamlRegisteredService();
registeredService.setName(SAML_SERVICE);
registeredService.setServiceId("http://mmoayyed.unicon.net");
registeredService.setMetadataLocation(METADATA_LOCATION);
val dao = new JsonServiceRegistry(RESOURCE, WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
dao.save(registeredService);
dao.load();
}
use of org.apereo.cas.services.JsonServiceRegistry in project cas by apereo.
the class GrouperRegisteredServiceAccessStrategyTests method checkAccessStrategyJson.
@Test
public void checkAccessStrategyJson() throws Exception {
val attributes = new HashMap<String, Set<String>>();
val v1 = new HashSet<String>();
v1.add("admin");
attributes.put("memberOf", v1);
val service = RegisteredServiceTestUtils.getRegisteredService("test");
val grouper = new GrouperRegisteredServiceAccessStrategy();
grouper.setConfigProperties(CollectionUtils.wrap("hello", "world"));
grouper.setRequiredAttributes(attributes);
service.setAccessStrategy(grouper);
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val dao = new JsonServiceRegistry(RESOURCE, WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
val saved = dao.save(service);
assertEquals(service, saved);
assertFalse(dao.load().isEmpty());
}
Aggregations