use of org.apereo.cas.ticket.registry.DefaultTicketRegistrySupport in project cas by apereo.
the class DelegatedAuthenticationSingleSignOnParticipationStrategyTests method getSingleSignOnStrategy.
private static SingleSignOnParticipationStrategy getSingleSignOnStrategy(final RegisteredService svc, final TicketRegistry ticketRegistry) {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val context = ServicesManagerConfigurationContext.builder().serviceRegistry(new InMemoryServiceRegistry(appCtx, List.of(svc), List.of())).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
val servicesManager = new DefaultServicesManager(context);
servicesManager.load();
val authenticationExecutionPlan = new DefaultAuthenticationEventExecutionPlan();
authenticationExecutionPlan.registerAuthenticationHandler(new SimpleTestUsernamePasswordAuthenticationHandler());
return new DelegatedAuthenticationSingleSignOnParticipationStrategy(servicesManager, new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()), new DefaultTicketRegistrySupport(ticketRegistry));
}
use of org.apereo.cas.ticket.registry.DefaultTicketRegistrySupport in project cas by apereo.
the class RegisteredServiceAuthenticationPolicySingleSignOnParticipationStrategyTests method getSingleSignOnStrategy.
private static SingleSignOnParticipationStrategy getSingleSignOnStrategy(final RegisteredService svc, final TicketRegistry ticketRegistry) {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val context = ServicesManagerConfigurationContext.builder().serviceRegistry(new InMemoryServiceRegistry(appCtx, List.of(svc), List.of())).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
val servicesManager = new DefaultServicesManager(context);
servicesManager.load();
val authenticationExecutionPlan = new DefaultAuthenticationEventExecutionPlan();
authenticationExecutionPlan.registerAuthenticationHandler(new SimpleTestUsernamePasswordAuthenticationHandler());
return new RegisteredServiceAuthenticationPolicySingleSignOnParticipationStrategy(servicesManager, new DefaultTicketRegistrySupport(ticketRegistry), new DefaultAuthenticationServiceSelectionPlan(new DefaultAuthenticationServiceSelectionStrategy()), authenticationExecutionPlan, appCtx);
}
Aggregations