Search in sources :

Example 1 with MultiTimeUseOrTimeoutExpirationPolicy

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());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) MultiTimeUseOrTimeoutExpirationPolicy(org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy) Test(org.junit.Test)

Example 2 with MultiTimeUseOrTimeoutExpirationPolicy

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());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Authentication(org.apereo.cas.authentication.Authentication) MultiTimeUseOrTimeoutExpirationPolicy(org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy) Test(org.junit.Test)

Example 3 with MultiTimeUseOrTimeoutExpirationPolicy

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());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Authentication(org.apereo.cas.authentication.Authentication) MultiTimeUseOrTimeoutExpirationPolicy(org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy) Test(org.junit.Test)

Aggregations

MultiTimeUseOrTimeoutExpirationPolicy (org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy)3 NeverExpiresExpirationPolicy (org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy)3 Test (org.junit.Test)3 Authentication (org.apereo.cas.authentication.Authentication)2