Search in sources :

Example 6 with ServiceTicketFactory

use of org.apereo.cas.ticket.ServiceTicketFactory in project cas by apereo.

the class DefaultServiceTicketFactoryTests method verifyDefaultExpirationPolicy.

@Test
public void verifyDefaultExpirationPolicy() {
    val svc = RegisteredServiceTestUtils.getRegisteredService("defaultExpirationPolicy", RegexRegisteredService.class);
    servicesManager.save(svc);
    val factory = (ServiceTicketFactory) this.ticketFactory.get(ServiceTicket.class);
    val serviceTicket = factory.create(new MockTicketGrantingTicket("casuser"), RegisteredServiceTestUtils.getService("defaultExpirationPolicy"), true, ServiceTicket.class);
    assertNotNull(serviceTicket);
    assertEquals(10, serviceTicket.getExpirationPolicy().getTimeToLive());
}
Also used : lombok.val(lombok.val) MockTicketGrantingTicket(org.apereo.cas.mock.MockTicketGrantingTicket) ServiceTicketFactory(org.apereo.cas.ticket.ServiceTicketFactory) ServiceTicket(org.apereo.cas.ticket.ServiceTicket) Test(org.junit.jupiter.api.Test)

Aggregations

ServiceTicket (org.apereo.cas.ticket.ServiceTicket)6 ServiceTicketFactory (org.apereo.cas.ticket.ServiceTicketFactory)6 lombok.val (lombok.val)5 MockTicketGrantingTicket (org.apereo.cas.mock.MockTicketGrantingTicket)4 Test (org.junit.jupiter.api.Test)4 TicketGrantingTicket (org.apereo.cas.ticket.TicketGrantingTicket)2 Counted (com.codahale.metrics.annotation.Counted)1 Metered (com.codahale.metrics.annotation.Metered)1 Timed (com.codahale.metrics.annotation.Timed)1 AuditableContext (org.apereo.cas.audit.AuditableContext)1 AuditableExecutionResult (org.apereo.cas.audit.AuditableExecutionResult)1 Authentication (org.apereo.cas.authentication.Authentication)1 Principal (org.apereo.cas.authentication.principal.Principal)1 Service (org.apereo.cas.authentication.principal.Service)1 DefaultRegisteredServiceServiceTicketExpirationPolicy (org.apereo.cas.services.DefaultRegisteredServiceServiceTicketExpirationPolicy)1 RegisteredService (org.apereo.cas.services.RegisteredService)1 ServiceContext (org.apereo.cas.services.ServiceContext)1 CasServiceTicketGrantedEvent (org.apereo.cas.support.events.ticket.CasServiceTicketGrantedEvent)1 TicketGrantingTicketFactory (org.apereo.cas.ticket.TicketGrantingTicketFactory)1 Audit (org.apereo.inspektr.audit.annotation.Audit)1