use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class RegisteredServiceResponseHeadersEnforcementFilterTests method getFilterForProperty.
private static RegisteredServiceResponseHeadersEnforcementFilter getFilterForProperty(final Pair<RegisteredServiceProperties, String>... properties) {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val context = ServicesManagerConfigurationContext.builder().serviceRegistry(new InMemoryServiceRegistry(appCtx)).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
val servicesManager = new DefaultServicesManager(context);
val argumentExtractor = new DefaultArgumentExtractor(new WebApplicationServiceFactory());
val service = RegisteredServiceTestUtils.getRegisteredService("service-0");
val props1 = new LinkedHashMap<String, RegisteredServiceProperty>();
for (val p : properties) {
val prop1 = new DefaultRegisteredServiceProperty();
prop1.addValue(p.getValue());
props1.put(p.getKey().getPropertyName(), prop1);
}
service.setProperties(props1);
servicesManager.save(service);
return new RegisteredServiceResponseHeadersEnforcementFilter(servicesManager, argumentExtractor, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()), new RegisteredServiceAccessStrategyAuditableEnforcer(new CasConfigurationProperties()));
}
use of org.apereo.cas.services.InMemoryServiceRegistry in project cas by apereo.
the class DefaultSingleLogoutServiceLogoutUrlBuilderTests method beforeEach.
@BeforeEach
public void beforeEach() {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val context = ServicesManagerConfigurationContext.builder().serviceRegistry(new InMemoryServiceRegistry(appCtx)).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
this.servicesManager = new DefaultServicesManager(context);
}
Aggregations