Search in sources :

Example 26 with NeverExpiresExpirationPolicy

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

the class ServiceTicketImplTests method verifyNoService.

@Test
public void verifyNoService() {
    this.thrown.expect(Exception.class);
    new ServiceTicketImpl(ST_ID, tgt, null, false, new NeverExpiresExpirationPolicy());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Test(org.junit.Test)

Example 27 with NeverExpiresExpirationPolicy

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

the class TicketGrantingTicketImplTests method verifyWebApplicationServices.

@Test
public void verifyWebApplicationServices() {
    final Service testService = RegisteredServiceTestUtils.getService(TGT_ID);
    final TicketGrantingTicket t = new TicketGrantingTicketImpl(TGT_ID, null, null, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy());
    t.grantServiceTicket(ID_GENERATOR.getNewTicketId(ServiceTicket.PREFIX), testService, new NeverExpiresExpirationPolicy(), false, true);
    Map<String, Service> services = t.getServices();
    assertEquals(1, services.size());
    final String ticketId = services.keySet().iterator().next();
    assertEquals(testService, services.get(ticketId));
    t.removeAllServices();
    services = t.getServices();
    assertEquals(0, services.size());
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) Service(org.apereo.cas.authentication.principal.Service) Test(org.junit.Test)

Example 28 with NeverExpiresExpirationPolicy

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

the class AbstractTicketRegistryTests method verifyGetExistingTicketWithProperClass.

@Test
public void verifyGetExistingTicketWithProperClass() {
    try {
        this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
        this.ticketRegistry.getTicket(TicketGrantingTicket.PREFIX, TicketGrantingTicket.class);
    } catch (final Exception e) {
        throw new AssertionError(EXCEPTION_CAUGHT_NONE_EXPECTED, e);
    }
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) Test(org.junit.Test)

Example 29 with NeverExpiresExpirationPolicy

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

the class AbstractTicketRegistryTests method verifyGetExistingTicketWithImproperClass.

@Test
public void verifyGetExistingTicketWithImproperClass() {
    try {
        this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
        assertNull(this.ticketRegistry.getTicket(TicketGrantingTicket.PREFIX, ServiceTicket.class));
    } catch (final ClassCastException e) {
        return;
    }
    throw new AssertionError("ClassCastException expected");
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) MockServiceTicket(org.apereo.cas.mock.MockServiceTicket) ServiceTicket(org.apereo.cas.ticket.ServiceTicket) Test(org.junit.Test)

Example 30 with NeverExpiresExpirationPolicy

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

the class AbstractTicketRegistryTests method verifyDeleteNullTicket.

@Test
public void verifyDeleteNullTicket() {
    try {
        this.ticketRegistry.addTicket(new TicketGrantingTicketImpl(TicketGrantingTicket.PREFIX, CoreAuthenticationTestUtils.getAuthentication(), new NeverExpiresExpirationPolicy()));
        assertFalse("Ticket was deleted.", this.ticketRegistry.deleteTicket(null) == 1);
    } catch (final Exception e) {
        throw new AssertionError(EXCEPTION_CAUGHT_NONE_EXPECTED + e.getMessage(), e);
    }
}
Also used : NeverExpiresExpirationPolicy(org.apereo.cas.ticket.support.NeverExpiresExpirationPolicy) TicketGrantingTicketImpl(org.apereo.cas.ticket.TicketGrantingTicketImpl) 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