Search in sources :

Example 1 with RedisTicketRegistryProperties

use of org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties in project cas by apereo.

the class RedisTicketRegistryConfiguration method ticketRegistry.

@Bean
@RefreshScope
public TicketRegistry ticketRegistry() {
    final RedisTicketRegistryProperties redis = casProperties.getTicket().getRegistry().getRedis();
    final RedisTicketRegistry r = new RedisTicketRegistry(ticketRedisTemplate());
    r.setCipherExecutor(Beans.newTicketRegistryCipherExecutor(redis.getCrypto()));
    return r;
}
Also used : RedisTicketRegistry(org.apereo.cas.ticket.registry.RedisTicketRegistry) RedisTicketRegistryProperties(org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Example 2 with RedisTicketRegistryProperties

use of org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties in project cas by apereo.

the class RedisTicketRegistryConfiguration method jedisPoolConfig.

private JedisPoolConfig jedisPoolConfig() {
    final RedisTicketRegistryProperties redis = casProperties.getTicket().getRegistry().getRedis();
    final JedisPoolConfig config = new JedisPoolConfig();
    final RedisTicketRegistryProperties.Pool props = redis.getPool();
    config.setMaxTotal(props.getMaxActive());
    config.setMaxIdle(props.getMaxIdle());
    config.setMinIdle(props.getMinIdle());
    config.setMaxWaitMillis(props.getMaxWait());
    return config;
}
Also used : RedisTicketRegistryProperties(org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig)

Example 3 with RedisTicketRegistryProperties

use of org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties in project cas by apereo.

the class RedisTicketRegistryConfiguration method redisConnectionFactory.

@Bean
@RefreshScope
public RedisConnectionFactory redisConnectionFactory() {
    final RedisTicketRegistryProperties redis = casProperties.getTicket().getRegistry().getRedis();
    final JedisPoolConfig poolConfig = redis.getPool() != null ? jedisPoolConfig() : new JedisPoolConfig();
    final JedisConnectionFactory factory = new JedisConnectionFactory(poolConfig);
    factory.setHostName(redis.getHost());
    factory.setPort(redis.getPort());
    if (redis.getPassword() != null) {
        factory.setPassword(redis.getPassword());
    }
    factory.setDatabase(redis.getDatabase());
    if (redis.getTimeout() > 0) {
        factory.setTimeout(redis.getTimeout());
    }
    return factory;
}
Also used : RedisTicketRegistryProperties(org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties) JedisConnectionFactory(org.springframework.data.redis.connection.jedis.JedisConnectionFactory) JedisPoolConfig(redis.clients.jedis.JedisPoolConfig) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

RedisTicketRegistryProperties (org.apereo.cas.configuration.model.support.redis.RedisTicketRegistryProperties)3 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)2 Bean (org.springframework.context.annotation.Bean)2 JedisPoolConfig (redis.clients.jedis.JedisPoolConfig)2 RedisTicketRegistry (org.apereo.cas.ticket.registry.RedisTicketRegistry)1 JedisConnectionFactory (org.springframework.data.redis.connection.jedis.JedisConnectionFactory)1