Search in sources :

Example 6 with EncryptionRandomizedSigningJwtCryptographyProperties

use of org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties 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"));
}
Also used : EhCacheTicketRegistry(org.apereo.cas.ticket.registry.EhCacheTicketRegistry) TicketDefinition(org.apereo.cas.ticket.TicketDefinition) Ehcache(net.sf.ehcache.Ehcache) CacheConfiguration(net.sf.ehcache.config.CacheConfiguration) EncryptionRandomizedSigningJwtCryptographyProperties(org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Autowired(org.springframework.beans.factory.annotation.Autowired) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

EncryptionRandomizedSigningJwtCryptographyProperties (org.apereo.cas.configuration.model.core.util.EncryptionRandomizedSigningJwtCryptographyProperties)6 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)3 Bean (org.springframework.context.annotation.Bean)3 Autowired (org.springframework.beans.factory.annotation.Autowired)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Slf4j (lombok.extern.slf4j.Slf4j)1 lombok.val (lombok.val)1 Ehcache (net.sf.ehcache.Ehcache)1 CacheConfiguration (net.sf.ehcache.config.CacheConfiguration)1 ClassUtils (org.apache.commons.lang3.ClassUtils)1 StringUtils (org.apache.commons.lang3.StringUtils)1 CipherExecutor (org.apereo.cas.CipherExecutor)1 EncryptionJwtSigningJwtCryptographyProperties (org.apereo.cas.configuration.model.core.util.EncryptionJwtSigningJwtCryptographyProperties)1 DynamoDbTicketRegistryProperties (org.apereo.cas.configuration.model.support.dynamodb.DynamoDbTicketRegistryProperties)1 WebflowProperties (org.apereo.cas.configuration.model.webapp.WebflowProperties)1 CasConfigurationMetadataRepository (org.apereo.cas.metadata.CasConfigurationMetadataRepository)1 TicketDefinition (org.apereo.cas.ticket.TicketDefinition)1 DynamoDbTicketRegistry (org.apereo.cas.ticket.registry.DynamoDbTicketRegistry)1 EhCacheTicketRegistry (org.apereo.cas.ticket.registry.EhCacheTicketRegistry)1 EncodingUtils (org.apereo.cas.util.EncodingUtils)1