Search in sources :

Example 1 with SessionStoreTicketGrantingTicketAction

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

the class SessionStoreTicketGrantingTicketActionTests method verifyOperation.

@Test
public void verifyOperation() throws Exception {
    val context = new MockRequestContext();
    val request = new MockHttpServletRequest();
    val response = new MockHttpServletResponse();
    context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
    RequestContextHolder.setRequestContext(context);
    ExternalContextHolder.setExternalContext(context.getExternalContext());
    WebUtils.putTicketGrantingTicketInScopes(context, new MockTicketGrantingTicket("casuser"));
    val action = new SessionStoreTicketGrantingTicketAction(JEESessionStore.INSTANCE);
    val result = action.execute(context);
    assertNull(result);
    val webContext = new JEEContext(request, response);
    assertTrue(JEESessionStore.INSTANCE.get(webContext, WebUtils.PARAMETER_TICKET_GRANTING_TICKET_ID).isPresent());
}
Also used : lombok.val(lombok.val) MockTicketGrantingTicket(org.apereo.cas.mock.MockTicketGrantingTicket) SessionStoreTicketGrantingTicketAction(org.apereo.cas.web.flow.login.SessionStoreTicketGrantingTicketAction) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) ServletExternalContext(org.springframework.webflow.context.servlet.ServletExternalContext) JEEContext(org.pac4j.core.context.JEEContext) MockRequestContext(org.springframework.webflow.test.MockRequestContext) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) MockServletContext(org.apereo.cas.util.MockServletContext) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)1 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)1 MockServletContext (org.apereo.cas.util.MockServletContext)1 SessionStoreTicketGrantingTicketAction (org.apereo.cas.web.flow.login.SessionStoreTicketGrantingTicketAction)1 Test (org.junit.jupiter.api.Test)1 JEEContext (org.pac4j.core.context.JEEContext)1 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)1 MockRequestContext (org.springframework.webflow.test.MockRequestContext)1