use of org.apereo.cas.logout.LogoutManager in project cas by apereo.
the class CasCoreTicketsConfiguration method ticketRegistry.
@ConditionalOnMissingBean(name = "ticketRegistry")
@Bean
public TicketRegistry ticketRegistry() {
LOGGER.warn("Runtime memory is used as the persistence storage for retrieving and managing tickets. " + "Tickets that are issued during runtime will be LOST when the web server is restarted. This MAY impact SSO functionality.");
final TicketRegistryProperties.InMemory mem = casProperties.getTicket().getRegistry().getInMemory();
final CipherExecutor cipher = CoreTicketUtils.newTicketRegistryCipherExecutor(mem.getCrypto(), "inMemory");
if (mem.isCache()) {
final LogoutManager logoutManager = applicationContext.getBean("logoutManager", LogoutManager.class);
return new CachingTicketRegistry(cipher, logoutManager);
}
return new DefaultTicketRegistry(mem.getInitialCapacity(), mem.getLoadFactor(), mem.getConcurrency(), cipher);
}
use of org.apereo.cas.logout.LogoutManager in project cas by apereo.
the class CentralAuthenticationServiceImplTests method verifyDestroyRemoteRegistry.
/**
* This test checks that the TGT destruction happens properly for a remote registry.
* It previously failed when the deletion happens before the ticket was marked expired because an update was necessary for that.
*/
@Test
public void verifyDestroyRemoteRegistry() throws AbstractTicketException, AuthenticationException {
final MockOnlyOneTicketRegistry registry = new MockOnlyOneTicketRegistry();
final TicketGrantingTicketImpl tgt = new TicketGrantingTicketImpl("TGT-1", mock(Authentication.class), mock(ExpirationPolicy.class));
final LogoutManager logoutManager = mock(LogoutManager.class);
when(logoutManager.performLogout(any(TicketGrantingTicket.class))).thenAnswer(invocation -> {
tgt.markTicketExpired();
registry.updateTicket(tgt);
return null;
});
registry.addTicket(tgt);
final DefaultCentralAuthenticationService cas = new DefaultCentralAuthenticationService(mock(ApplicationEventPublisher.class), registry, null, logoutManager, null, null, null, null, null, mock(AuditableExecution.class));
cas.destroyTicketGrantingTicket(tgt.getId());
}
Aggregations