use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class HazelcastTicketRegistryReplicationTests method basicOperationsAndClustering.
@Test
public void basicOperationsAndClustering() throws Exception {
final TicketGrantingTicket tgt = newTestTgt();
this.hzTicketRegistry1.addTicket(tgt);
assertNotNull(this.hzTicketRegistry1.getTicket(tgt.getId()));
assertNotNull(this.hzTicketRegistry2.getTicket(tgt.getId()));
assertEquals(1, this.hzTicketRegistry2.deleteTicket(tgt.getId()));
assertEquals(0, this.hzTicketRegistry1.deleteTicket(tgt.getId()));
assertNull(this.hzTicketRegistry1.getTicket(tgt.getId()));
assertNull(this.hzTicketRegistry2.getTicket(tgt.getId()));
final ServiceTicket st = newTestSt(tgt);
this.hzTicketRegistry2.addTicket(st);
assertNotNull(this.hzTicketRegistry1.getTicket("ST-TEST"));
assertNotNull(this.hzTicketRegistry2.getTicket("ST-TEST"));
assertEquals(1, this.hzTicketRegistry1.deleteTicket("ST-TEST"));
assertNull(this.hzTicketRegistry1.getTicket("ST-TEST"));
assertNull(this.hzTicketRegistry2.getTicket("ST-TEST"));
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class JpaTicketRegistryTests method verifyTicketDeletionInBulk.
@Test
public void verifyTicketDeletionInBulk() {
final TicketGrantingTicket newTgt = newTGT();
addTicketInTransaction(newTgt);
final TicketGrantingTicket tgtFromDb = (TicketGrantingTicket) getTicketInTransaction(newTgt.getId());
final ServiceTicket newSt = grantServiceTicketInTransaction(tgtFromDb);
final ServiceTicket stFromDb = (ServiceTicket) getTicketInTransaction(newSt.getId());
final ProxyGrantingTicket newPgt = grantProxyGrantingTicketInTransaction(stFromDb);
final ProxyGrantingTicket pgtFromDb = (ProxyGrantingTicket) getTicketInTransaction(newPgt.getId());
final ProxyTicket newPt = grantProxyTicketInTransaction(pgtFromDb);
getTicketInTransaction(newPt.getId());
deleteTicketsInTransaction();
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplWithMockitoTests method createRootTicketGrantingTicket.
private TicketGrantingTicket createRootTicketGrantingTicket() {
final TicketGrantingTicket tgtRootMock = mock(TicketGrantingTicket.class);
when(tgtRootMock.isExpired()).thenReturn(false);
when(tgtRootMock.getAuthentication()).thenReturn(this.authentication);
return tgtRootMock;
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class CentralAuthenticationServiceImplTests method checkGrantingOfServiceTicketUsingDefaultTicketIdGen.
@Test
public void checkGrantingOfServiceTicketUsingDefaultTicketIdGen() throws Exception {
final Service mockService = mock(Service.class);
when(mockService.getId()).thenReturn("testDefault");
final AuthenticationResult ctx = CoreAuthenticationTestUtils.getAuthenticationResult(getAuthenticationSystemSupport(), mockService);
final TicketGrantingTicket ticketId = getCentralAuthenticationService().createTicketGrantingTicket(ctx);
final ServiceTicket serviceTicketId = getCentralAuthenticationService().grantServiceTicket(ticketId.getId(), mockService, ctx);
assertNotNull(serviceTicketId);
}
use of org.apereo.cas.ticket.TicketGrantingTicket in project cas by apereo.
the class SendTicketGrantingTicketActionTests method verifySsoSessionCookieOnRenewAsParameter.
@Test
public void verifySsoSessionCookieOnRenewAsParameter() throws Exception {
final MockHttpServletResponse response = new MockHttpServletResponse();
final MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter(CasProtocolConstants.PARAMETER_RENEW, "true");
final TicketGrantingTicket tgt = mock(TicketGrantingTicket.class);
when(tgt.getId()).thenReturn(TEST_STRING);
request.setCookies(new Cookie("TGT", "test5"));
WebUtils.putTicketGrantingTicketInScopes(this.context, tgt);
this.context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
final SendTicketGrantingTicketAction action = new SendTicketGrantingTicketAction(centralAuthenticationService, servicesManager, ticketGrantingTicketCookieGenerator, false);
assertEquals(SUCCESS, action.execute(this.context).getId());
assertEquals(0, response.getCookies().length);
}
Aggregations