use of org.apereo.cas.configuration.model.support.ignite.IgniteProperties in project cas by apereo.
the class IgniteTicketRegistryConfiguration method igniteConfiguration.
/**
* Ignite configuration ignite configuration.
*
* @return the ignite configuration
*/
@RefreshScope
@Bean
public IgniteConfiguration igniteConfiguration() {
final IgniteProperties ignite = casProperties.getTicket().getRegistry().getIgnite();
final IgniteConfiguration config = new IgniteConfiguration();
final TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setHeartbeatFrequency(ignite.getHeartbeatFrequency());
spi.setJoinTimeout(ignite.getJoinTimeout());
if (!StringUtils.isEmpty(ignite.getLocalAddress())) {
spi.setLocalAddress(ignite.getLocalAddress());
}
if (ignite.getLocalPort() != -1) {
spi.setLocalPort(ignite.getLocalPort());
}
spi.setNetworkTimeout(ignite.getNetworkTimeout());
spi.setSocketTimeout(ignite.getSocketTimeout());
spi.setThreadPriority(ignite.getThreadPriority());
spi.setForceServerMode(ignite.isForceServerMode());
final TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
finder.setAddresses(StringUtils.commaDelimitedListToSet(ignite.getIgniteAddresses()));
spi.setIpFinder(finder);
config.setDiscoverySpi(spi);
final List<CacheConfiguration> configurations = new ArrayList<>();
final CacheConfiguration ticketsCache = new CacheConfiguration();
ticketsCache.setName(ignite.getTicketsCache().getCacheName());
ticketsCache.setCacheMode(CacheMode.valueOf(ignite.getTicketsCache().getCacheMode()));
ticketsCache.setAtomicityMode(CacheAtomicityMode.valueOf(ignite.getTicketsCache().getAtomicityMode()));
ticketsCache.setWriteSynchronizationMode(CacheWriteSynchronizationMode.valueOf(ignite.getTicketsCache().getWriteSynchronizationMode()));
ticketsCache.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, casProperties.getTicket().getTgt().getMaxTimeToLiveInSeconds())));
configurations.add(ticketsCache);
config.setCacheConfiguration(configurations.toArray(new CacheConfiguration[] {}));
return config;
}
use of org.apereo.cas.configuration.model.support.ignite.IgniteProperties in project cas by apereo.
the class IgniteTicketRegistryConfiguration method ticketRegistry.
@Bean
@RefreshScope
public TicketRegistry ticketRegistry() {
final IgniteProperties igniteProperties = casProperties.getTicket().getRegistry().getIgnite();
final IgniteTicketRegistry r = new IgniteTicketRegistry(igniteConfiguration(), igniteProperties);
r.setCipherExecutor(Beans.newTicketRegistryCipherExecutor(igniteProperties.getCrypto()));
return r;
}
use of org.apereo.cas.configuration.model.support.ignite.IgniteProperties in project cas by apereo.
the class IgniteTicketRegistryConfiguration method ticketRegistry.
@Bean
@RefreshScope
public TicketRegistry ticketRegistry(@Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
final IgniteProperties igniteProperties = casProperties.getTicket().getRegistry().getIgnite();
final IgniteTicketRegistry r = new IgniteTicketRegistry(ticketCatalog, igniteConfiguration(ticketCatalog), igniteProperties);
r.setCipherExecutor(CoreTicketUtils.newTicketRegistryCipherExecutor(igniteProperties.getCrypto(), "ignite"));
return r;
}
use of org.apereo.cas.configuration.model.support.ignite.IgniteProperties in project cas by apereo.
the class IgniteTicketRegistryConfiguration method igniteConfiguration.
/**
* Ignite configuration ignite configuration.
*
* @param ticketCatalog the ticket catalog
* @return the ignite configuration
*/
@RefreshScope
@Bean
public IgniteConfiguration igniteConfiguration(@Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
final IgniteProperties ignite = casProperties.getTicket().getRegistry().getIgnite();
final IgniteConfiguration config = new IgniteConfiguration();
final TcpDiscoverySpi spi = new TcpDiscoverySpi();
if (!StringUtils.isEmpty(ignite.getLocalAddress())) {
spi.setLocalAddress(ignite.getLocalAddress());
}
if (ignite.getLocalPort() != -1) {
spi.setLocalPort(ignite.getLocalPort());
}
spi.setJoinTimeout(Beans.newDuration(ignite.getJoinTimeout()).toMillis());
spi.setAckTimeout(Beans.newDuration(ignite.getAckTimeout()).toMillis());
spi.setNetworkTimeout(Beans.newDuration(ignite.getNetworkTimeout()).toMillis());
spi.setSocketTimeout(Beans.newDuration(ignite.getSocketTimeout()).toMillis());
spi.setThreadPriority(ignite.getThreadPriority());
spi.setForceServerMode(ignite.isForceServerMode());
final TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
finder.setAddresses(ignite.getIgniteAddress());
spi.setIpFinder(finder);
config.setDiscoverySpi(spi);
final Collection<CacheConfiguration> cacheConfigurations = buildIgniteTicketCaches(ignite, ticketCatalog);
config.setCacheConfiguration(cacheConfigurations.toArray(new CacheConfiguration[] {}));
config.setClientMode(ignite.isClientMode());
return config;
}
Aggregations