Search in sources :

Example 11 with NeverExpiresExpirationPolicy

use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.

the class ServiceTicketImplTests method verifyIsFromNewLoginFalse.

@Test
public void verifyIsFromNewLoginFalse() {
    ServiceTicket s = tgt.grantServiceTicket(ST_ID, CoreAuthenticationTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, false);
    assertTrue(s.isFromNewLogin());
    s = tgt.grantServiceTicket(ST_ID, CoreAuthenticationTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, false);
    assertFalse(s.isFromNewLogin());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Example 12 with NeverExpiresExpirationPolicy

use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy 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 13 with NeverExpiresExpirationPolicy

use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy 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 14 with NeverExpiresExpirationPolicy

use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy 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)

Example 15 with NeverExpiresExpirationPolicy

use of org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy in project cas by apereo.

the class ServiceTicketImplTests method verifyIsExpiredTrueBecauseOfRoot.

@Test
public void verifyIsExpiredTrueBecauseOfRoot() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl(ID, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    final ServiceTicket s = t.grantServiceTicket(idGenerator.getNewTicketId(ServiceTicket.PREFIX), CoreAuthenticationTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, true);
    t.markTicketExpired();
    assertTrue(s.isExpired());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Aggregations

NeverExpiresExpirationPolicy (org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy)64 Test (org.junit.Test)61 TicketGrantingTicketImpl (org.apereo.cas.ticket.TicketGrantingTicketImpl)27 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)20 ServiceTicket (org.apereo.cas.ticket.ServiceTicket)15 Authentication (org.apereo.cas.authentication.Authentication)14 Service (org.apereo.cas.authentication.principal.Service)13 MockServiceTicket (org.apereo.cas.mock.MockServiceTicket)12 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)12 ProxyGrantingTicket (org.apereo.cas.ticket.proxy.ProxyGrantingTicket)9 MultiTimeUseOrTimeoutExpirationPolicy (org.apereo.cas.ticket.support.MultiTimeUseOrTimeoutExpirationPolicy)5 ArrayList (java.util.ArrayList)4 StringBean (org.apereo.cas.StringBean)4 HashMap (java.util.HashMap)3 AlwaysExpiresExpirationPolicy (org.apereo.cas.ticket.support.AlwaysExpiresExpirationPolicy)3 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)3 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)3 LinkedHashMap (java.util.LinkedHashMap)2 CachedData (net.spy.memcached.CachedData)2 AcceptUsersAuthenticationHandler (org.apereo.cas.authentication.AcceptUsersAuthenticationHandler)2