Search in sources :

Example 1 with HazelcastTicketRegistryProperties

use of org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties in project cas by apereo.

the class HazelcastTicketRegistryConfiguration method ticketRegistry.

@Autowired
@Bean
public TicketRegistry ticketRegistry(@Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) {
    final HazelcastTicketRegistryProperties hz = casProperties.getTicket().getRegistry().getHazelcast();
    final HazelcastTicketRegistry r = new HazelcastTicketRegistry(hazelcast(ticketCatalog), ticketCatalog, hz.getPageSize());
    r.setCipherExecutor(CoreTicketUtils.newTicketRegistryCipherExecutor(hz.getCrypto(), "hazelcast"));
    return r;
}
Also used : HazelcastTicketRegistry(org.apereo.cas.ticket.registry.HazelcastTicketRegistry) HazelcastTicketRegistryProperties(org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties) Autowired(org.springframework.beans.factory.annotation.Autowired) Bean(org.springframework.context.annotation.Bean)

Example 2 with HazelcastTicketRegistryProperties

use of org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties in project cas by apereo.

the class HazelcastTicketRegistryConfiguration method buildHazelcastMapConfigurations.

private Map<String, MapConfig> buildHazelcastMapConfigurations(final TicketCatalog ticketCatalog) {
    final Map<String, MapConfig> mapConfigs = new HashMap<>();
    final HazelcastTicketRegistryProperties hz = casProperties.getTicket().getRegistry().getHazelcast();
    final HazelcastConfigurationFactory factory = new HazelcastConfigurationFactory();
    final Collection<TicketDefinition> definitions = ticketCatalog.findAll();
    definitions.forEach(t -> {
        final MapConfig mapConfig = factory.buildMapConfig(hz, t.getProperties().getStorageName(), t.getProperties().getStorageTimeout());
        LOGGER.debug("Created Hazelcast map configuration for [{}]", t);
        mapConfigs.put(t.getProperties().getStorageName(), mapConfig);
    });
    return mapConfigs;
}
Also used : HazelcastConfigurationFactory(org.apereo.cas.hz.HazelcastConfigurationFactory) HashMap(java.util.HashMap) TicketDefinition(org.apereo.cas.ticket.TicketDefinition) HazelcastTicketRegistryProperties(org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties) MapConfig(com.hazelcast.config.MapConfig)

Example 3 with HazelcastTicketRegistryProperties

use of org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties in project cas by apereo.

the class HazelcastTicketRegistryConfiguration method getConfig.

private Config getConfig(final TicketCatalog ticketCatalog) {
    final HazelcastTicketRegistryProperties hz = casProperties.getTicket().getRegistry().getHazelcast();
    final Map<String, MapConfig> configs = buildHazelcastMapConfigurations(ticketCatalog);
    final HazelcastConfigurationFactory factory = new HazelcastConfigurationFactory();
    return factory.build(hz, configs);
}
Also used : HazelcastConfigurationFactory(org.apereo.cas.hz.HazelcastConfigurationFactory) HazelcastTicketRegistryProperties(org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties) MapConfig(com.hazelcast.config.MapConfig)

Aggregations

HazelcastTicketRegistryProperties (org.apereo.cas.configuration.model.support.hazelcast.HazelcastTicketRegistryProperties)3 MapConfig (com.hazelcast.config.MapConfig)2 HazelcastConfigurationFactory (org.apereo.cas.hz.HazelcastConfigurationFactory)2 HashMap (java.util.HashMap)1 TicketDefinition (org.apereo.cas.ticket.TicketDefinition)1 HazelcastTicketRegistry (org.apereo.cas.ticket.registry.HazelcastTicketRegistry)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Bean (org.springframework.context.annotation.Bean)1