use of org.apereo.cas.services.JsonServiceRegistry 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 JsonServiceRegistry dao = new JsonServiceRegistry(RESOURCE, false, mock(ApplicationEventPublisher.class), new NoOpRegisteredServiceReplicationStrategy());
dao.save(service);
dao.load();
}
use of org.apereo.cas.services.JsonServiceRegistry 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 JsonServiceRegistry dao = new JsonServiceRegistry(RESOURCE, false, mock(ApplicationEventPublisher.class), new NoOpRegisteredServiceReplicationStrategy());
dao.save(service);
dao.load();
}
use of org.apereo.cas.services.JsonServiceRegistry 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 JsonServiceRegistry dao = new JsonServiceRegistry(RESOURCE, false, mock(ApplicationEventPublisher.class), new NoOpRegisteredServiceReplicationStrategy());
dao.save(service);
dao.load();
}
use of org.apereo.cas.services.JsonServiceRegistry in project cas by apereo.
the class JsonServiceRegistryConfiguration method jsonServiceRegistry.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "jsonServiceRegistry")
public ServiceRegistry jsonServiceRegistry(@Qualifier("registeredServiceResourceNamingStrategy") final RegisteredServiceResourceNamingStrategy resourceNamingStrategy, final ConfigurableApplicationContext applicationContext, final CasConfigurationProperties casProperties, @Qualifier("registeredServiceReplicationStrategy") final RegisteredServiceReplicationStrategy registeredServiceReplicationStrategy, final ObjectProvider<List<ServiceRegistryListener>> serviceRegistryListeners) throws Exception {
val registry = casProperties.getServiceRegistry();
val json = new JsonServiceRegistry(registry.getJson().getLocation(), WatcherService.noOp(), applicationContext, registeredServiceReplicationStrategy, resourceNamingStrategy, Optional.ofNullable(serviceRegistryListeners.getIfAvailable()).orElseGet(ArrayList::new));
if (registry.getJson().isWatcherEnabled()) {
json.enableDefaultWatcherService();
}
return json;
}
use of org.apereo.cas.services.JsonServiceRegistry in project cas by apereo.
the class SamlRegisteredServiceTests method verifySavingInCommonSamlService.
@Test
public void verifySavingInCommonSamlService() throws Exception {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val service = new SamlRegisteredService();
service.setName(SAML_SERVICE);
service.setServiceId("http://mmoayyed.unicon.net");
service.setMetadataLocation(METADATA_LOCATION);
val policy = new InCommonRSAttributeReleasePolicy();
val chain = new ChainingAttributeReleasePolicy();
chain.setPolicies(Arrays.asList(policy, new DenyAllAttributeReleasePolicy()));
service.setAttributeReleasePolicy(chain);
val dao = new JsonServiceRegistry(new FileSystemResource(FileUtils.getTempDirectoryPath() + File.separator + "json-service-registry"), WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
dao.save(service);
dao.load();
}
Aggregations