use of org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy in project cas by apereo.
the class ServiceTicketImplTests method verifyIsExpiredFalse.
@Test
public void verifyIsExpiredFalse() {
final TicketGrantingTicket t = new TicketGrantingTicketImpl(ID, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
final ServiceTicket s = t.grantServiceTicket(idGenerator.getNewTicketId(ServiceTicket.PREFIX), CoreAuthenticationTestUtils.getService(), new MultiTimeUseOrTimeoutExpirationPolicy(1, 5000), false, true);
assertFalse(s.isExpired());
}
use of org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy in project cas by apereo.
the class ServiceTicketImplTests method verifyTicketGrantingTicket.
@Test
public void verifyTicketGrantingTicket() throws AbstractTicketException {
final Authentication a = CoreAuthenticationTestUtils.getAuthentication();
final TicketGrantingTicket t = new TicketGrantingTicketImpl(ID, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
final ServiceTicket s = t.grantServiceTicket(idGenerator.getNewTicketId(ServiceTicket.PREFIX), CoreAuthenticationTestUtils.getService(), new MultiTimeUseOrTimeoutExpirationPolicy(1, 5000), false, true);
final TicketGrantingTicket t1 = s.grantProxyGrantingTicket(idGenerator.getNewTicketId(TicketGrantingTicket.PREFIX), a, new NeverExpiresExpirationPolicy());
assertEquals(a, t1.getAuthentication());
}
use of org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy in project cas by apereo.
the class ServiceTicketImplTests method verifyTicketGrantingTicketGrantedTwice.
@Test
public void verifyTicketGrantingTicketGrantedTwice() throws AbstractTicketException {
final Authentication a = CoreAuthenticationTestUtils.getAuthentication();
final TicketGrantingTicket t = new TicketGrantingTicketImpl(ID, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
final ServiceTicket s = t.grantServiceTicket(idGenerator.getNewTicketId(ServiceTicket.PREFIX), CoreAuthenticationTestUtils.getService(), new MultiTimeUseOrTimeoutExpirationPolicy(1, 5000), false, true);
s.grantProxyGrantingTicket(idGenerator.getNewTicketId(TicketGrantingTicket.PREFIX), a, new NeverExpiresExpirationPolicy());
this.thrown.expect(Exception.class);
s.grantProxyGrantingTicket(idGenerator.getNewTicketId(TicketGrantingTicket.PREFIX), a, new NeverExpiresExpirationPolicy());
}
Aggregations