Search in sources :

Example 41 with NeverExpiresExpirationPolicy

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

the class TicketGrantingTicketImplTests method verifyGetChainedPrincipalsWithTwo.

@Test
public void verifyGetChainedPrincipalsWithTwo() {
    final Authentication authentication = CoreAuthenticationTestUtils.getAuthentication();
    final Authentication authentication1 = CoreAuthenticationTestUtils.getAuthentication("test1");
    final List<Authentication> principals = new ArrayList<>();
    principals.add(authentication);
    principals.add(authentication1);
    final TicketGrantingTicketImpl t1 = new TicketGrantingTicketImpl(TGT_ID, null, null, authentication1, new NeverExpiresExpirationPolicy());
    final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, CoreAuthenticationTestUtils.getService("gantor"), t1, authentication, new NeverExpiresExpirationPolicy());
    assertEquals(principals, t.getChainedAuthentications());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Authentication(org.apereo.cas.authentication.Authentication) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 42 with NeverExpiresExpirationPolicy

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

the class TicketGrantingTicketImplTests method verifyServiceTicketAsFromInitialCredentials.

@Test
public void verifyServiceTicketAsFromInitialCredentials() {
    final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    final ServiceTicket s = t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), RegisteredServiceTestUtils.getService(), new NeverExpiresExpirationPolicy(), false, true);
    assertTrue(s.isFromNewLogin());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Example 43 with NeverExpiresExpirationPolicy

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

the class TicketGrantingTicketImplTests method verifyDoubleGrantSimilarServiceWithPathTicketKeepMostRecentSession.

@Test
public void verifyDoubleGrantSimilarServiceWithPathTicketKeepMostRecentSession() {
    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/webapp1?test=true"), new NeverExpiresExpirationPolicy(), false, true);
    assertEquals(1, t.getServices().size());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Example 44 with NeverExpiresExpirationPolicy

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

the class ServiceTicketImplTests method verifyGetService.

@Test
public void verifyGetService() {
    final Service simpleService = CoreAuthenticationTestUtils.getService();
    final ServiceTicket s = new ServiceTicketImpl(ST_ID, tgt, simpleService, false, new NeverExpiresExpirationPolicy());
    assertEquals(simpleService, s.getService());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Service(org.apereo.cas.authentication.principal.Service) Test(org.junit.Test)

Example 45 with NeverExpiresExpirationPolicy

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

the class ServiceTicketImplTests method verifyIsFromNewLoginTrue.

@Test
public void verifyIsFromNewLoginTrue() {
    final ServiceTicket s = new ServiceTicketImpl(ST_ID, tgt, CoreAuthenticationTestUtils.getService(), true, new NeverExpiresExpirationPolicy());
    assertTrue(s.isFromNewLogin());
}
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