Search in sources :

Example 1 with TicketGrantingTicketCheckAction

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

the class TicketGrantingTicketCheckActionTests method verifyValidTicket.

@Test
public void verifyValidTicket() throws Exception {
    final MockRequestContext ctx = new MockRequestContext();
    final AuthenticationResult ctxAuthN = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport());
    final TicketGrantingTicket tgt = this.getCentralAuthenticationService().createTicketGrantingTicket(ctxAuthN);
    WebUtils.putTicketGrantingTicketInScopes(ctx, tgt);
    final TicketGrantingTicketCheckAction action = new TicketGrantingTicketCheckAction(this.getCentralAuthenticationService());
    final Event event = action.doExecute(ctx);
    assertEquals(TicketGrantingTicketCheckAction.VALID, event.getId());
}
Also used : MockTicketGrantingTicket(org.apereo.cas.mock.MockTicketGrantingTicket) TicketGrantingTicket(org.apereo.cas.ticket.TicketGrantingTicket) Event(org.springframework.webflow.execution.Event) MockRequestContext(org.springframework.webflow.test.MockRequestContext) AuthenticationResult(org.apereo.cas.authentication.AuthenticationResult) TicketGrantingTicketCheckAction(org.apereo.cas.web.flow.login.TicketGrantingTicketCheckAction) Test(org.junit.Test)

Example 2 with TicketGrantingTicketCheckAction

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

the class TicketGrantingTicketCheckActionTests method verifyNullTicket.

@Test
public void verifyNullTicket() throws Exception {
    final MockRequestContext ctx = new MockRequestContext();
    final TicketGrantingTicketCheckAction action = new TicketGrantingTicketCheckAction(this.getCentralAuthenticationService());
    final Event event = action.doExecute(ctx);
    assertEquals(TicketGrantingTicketCheckAction.NOT_EXISTS, event.getId());
}
Also used : Event(org.springframework.webflow.execution.Event) MockRequestContext(org.springframework.webflow.test.MockRequestContext) TicketGrantingTicketCheckAction(org.apereo.cas.web.flow.login.TicketGrantingTicketCheckAction) Test(org.junit.Test)

Example 3 with TicketGrantingTicketCheckAction

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

the class TicketGrantingTicketCheckActionTests method verifyInvalidTicket.

@Test
public void verifyInvalidTicket() throws Exception {
    final MockRequestContext ctx = new MockRequestContext();
    final MockTicketGrantingTicket tgt = new MockTicketGrantingTicket("user");
    WebUtils.putTicketGrantingTicketInScopes(ctx, tgt);
    final TicketGrantingTicketCheckAction action = new TicketGrantingTicketCheckAction(this.getCentralAuthenticationService());
    final Event event = action.doExecute(ctx);
    assertEquals(TicketGrantingTicketCheckAction.INVALID, event.getId());
}
Also used : MockTicketGrantingTicket(org.apereo.cas.mock.MockTicketGrantingTicket) Event(org.springframework.webflow.execution.Event) MockRequestContext(org.springframework.webflow.test.MockRequestContext) TicketGrantingTicketCheckAction(org.apereo.cas.web.flow.login.TicketGrantingTicketCheckAction) Test(org.junit.Test)

Aggregations

TicketGrantingTicketCheckAction (org.apereo.cas.web.flow.login.TicketGrantingTicketCheckAction)3 Test (org.junit.Test)3 Event (org.springframework.webflow.execution.Event)3 MockRequestContext (org.springframework.webflow.test.MockRequestContext)3 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)2 AuthenticationResult (org.apereo.cas.authentication.AuthenticationResult)1 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)1