use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyDoubleGrantSameServiceTicketKeepMostRecentSession.
@Test
public void verifyDoubleGrantSameServiceTicketKeepMostRecentSession() {
final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, true);
t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, true);
assertEquals(1, t.getServices().size());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyEquals.
@Test
public void verifyEquals() {
final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
assertNotNull(t);
assertFalse(t.equals(new Object()));
assertTrue(t.equals(t));
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyIsRootFalse.
@Test
public void verifyIsRootFalse() {
final TicketGrantingTicketImpl t1 = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, CoreAuthenticationTestUtils.getService("gantor"), t1, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
assertFalse(t.isRoot());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class HazelcastTicketRegistryReplicationTests method verifyDeleteTicketWithPGT.
@Test
public void verifyDeleteTicketWithPGT() {
final Authentication a = CoreAuthenticationTestUtils.getAuthentication();
this.hzTicketRegistry1.addTicket(new TicketGrantingTicketImpl(TGT_ID, a, new NeverExpiresExpirationPolicy()));
final TicketGrantingTicket tgt = this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class);
final Service service = RegisteredServiceTestUtils.getService("TGT_DELETE_TEST");
final ServiceTicket st1 = tgt.grantServiceTicket(ST_ID_1, service, new NeverExpiresExpirationPolicy(), false, true);
this.hzTicketRegistry1.addTicket(st1);
assertNotNull(this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class));
assertNotNull(this.hzTicketRegistry1.getTicket(ST_ID_1, ServiceTicket.class));
final ProxyGrantingTicket pgt = st1.grantProxyGrantingTicket(PGT_ID_1, a, new NeverExpiresExpirationPolicy());
assertEquals(a, pgt.getAuthentication());
this.hzTicketRegistry1.addTicket(pgt);
this.hzTicketRegistry1.updateTicket(tgt);
assertSame(3, this.hzTicketRegistry1.deleteTicket(tgt.getId()));
assertNull(this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class));
assertNull(this.hzTicketRegistry1.getTicket(ST_ID_1, ServiceTicket.class));
assertNull(this.hzTicketRegistry1.getTicket(PGT_ID_1, ProxyGrantingTicket.class));
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class HazelcastTicketRegistryReplicationTests method verifyDeleteTicketWithChildren.
@Test
public void verifyDeleteTicketWithChildren() throws Exception {
this.hzTicketRegistry1.addTicket(new TicketGrantingTicketImpl(TGT_ID, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
final TicketGrantingTicket tgt = this.hzTicketRegistry1.getTicket(TGT_ID, TicketGrantingTicket.class);
final Service service = RegisteredServiceTestUtils.getService("TGT_DELETE_TEST");
final ServiceTicket st1 = tgt.grantServiceTicket(ST_ID_1, service, new NeverExpiresExpirationPolicy(), false, false);
final ServiceTicket st2 = tgt.grantServiceTicket("ST2", service, new NeverExpiresExpirationPolicy(), false, false);
final ServiceTicket st3 = tgt.grantServiceTicket("ST3", service, new NeverExpiresExpirationPolicy(), false, false);
this.hzTicketRegistry1.addTicket(st1);
this.hzTicketRegistry1.addTicket(st2);
this.hzTicketRegistry1.addTicket(st3);
this.hzTicketRegistry1.updateTicket(tgt);
assertNotNull(this.hzTicketRegistry1.getTicket(tgt.getId(), TicketGrantingTicket.class));
assertNotNull(this.hzTicketRegistry1.getTicket(ST_ID_1, ServiceTicket.class));
assertNotNull(this.hzTicketRegistry1.getTicket("ST2", ServiceTicket.class));
assertNotNull(this.hzTicketRegistry1.getTicket("ST3", ServiceTicket.class));
assertTrue("TGT and children were deleted", this.hzTicketRegistry1.deleteTicket(tgt.getId()) > 0);
assertNull(this.hzTicketRegistry1.getTicket(tgt.getId(), TicketGrantingTicket.class));
assertNull(this.hzTicketRegistry1.getTicket(ST_ID_1, ServiceTicket.class));
assertNull(this.hzTicketRegistry1.getTicket("ST2", ServiceTicket.class));
assertNull(this.hzTicketRegistry1.getTicket("ST3", ServiceTicket.class));
}
Aggregations