Search in sources :

Example 1 with LogoutProperties

use of org.apereo.cas.configuration.model.core.logout.LogoutProperties in project cas by apereo.

the class LogoutActionTests method verifyLogoutRequestBack.

@Test
public void verifyLogoutRequestBack() throws Exception {
    final Cookie cookie = new Cookie(COOKIE_TGC_ID, "test");
    this.request.setCookies(cookie);
    final LogoutRequest logoutRequest = new DefaultLogoutRequest(StringUtils.EMPTY, null, null);
    logoutRequest.setStatus(LogoutRequestStatus.SUCCESS);
    WebUtils.putLogoutRequests(this.requestContext, Arrays.asList(logoutRequest));
    final LogoutProperties properties = new LogoutProperties();
    this.logoutAction = new LogoutAction(getWebApplicationServiceFactory(), this.serviceManager, properties);
    final Event event = this.logoutAction.doExecute(this.requestContext);
    assertEquals(CasWebflowConstants.TRANSITION_ID_FINISH, event.getId());
}
Also used : Cookie(javax.servlet.http.Cookie) LogoutProperties(org.apereo.cas.configuration.model.core.logout.LogoutProperties) LogoutAction(org.apereo.cas.web.flow.logout.LogoutAction) DefaultLogoutRequest(org.apereo.cas.logout.DefaultLogoutRequest) Event(org.springframework.webflow.execution.Event) LogoutRequest(org.apereo.cas.logout.LogoutRequest) DefaultLogoutRequest(org.apereo.cas.logout.DefaultLogoutRequest) Test(org.junit.Test)

Example 2 with LogoutProperties

use of org.apereo.cas.configuration.model.core.logout.LogoutProperties in project cas by apereo.

the class LogoutActionTests method verifyLogoutNoCookie.

@Test
public void verifyLogoutNoCookie() throws Exception {
    final LogoutProperties properties = new LogoutProperties();
    this.logoutAction = new LogoutAction(getWebApplicationServiceFactory(), this.serviceManager, properties);
    final Event event = this.logoutAction.doExecute(this.requestContext);
    assertEquals(CasWebflowConstants.TRANSITION_ID_FINISH, event.getId());
}
Also used : LogoutProperties(org.apereo.cas.configuration.model.core.logout.LogoutProperties) LogoutAction(org.apereo.cas.web.flow.logout.LogoutAction) Event(org.springframework.webflow.execution.Event) Test(org.junit.Test)

Example 3 with LogoutProperties

use of org.apereo.cas.configuration.model.core.logout.LogoutProperties in project cas by apereo.

the class LogoutActionTests method verifyLogoutForServiceWithFollowRedirectsAndMatchingService.

@Test
public void verifyLogoutForServiceWithFollowRedirectsAndMatchingService() throws Exception {
    this.request.addParameter("service", TEST_SERVICE_ID);
    final RegexRegisteredService impl = new RegexRegisteredService();
    impl.setServiceId(TEST_SERVICE_ID);
    impl.setName(TEST_SERVICE_ID);
    this.serviceManager.save(impl);
    final LogoutProperties properties = new LogoutProperties();
    properties.setFollowServiceRedirects(true);
    this.logoutAction = new LogoutAction(getWebApplicationServiceFactory(), this.serviceManager, properties);
    final Event event = this.logoutAction.doExecute(this.requestContext);
    assertEquals(CasWebflowConstants.TRANSITION_ID_FINISH, event.getId());
    assertEquals(TEST_SERVICE_ID, this.requestContext.getFlowScope().get("logoutRedirectUrl"));
}
Also used : LogoutProperties(org.apereo.cas.configuration.model.core.logout.LogoutProperties) LogoutAction(org.apereo.cas.web.flow.logout.LogoutAction) Event(org.springframework.webflow.execution.Event) RegexRegisteredService(org.apereo.cas.services.RegexRegisteredService) Test(org.junit.Test)

Example 4 with LogoutProperties

use of org.apereo.cas.configuration.model.core.logout.LogoutProperties in project cas by apereo.

the class LogoutActionTests method verifyLogoutRequestFront.

@SuppressWarnings("unchecked")
@Test
public void verifyLogoutRequestFront() throws Exception {
    final Cookie cookie = new Cookie(COOKIE_TGC_ID, "test");
    this.request.setCookies(cookie);
    final LogoutRequest logoutRequest = new DefaultLogoutRequest(StringUtils.EMPTY, null, null);
    WebUtils.putLogoutRequests(this.requestContext, Arrays.asList(logoutRequest));
    final LogoutProperties properties = new LogoutProperties();
    this.logoutAction = new LogoutAction(getWebApplicationServiceFactory(), this.serviceManager, properties);
    final Event event = this.logoutAction.doExecute(this.requestContext);
    assertEquals(CasWebflowConstants.TRANSITION_ID_FRONT, event.getId());
    final List<LogoutRequest> logoutRequests = WebUtils.getLogoutRequests(this.requestContext);
    assertEquals(1, logoutRequests.size());
    assertEquals(logoutRequest, logoutRequests.get(0));
}
Also used : Cookie(javax.servlet.http.Cookie) LogoutProperties(org.apereo.cas.configuration.model.core.logout.LogoutProperties) LogoutAction(org.apereo.cas.web.flow.logout.LogoutAction) DefaultLogoutRequest(org.apereo.cas.logout.DefaultLogoutRequest) Event(org.springframework.webflow.execution.Event) LogoutRequest(org.apereo.cas.logout.LogoutRequest) DefaultLogoutRequest(org.apereo.cas.logout.DefaultLogoutRequest) Test(org.junit.Test)

Example 5 with LogoutProperties

use of org.apereo.cas.configuration.model.core.logout.LogoutProperties in project cas by apereo.

the class LogoutActionTests method logoutForServiceWithNoFollowRedirects.

@Test
public void logoutForServiceWithNoFollowRedirects() throws Exception {
    this.request.addParameter(CasProtocolConstants.PARAMETER_SERVICE, TEST_SERVICE_ID);
    final LogoutProperties properties = new LogoutProperties();
    this.logoutAction = new LogoutAction(getWebApplicationServiceFactory(), this.serviceManager, properties);
    final Event event = this.logoutAction.doExecute(this.requestContext);
    assertEquals(CasWebflowConstants.TRANSITION_ID_FINISH, event.getId());
    assertNull(this.requestContext.getFlowScope().get("logoutRedirectUrl"));
}
Also used : LogoutProperties(org.apereo.cas.configuration.model.core.logout.LogoutProperties) LogoutAction(org.apereo.cas.web.flow.logout.LogoutAction) Event(org.springframework.webflow.execution.Event) Test(org.junit.Test)

Aggregations

LogoutProperties (org.apereo.cas.configuration.model.core.logout.LogoutProperties)8 LogoutAction (org.apereo.cas.web.flow.logout.LogoutAction)7 Test (org.junit.Test)7 Event (org.springframework.webflow.execution.Event)7 Cookie (javax.servlet.http.Cookie)3 DefaultLogoutRequest (org.apereo.cas.logout.DefaultLogoutRequest)2 LogoutRequest (org.apereo.cas.logout.LogoutRequest)2 RegexRegisteredService (org.apereo.cas.services.RegexRegisteredService)2 lombok.val (lombok.val)1 Test (org.junit.jupiter.api.Test)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1