Search in sources :

Example 46 with NeverExpiresExpirationPolicy

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

the class TicketGrantingTicketImplTests method verifyIsRootTrue.

@Test
public void verifyIsRootTrue() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    assertTrue(t.isRoot());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Example 47 with NeverExpiresExpirationPolicy

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

the class TicketGrantingTicketImplTests method verifyDoubleGrantDifferentServiceOnPathTicket.

@Test
public void verifyDoubleGrantDifferentServiceOnPathTicket() {
    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/webapp1"), new NeverExpiresExpirationPolicy(), false, true);
    t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService("http://host.com/webapp2"), new NeverExpiresExpirationPolicy(), false, true);
    assertEquals(2, t.getServices().size());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Example 48 with NeverExpiresExpirationPolicy

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

the class MemCacheTicketRegistryTests method verifyDeleteTicketWithPGT.

@Test
public void verifyDeleteTicketWithPGT() {
    final Authentication a = CoreAuthenticationTestUtils.getAuthentication();
    this.registry.addTicket(new TicketGrantingTicketImpl(TGT_ID, a, new NeverExpiresExpirationPolicy()));
    final TicketGrantingTicket tgt = this.registry.getTicket(TGT_ID, TicketGrantingTicket.class);
    final Service service = RegisteredServiceTestUtils.getService("TGT_DELETE_TEST");
    final ServiceTicket st1 = tgt.grantServiceTicket(ST_1_ID, service, new NeverExpiresExpirationPolicy(), false, true);
    this.registry.addTicket(st1);
    this.registry.updateTicket(tgt);
    assertNotNull(this.registry.getTicket(TGT_ID, TicketGrantingTicket.class));
    assertNotNull(this.registry.getTicket(ST_1_ID, ServiceTicket.class));
    final ProxyGrantingTicket pgt = st1.grantProxyGrantingTicket(PGT_1_ID, a, new NeverExpiresExpirationPolicy());
    this.registry.addTicket(pgt);
    this.registry.updateTicket(tgt);
    this.registry.updateTicket(st1);
    assertEquals(pgt.getGrantingTicket(), tgt);
    assertNotNull(this.registry.getTicket(PGT_1_ID, ProxyGrantingTicket.class));
    assertEquals(a, pgt.getAuthentication());
    assertNotNull(this.registry.getTicket(ST_1_ID, ServiceTicket.class));
    assertTrue(this.registry.deleteTicket(tgt.getId()) > 0);
    assertNull(this.registry.getTicket(TGT_ID, TicketGrantingTicket.class));
    assertNull(this.registry.getTicket(ST_1_ID, ServiceTicket.class));
    assertNull(this.registry.getTicket(PGT_1_ID, ProxyGrantingTicket.class));
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Authentication(org.apereo.cas.authentication.Authentication) TicketGrantingTicket(org.apereo.cas.ticket.TicketGrantingTicket) MockTicketGrantingTicket(org.apereo.cas.mock.MockTicketGrantingTicket) Service(org.apereo.cas.authentication.principal.Service) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) MockServiceTicket(org.apereo.cas.mock.MockServiceTicket) ServiceTicket(org.apereo.cas.ticket.ServiceTicket) ProxyGrantingTicket(org.apereo.cas.ticket.proxy.ProxyGrantingTicket) Test(org.junit.Test)

Example 49 with NeverExpiresExpirationPolicy

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

the class UniquePrincipalAuthenticationPolicyTests method verifyPolicyFailsUserFoundOnce.

@Test
public void verifyPolicyFailsUserFoundOnce() throws Exception {
    this.ticketRegistry.deleteAll();
    this.ticketRegistry.addTicket(new TicketGrantingTicketImpl("TGT-1", CoreAuthenticationTestUtils.getAuthentication("casuser"), new NeverExpiresExpirationPolicy()));
    final UniquePrincipalAuthenticationPolicy p = new UniquePrincipalAuthenticationPolicy(this.ticketRegistry);
    assertFalse(p.isSatisfiedBy(CoreAuthenticationTestUtils.getAuthentication("casuser")));
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 50 with NeverExpiresExpirationPolicy

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

the class ServiceTicketImplTests method verifyNoTicket.

@Test
public void verifyNoTicket() {
    this.thrown.expect(NullPointerException.class);
    new ServiceTicketImpl(ST_ID, null, CoreAuthenticationTestUtils.getService(), false, new NeverExpiresExpirationPolicy());
}
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