Search in sources :

Example 1 with CasLocaleChangeInterceptor

use of org.apereo.cas.web.support.CasLocaleChangeInterceptor in project cas by apereo.

the class DefaultLoginWebflowConfigurerTests method verifyOperation.

@Test
public void verifyOperation() {
    assertFalse(casWebflowExecutionPlan.getWebflowConfigurers().isEmpty());
    val interceptors = casWebflowExecutionPlan.getWebflowInterceptors();
    assertEquals(2, interceptors.size());
    assertTrue(interceptors.stream().anyMatch(interceptor -> interceptor instanceof CasLocaleChangeInterceptor));
    assertTrue(interceptors.stream().anyMatch(interceptor -> interceptor instanceof ResourceUrlProviderExposingInterceptor));
    val flow = (Flow) this.loginFlowDefinitionRegistry.getFlowDefinition(CasWebflowConfigurer.FLOW_ID_LOGIN);
    assertNotNull(flow);
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_CREATE_TICKET_GRANTING_TICKET));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_SEND_TICKET_GRANTING_TICKET));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_GENERATE_SERVICE_TICKET));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_HANDLE_AUTHN_FAILURE));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_POST_VIEW));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_REDIRECT));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_SERVICE_AUTHZ_CHECK));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_VIEW_GENERIC_LOGIN_SUCCESS));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_VIEW_REDIR_UNAUTHZ_URL));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_VIEW_SERVICE_ERROR));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_GATEWAY_REQUEST_CHECK));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_VIEW_GENERIC_LOGIN_SUCCESS));
}
Also used : lombok.val(lombok.val) CasLocaleChangeInterceptor(org.apereo.cas.web.support.CasLocaleChangeInterceptor) ResourceUrlProviderExposingInterceptor(org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor) MockRequestContext(org.springframework.webflow.test.MockRequestContext) ViewFactory(org.springframework.webflow.execution.ViewFactory) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) ServletExternalContext(org.springframework.webflow.context.servlet.ServletExternalContext) Map(java.util.Map) Tag(org.junit.jupiter.api.Tag) MockServletContext(org.springframework.mock.web.MockServletContext) MockRequestControlContext(org.springframework.webflow.test.MockRequestControlContext) ExternalContextHolder(org.springframework.webflow.context.ExternalContextHolder) lombok.val(lombok.val) Expression(org.springframework.binding.expression.Expression) TestPropertySource(org.springframework.test.context.TestPropertySource) Flow(org.springframework.webflow.engine.Flow) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Action(org.springframework.webflow.execution.Action) Transition(org.springframework.webflow.engine.Transition) Test(org.junit.jupiter.api.Test) Mockito(org.mockito.Mockito) EndState(org.springframework.webflow.engine.EndState) ViewState(org.springframework.webflow.engine.ViewState) Executable(org.junit.jupiter.api.function.Executable) RequestContextHolder(org.springframework.webflow.execution.RequestContextHolder) Assertions(org.junit.jupiter.api.Assertions) ResourceUrlProviderExposingInterceptor(org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor) CasLocaleChangeInterceptor(org.apereo.cas.web.support.CasLocaleChangeInterceptor) Flow(org.springframework.webflow.engine.Flow) Test(org.junit.jupiter.api.Test)

Example 2 with CasLocaleChangeInterceptor

use of org.apereo.cas.web.support.CasLocaleChangeInterceptor in project cas by apereo.

the class DefaultLogoutWebflowConfigurerTests method verifyOperation.

@Test
public void verifyOperation() {
    assertFalse(casWebflowExecutionPlan.getWebflowConfigurers().isEmpty());
    val interceptors = casWebflowExecutionPlan.getWebflowInterceptors();
    assertEquals(2, interceptors.size());
    assertTrue(interceptors.stream().anyMatch(interceptor -> interceptor instanceof CasLocaleChangeInterceptor));
    assertTrue(interceptors.stream().anyMatch(interceptor -> interceptor instanceof ResourceUrlProviderExposingInterceptor));
    val flow = (Flow) this.logoutFlowDefinitionRegistry.getFlowDefinition(CasWebflowConfigurer.FLOW_ID_LOGOUT);
    assertNotNull(flow);
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_TERMINATE_SESSION));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_FINISH_LOGOUT));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_LOGOUT_VIEW));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_FRONT_LOGOUT));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_DO_LOGOUT));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_CONFIRM_LOGOUT_VIEW));
    assertTrue(flow.containsState(CasWebflowConstants.STATE_ID_POST_VIEW));
}
Also used : lombok.val(lombok.val) Test(org.junit.jupiter.api.Test) CasLocaleChangeInterceptor(org.apereo.cas.web.support.CasLocaleChangeInterceptor) ResourceUrlProviderExposingInterceptor(org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor) lombok.val(lombok.val) Assertions(org.junit.jupiter.api.Assertions) Flow(org.springframework.webflow.engine.Flow) Tag(org.junit.jupiter.api.Tag) ResourceUrlProviderExposingInterceptor(org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor) CasLocaleChangeInterceptor(org.apereo.cas.web.support.CasLocaleChangeInterceptor) Flow(org.springframework.webflow.engine.Flow) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)2 CasLocaleChangeInterceptor (org.apereo.cas.web.support.CasLocaleChangeInterceptor)2 Assertions (org.junit.jupiter.api.Assertions)2 Tag (org.junit.jupiter.api.Tag)2 Test (org.junit.jupiter.api.Test)2 ResourceUrlProviderExposingInterceptor (org.springframework.web.servlet.resource.ResourceUrlProviderExposingInterceptor)2 Flow (org.springframework.webflow.engine.Flow)2 Map (java.util.Map)1 Executable (org.junit.jupiter.api.function.Executable)1 Mockito (org.mockito.Mockito)1 Expression (org.springframework.binding.expression.Expression)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 TestPropertySource (org.springframework.test.context.TestPropertySource)1 ExternalContextHolder (org.springframework.webflow.context.ExternalContextHolder)1 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)1 EndState (org.springframework.webflow.engine.EndState)1 Transition (org.springframework.webflow.engine.Transition)1 ViewState (org.springframework.webflow.engine.ViewState)1