use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyServiceTicketAsFromNotInitialCredentials.
@Test
public void verifyServiceTicketAsFromNotInitialCredentials() {
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);
final ServiceTicket s = t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, true);
assertFalse(s.isFromNewLogin());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyDoubleGrantSimilarServiceTicketKeepMostRecentSession.
@Test
public void verifyDoubleGrantSimilarServiceTicketKeepMostRecentSession() {
final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService("http://host.com?test"), new NeverExpiresExpirationPolicy(), false, true);
t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService("http://host.com;JSESSIONID=xxx"), 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 verifyProperRootIsReturned.
@Test
public void verifyProperRootIsReturned() {
final TicketGrantingTicketImpl t1 = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
final TicketGrantingTicket t2 = new TicketGrantingTicketImpl(TGT_ID, CoreAuthenticationTestUtils.getService("gantor"), t1, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
final TicketGrantingTicket t3 = new TicketGrantingTicketImpl(TGT_ID, CoreAuthenticationTestUtils.getService("gantor"), t2, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
assertSame(t1, t3.getRoot());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifySerializeToJson.
@Test
public void verifySerializeToJson() throws IOException {
final Authentication authenticationWritten = CoreAuthenticationTestUtils.getAuthentication();
final NeverExpiresExpirationPolicy expirationPolicyWritten = new NeverExpiresExpirationPolicy();
final TicketGrantingTicket tgtWritten = new TicketGrantingTicketImpl(TGT_ID, null, null, authenticationWritten, expirationPolicyWritten);
mapper.writeValue(TGT_JSON_FILE, tgtWritten);
final TicketGrantingTicketImpl tgtRead = mapper.readValue(TGT_JSON_FILE, TicketGrantingTicketImpl.class);
assertEquals(tgtWritten, tgtRead);
assertEquals(authenticationWritten, tgtRead.getAuthentication());
}
use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.
the class TicketGrantingTicketImplTests method verifyGetChainedPrincipalsWithOne.
@Test
public void verifyGetChainedPrincipalsWithOne() {
final Authentication authentication = CoreAuthenticationTestUtils.getAuthentication();
final List<Authentication> principals = new ArrayList<>();
principals.add(authentication);
final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, authentication, new NeverExpiresExpirationPolicy());
assertEquals(principals, t.getChainedAuthentications());
}
Aggregations