Search in sources :

Example 6 with InMemoryServiceRegistry

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

the class ChainingSingleLogoutServiceLogoutUrlBuilderTests 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);
}
Also used : lombok.val(lombok.val) DefaultServicesManagerRegisteredServiceLocator(org.apereo.cas.services.DefaultServicesManagerRegisteredServiceLocator) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with InMemoryServiceRegistry

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

the class GroovyDelegatedClientIdentityProviderRedirectionStrategyTests method setup.

@BeforeEach
public void setup() {
    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);
}
Also used : lombok.val(lombok.val) DefaultServicesManagerRegisteredServiceLocator(org.apereo.cas.services.DefaultServicesManagerRegisteredServiceLocator) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 8 with InMemoryServiceRegistry

use of org.apereo.cas.services.InMemoryServiceRegistry 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));
}
Also used : lombok.val(lombok.val) DefaultAuthenticationEventExecutionPlan(org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan) DefaultAuthenticationServiceSelectionStrategy(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy) DefaultServicesManagerRegisteredServiceLocator(org.apereo.cas.services.DefaultServicesManagerRegisteredServiceLocator) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) DefaultTicketRegistrySupport(org.apereo.cas.ticket.registry.DefaultTicketRegistrySupport) SimpleTestUsernamePasswordAuthenticationHandler(org.apereo.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler) DefaultAuthenticationServiceSelectionPlan(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan) DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) HashSet(java.util.HashSet)

Example 9 with InMemoryServiceRegistry

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

the class ServiceThemeResolverTests method setUp.

@Before
public void setUp() throws Exception {
    this.servicesManager = new DefaultServicesManager(new InMemoryServiceRegistry());
    mobileBrowsers = new HashMap<>();
    mobileBrowsers.put(MOZILLA, "theme");
    this.serviceThemeResolver = new ServiceThemeResolver(DEFAULT_THEME_NAME, servicesManager, mobileBrowsers);
}
Also used : DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) Before(org.junit.Before)

Example 10 with InMemoryServiceRegistry

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

the class RegisteredServiceSimpleFormControllerTests method setUp.

@Before
public void setUp() throws Exception {
    final Map<String, List<Object>> attributes = new HashMap<>();
    attributes.put(TEST_ID, Arrays.asList(new Object[] { TEST_ID }));
    this.repository = new StubPersonAttributeDao();
    this.repository.setBackingMap(attributes);
    this.registeredServiceFactory = new DefaultRegisteredServiceFactory(new DefaultAccessStrategyMapper(), policyMapper, new DefaultProxyPolicyMapper(), new DefaultRegisteredServiceMapper(), new DefaultUsernameAttributeProviderMapper(), Collections.singletonList(new AttributeFormDataPopulator(this.repository)));
    this.manager = new DefaultServicesManager(new InMemoryServiceRegistry());
    this.controller = new RegisteredServiceSimpleFormController(this.manager, this.registeredServiceFactory);
}
Also used : HashMap(java.util.HashMap) DefaultAccessStrategyMapper(org.apereo.cas.mgmt.services.web.factory.DefaultAccessStrategyMapper) DefaultProxyPolicyMapper(org.apereo.cas.mgmt.services.web.factory.DefaultProxyPolicyMapper) DefaultRegisteredServiceMapper(org.apereo.cas.mgmt.services.web.factory.DefaultRegisteredServiceMapper) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) RegisteredServiceSimpleFormController(org.apereo.cas.mgmt.services.web.RegisteredServiceSimpleFormController) List(java.util.List) DefaultRegisteredServiceFactory(org.apereo.cas.mgmt.services.web.factory.DefaultRegisteredServiceFactory) DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) DefaultUsernameAttributeProviderMapper(org.apereo.cas.mgmt.services.web.factory.DefaultUsernameAttributeProviderMapper) StubPersonAttributeDao(org.apereo.services.persondir.support.StubPersonAttributeDao) AttributeFormDataPopulator(org.apereo.cas.mgmt.services.web.factory.AttributeFormDataPopulator) Before(org.junit.Before)

Aggregations

InMemoryServiceRegistry (org.apereo.cas.services.InMemoryServiceRegistry)22 lombok.val (lombok.val)16 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)16 DefaultServicesManager (org.apereo.cas.services.DefaultServicesManager)14 HashSet (java.util.HashSet)9 DefaultServicesManagerRegisteredServiceLocator (org.apereo.cas.services.DefaultServicesManagerRegisteredServiceLocator)8 Test (org.junit.jupiter.api.Test)8 PublisherIdentifier (org.apereo.cas.util.PublisherIdentifier)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 RegisteredService (org.apereo.cas.services.RegisteredService)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 DefaultAuthenticationServiceSelectionPlan (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan)4 WebApplicationServiceFactory (org.apereo.cas.authentication.principal.WebApplicationServiceFactory)4 Before (org.junit.Before)4 ArrayList (java.util.ArrayList)3 DefaultAuthenticationServiceSelectionStrategy (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionStrategy)3 DefaultArgumentExtractor (org.apereo.cas.web.support.DefaultArgumentExtractor)3 List (java.util.List)2 DefaultAuthenticationAttributeReleasePolicy (org.apereo.cas.authentication.DefaultAuthenticationAttributeReleasePolicy)2 DefaultAuthenticationEventExecutionPlan (org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan)2