use of org.apereo.cas.ticket.DefaultSecurityTokenTicketFactory in project cas by apereo.
the class JpaTicketRegistryTests method verifySecurityTokenTicket.
@RepeatedTest(2)
public void verifySecurityTokenTicket() throws Exception {
val securityTokenTicketFactory = new DefaultSecurityTokenTicketFactory(new DefaultUniqueTicketIdGenerator(), neverExpiresExpirationPolicyBuilder());
val originalAuthn = CoreAuthenticationTestUtils.getAuthentication();
val tgt = new TicketGrantingTicketImpl(ticketGrantingTicketId, originalAuthn, NeverExpiresExpirationPolicy.INSTANCE);
this.newTicketRegistry.addTicket(tgt);
val token = securityTokenTicketFactory.create(tgt, "dummy-token".getBytes(StandardCharsets.UTF_8));
this.newTicketRegistry.addTicket(token);
assertNotNull(this.newTicketRegistry.getTicket(token.getId()));
this.newTicketRegistry.deleteTicket(token);
assertNull(this.newTicketRegistry.getTicket(token.getId()));
}
Aggregations