use of org.apereo.cas.ticket.TransientSessionTicketImpl in project cas by apereo.
the class DelegatedClientJacksonModuleTests method verifyOperation.
@Test
@SuppressWarnings("JavaUtilDate")
public void verifyOperation() throws Exception {
val mapper = SERIALIZER.getObjectMapper();
assertTrue(mapper.getRegisteredModuleIds().contains(DelegatedClientJacksonModule.class.getName()));
val jwt = new PlainJWT(new JWTClaimsSet.Builder().audience("audience").subject("subject").expirationTime(new Date()).issueTime(new Date()).claim("first_name", "name").build());
val oidcProfile = new OidcProfile();
oidcProfile.setId("id");
oidcProfile.setIdTokenString(jwt.serialize());
val ticket = new TransientSessionTicketImpl(UUID.randomUUID().toString(), NeverExpiresExpirationPolicy.INSTANCE, RegisteredServiceTestUtils.getService(), Map.of("profiles", oidcProfile));
val content = mapper.writeValueAsString(ticket);
assertNotNull(mapper.readValue(content, TransientSessionTicket.class));
}
use of org.apereo.cas.ticket.TransientSessionTicketImpl in project cas by apereo.
the class DefaultTransientSessionTicketFactory method create.
/**
* Create delegated authentication request ticket.
*
* @param service the service
* @param properties the properties
* @return the delegated authentication request ticket
*/
@Override
public TransientSessionTicket create(final Service service, final Map<String, Serializable> properties) {
val id = ticketIdGenerator.getNewTicketId(TransientSessionTicket.PREFIX);
val expirationPolicy = TransientSessionTicketFactory.buildExpirationPolicy(this.expirationPolicyBuilder, properties);
return new TransientSessionTicketImpl(id, expirationPolicy, service, properties);
}
use of org.apereo.cas.ticket.TransientSessionTicketImpl in project cas by apereo.
the class BaseTicketRegistryTests method verifyTransientSessionTickets.
@RepeatedTest(2)
public void verifyTransientSessionTickets() throws Exception {
ticketRegistry.addTicket(new TransientSessionTicketImpl(transientSessionTicketId, NeverExpiresExpirationPolicy.INSTANCE, RegisteredServiceTestUtils.getService(), CollectionUtils.wrap("key", "value")));
assertSame(1, ticketRegistry.deleteTicket(transientSessionTicketId), () -> "Wrong ticket count. useEncryption[" + useEncryption + ']');
assertNull(ticketRegistry.getTicket(transientSessionTicketId), () -> TICKET_SHOULD_BE_NULL_USE_ENCRYPTION + useEncryption + ']');
}
Aggregations