Search in sources :

Example 1 with MemcachedPooledClientConnectionFactory

use of org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory in project cas by apereo.

the class MemcachedMonitorConfiguration method memcachedHealthIndicator.

@Bean
public HealthIndicator memcachedHealthIndicator() {
    final MonitorProperties.Memcached memcached = casProperties.getMonitor().getMemcached();
    final MemcachedPooledClientConnectionFactory factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedMonitorTranscoder());
    final ObjectPool<MemcachedClientIF> pool = new GenericObjectPool<>(factory);
    return new MemcachedHealthIndicator(pool, casProperties);
}
Also used : MemcachedPooledClientConnectionFactory(org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory) MemcachedClientIF(net.spy.memcached.MemcachedClientIF) GenericObjectPool(org.apache.commons.pool2.impl.GenericObjectPool) MemcachedHealthIndicator(org.apereo.cas.monitor.MemcachedHealthIndicator) MonitorProperties(org.apereo.cas.configuration.model.core.monitor.MonitorProperties) Bean(org.springframework.context.annotation.Bean)

Example 2 with MemcachedPooledClientConnectionFactory

use of org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory in project cas by apereo.

the class MemcachedTicketRegistryConfiguration method ticketRegistry.

@Bean
public TicketRegistry ticketRegistry() {
    final MemcachedTicketRegistryProperties memcached = casProperties.getTicket().getRegistry().getMemcached();
    final MemcachedPooledClientConnectionFactory factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedTicketRegistryTranscoder());
    final MemcachedTicketRegistry registry = new MemcachedTicketRegistry(factory.getObjectPool());
    final CipherExecutor cipherExecutor = CoreTicketUtils.newTicketRegistryCipherExecutor(memcached.getCrypto(), "memcached");
    registry.setCipherExecutor(cipherExecutor);
    return registry;
}
Also used : MemcachedTicketRegistry(org.apereo.cas.ticket.registry.MemcachedTicketRegistry) MemcachedPooledClientConnectionFactory(org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory) CipherExecutor(org.apereo.cas.CipherExecutor) MemcachedTicketRegistryProperties(org.apereo.cas.configuration.model.support.memcached.MemcachedTicketRegistryProperties) Bean(org.springframework.context.annotation.Bean)

Example 3 with MemcachedPooledClientConnectionFactory

use of org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory in project cas by apereo.

the class MemcachedMonitorConfiguration method memcachedHealthClientPool.

@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "memcachedHealthClientPool")
public ObjectPool<MemcachedClientIF> memcachedHealthClientPool(@Qualifier("memcachedMonitorTranscoder") final Transcoder memcachedMonitorTranscoder, final CasConfigurationProperties casProperties) {
    val memcached = casProperties.getMonitor().getMemcached();
    val factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedMonitorTranscoder);
    return new GenericObjectPool<>(factory);
}
Also used : lombok.val(lombok.val) MemcachedPooledClientConnectionFactory(org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory) GenericObjectPool(org.apache.commons.pool2.impl.GenericObjectPool) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with MemcachedPooledClientConnectionFactory

use of org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory in project cas by apereo.

the class MemcachedTicketRegistryConfiguration method ticketRegistry.

@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public TicketRegistry ticketRegistry(final CasConfigurationProperties casProperties, @Qualifier("memcachedTicketRegistryTranscoder") final Transcoder memcachedTicketRegistryTranscoder) {
    val memcached = casProperties.getTicket().getRegistry().getMemcached();
    val factory = new MemcachedPooledClientConnectionFactory(memcached, memcachedTicketRegistryTranscoder);
    val registry = new MemcachedTicketRegistry(factory.getObjectPool());
    val cipherExecutor = CoreTicketUtils.newTicketRegistryCipherExecutor(memcached.getCrypto(), "memcached");
    registry.setCipherExecutor(cipherExecutor);
    return registry;
}
Also used : lombok.val(lombok.val) MemcachedTicketRegistry(org.apereo.cas.ticket.registry.MemcachedTicketRegistry) MemcachedPooledClientConnectionFactory(org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

MemcachedPooledClientConnectionFactory (org.apereo.cas.memcached.MemcachedPooledClientConnectionFactory)4 Bean (org.springframework.context.annotation.Bean)4 lombok.val (lombok.val)2 GenericObjectPool (org.apache.commons.pool2.impl.GenericObjectPool)2 MemcachedTicketRegistry (org.apereo.cas.ticket.registry.MemcachedTicketRegistry)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)2 MemcachedClientIF (net.spy.memcached.MemcachedClientIF)1 CipherExecutor (org.apereo.cas.CipherExecutor)1 MonitorProperties (org.apereo.cas.configuration.model.core.monitor.MonitorProperties)1 MemcachedTicketRegistryProperties (org.apereo.cas.configuration.model.support.memcached.MemcachedTicketRegistryProperties)1 MemcachedHealthIndicator (org.apereo.cas.monitor.MemcachedHealthIndicator)1