use of org.apereo.cas.ticket.registry.EhCacheTicketRegistry in project cas by apereo.
the class EhcacheTicketRegistryConfiguration method ticketRegistry.
@Autowired
@RefreshScope
@Bean
public TicketRegistry ticketRegistry(@Qualifier("ehcacheTicketCacheManager") final CacheManager manager, @Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
final EncryptionRandomizedSigningJwtCryptographyProperties crypto = casProperties.getTicket().getRegistry().getEhcache().getCrypto();
final Collection<TicketDefinition> definitions = ticketCatalog.findAll();
definitions.forEach(t -> {
final Ehcache ehcache = buildCache(t);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Created Ehcache cache [{}] for [{}]", ehcache.getName(), t);
final CacheConfiguration config = ehcache.getCacheConfiguration();
LOGGER.debug("TicketCache.maxEntriesLocalHeap=[{}]", config.getMaxEntriesLocalHeap());
LOGGER.debug("TicketCache.maxEntriesLocalDisk=[{}]", config.getMaxEntriesLocalDisk());
LOGGER.debug("TicketCache.maxEntriesInCache=[{}]", config.getMaxEntriesInCache());
LOGGER.debug("TicketCache.persistenceConfiguration=[{}]", config.getPersistenceConfiguration().getStrategy());
LOGGER.debug("TicketCache.synchronousWrites=[{}]", config.getPersistenceConfiguration().getSynchronousWrites());
LOGGER.debug("TicketCache.timeToLive=[{}]", config.getTimeToLiveSeconds());
LOGGER.debug("TicketCache.timeToIdle=[{}]", config.getTimeToIdleSeconds());
LOGGER.debug("TicketCache.cacheManager=[{}]", ehcache.getCacheManager().getName());
}
manager.addDecoratedCacheIfAbsent(ehcache);
});
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("The following caches are available: [{}]", (Object[]) manager.getCacheNames());
}
return new EhCacheTicketRegistry(ticketCatalog, manager, CoreTicketUtils.newTicketRegistryCipherExecutor(crypto, "ehcache"));
}
Aggregations