Search in sources :

Example 1 with InitialFlowSetupAction

use of org.apereo.cas.web.flow.login.InitialFlowSetupAction in project cas by apereo.

the class InitialFlowSetupCookieActionTests method initialize.

@BeforeEach
public void initialize() throws Exception {
    val warn = CookieGenerationContext.builder().name("warn").path(StringUtils.EMPTY).maxAge(2).domain(null).secure(false).httpOnly(false).comment("CAS Cookie").build();
    val tgt = CookieGenerationContext.builder().name("tgt").path(StringUtils.EMPTY).maxAge(2).domain(null).secure(false).httpOnly(false).comment("CAS Cookie").build();
    this.warnCookieGenerator = new CookieRetrievingCookieGenerator(warn);
    this.warnCookieGenerator.setCookiePath(StringUtils.EMPTY);
    this.tgtCookieGenerator = new CookieRetrievingCookieGenerator(tgt);
    this.tgtCookieGenerator.setCookiePath(StringUtils.EMPTY);
    val argExtractors = Collections.<ArgumentExtractor>singletonList(new DefaultArgumentExtractor(new WebApplicationServiceFactory()));
    val servicesManager = mock(ServicesManager.class);
    when(servicesManager.findServiceBy(any(Service.class))).thenReturn(RegisteredServiceTestUtils.getRegisteredService("test"));
    val sso = new SingleSignOnProperties().setCreateSsoCookieOnRenewAuthn(true).setRenewAuthnEnabled(true);
    this.action = new InitialFlowSetupAction(argExtractors, servicesManager, authenticationRequestServiceSelectionStrategies, tgtCookieGenerator, warnCookieGenerator, casProperties, authenticationEventExecutionPlan, new DefaultSingleSignOnParticipationStrategy(servicesManager, sso, mock(TicketRegistrySupport.class), mock(AuthenticationServiceSelectionPlan.class)), mock(TicketRegistrySupport.class));
    this.action.afterPropertiesSet();
}
Also used : lombok.val(lombok.val) ArgumentExtractor(org.apereo.cas.web.support.ArgumentExtractor) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) CookieRetrievingCookieGenerator(org.apereo.cas.web.support.gen.CookieRetrievingCookieGenerator) WebApplicationServiceFactory(org.apereo.cas.authentication.principal.WebApplicationServiceFactory) Service(org.apereo.cas.authentication.principal.Service) TicketRegistrySupport(org.apereo.cas.ticket.registry.TicketRegistrySupport) AuthenticationServiceSelectionPlan(org.apereo.cas.authentication.AuthenticationServiceSelectionPlan) InitialFlowSetupAction(org.apereo.cas.web.flow.login.InitialFlowSetupAction) SingleSignOnProperties(org.apereo.cas.configuration.model.core.sso.SingleSignOnProperties) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with InitialFlowSetupAction

use of org.apereo.cas.web.flow.login.InitialFlowSetupAction in project cas by apereo.

the class InitialFlowSetupActionCookieTests method setUp.

@Before
public void setUp() throws Exception {
    this.warnCookieGenerator = new CookieRetrievingCookieGenerator("warn", "", 2, false, null, false);
    this.warnCookieGenerator.setCookiePath(StringUtils.EMPTY);
    this.tgtCookieGenerator = new CookieRetrievingCookieGenerator("tgt", "", 2, false, null, false);
    this.tgtCookieGenerator.setCookiePath(StringUtils.EMPTY);
    final List<ArgumentExtractor> argExtractors = Collections.singletonList(new DefaultArgumentExtractor(new WebApplicationServiceFactory()));
    final ServicesManager servicesManager = mock(ServicesManager.class);
    when(servicesManager.findServiceBy(any(Service.class))).thenReturn(RegisteredServiceTestUtils.getRegisteredService("test"));
    this.action = new InitialFlowSetupAction(argExtractors, servicesManager, authenticationRequestServiceSelectionStrategies, tgtCookieGenerator, warnCookieGenerator, casProperties);
    this.action.afterPropertiesSet();
}
Also used : ArgumentExtractor(org.apereo.cas.web.support.ArgumentExtractor) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) ServicesManager(org.apereo.cas.services.ServicesManager) CookieRetrievingCookieGenerator(org.apereo.cas.web.support.CookieRetrievingCookieGenerator) WebApplicationServiceFactory(org.apereo.cas.authentication.principal.WebApplicationServiceFactory) Service(org.apereo.cas.authentication.principal.Service) InitialFlowSetupAction(org.apereo.cas.web.flow.login.InitialFlowSetupAction) Before(org.junit.Before)

Aggregations

Service (org.apereo.cas.authentication.principal.Service)2 WebApplicationServiceFactory (org.apereo.cas.authentication.principal.WebApplicationServiceFactory)2 InitialFlowSetupAction (org.apereo.cas.web.flow.login.InitialFlowSetupAction)2 ArgumentExtractor (org.apereo.cas.web.support.ArgumentExtractor)2 DefaultArgumentExtractor (org.apereo.cas.web.support.DefaultArgumentExtractor)2 lombok.val (lombok.val)1 AuthenticationServiceSelectionPlan (org.apereo.cas.authentication.AuthenticationServiceSelectionPlan)1 SingleSignOnProperties (org.apereo.cas.configuration.model.core.sso.SingleSignOnProperties)1 ServicesManager (org.apereo.cas.services.ServicesManager)1 TicketRegistrySupport (org.apereo.cas.ticket.registry.TicketRegistrySupport)1 CookieRetrievingCookieGenerator (org.apereo.cas.web.support.CookieRetrievingCookieGenerator)1 CookieRetrievingCookieGenerator (org.apereo.cas.web.support.gen.CookieRetrievingCookieGenerator)1 Before (org.junit.Before)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1