use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCookieConfiguration method ticketGrantingTicketCookieGenerator.
@Autowired
@Bean
@RefreshScope
public CookieRetrievingCookieGenerator ticketGrantingTicketCookieGenerator(@Qualifier("cookieCipherExecutor") final CipherExecutor cipherExecutor) {
final TicketGrantingCookieProperties tgc = casProperties.getTgc();
final int rememberMeMaxAge = Long.valueOf(tgc.getRememberMeMaxAge()).intValue();
return new TGCCookieRetrievingCookieGenerator(cookieValueManager(cipherExecutor), tgc.getName(), tgc.getPath(), tgc.getDomain(), rememberMeMaxAge, tgc.isSecure(), tgc.getMaxAge());
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreAuthenticationHandlersConfiguration method jaasAuthenticationHandler.
@RefreshScope
@Bean
public AuthenticationHandler jaasAuthenticationHandler() {
final JaasAuthenticationProperties jaas = casProperties.getAuthn().getJaas();
final JaasAuthenticationHandler h = new JaasAuthenticationHandler(jaas.getName(), servicesManager, jaasPrincipalFactory(), null);
h.setKerberosKdcSystemProperty(jaas.getKerberosKdcSystemProperty());
h.setKerberosRealmSystemProperty(jaas.getKerberosRealmSystemProperty());
h.setRealm(jaas.getRealm());
h.setPasswordEncoder(Beans.newPasswordEncoder(jaas.getPasswordEncoder()));
if (jaasPasswordPolicyConfiguration != null) {
h.setPasswordPolicyConfiguration(jaasPasswordPolicyConfiguration);
}
h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(jaas.getPrincipalTransformation()));
return h;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope in project cas by apereo.
the class CasCoreAuthenticationPrincipalConfiguration method personDirectoryPrincipalResolver.
@Autowired
@RefreshScope
@Bean
@ConditionalOnMissingBean(name = "personDirectoryPrincipalResolver")
public PrincipalResolver personDirectoryPrincipalResolver(@Qualifier("attributeRepository") final IPersonAttributeDao attributeRepository, @Qualifier("principalFactory") final PrincipalFactory principalFactory) {
final PersonDirectoryPrincipalResolver bean = new PersonDirectoryPrincipalResolver();
bean.setAttributeRepository(attributeRepository);
bean.setPrincipalAttributeName(casProperties.getPersonDirectory().getPrincipalAttribute());
bean.setReturnNullIfNoAttributes(casProperties.getPersonDirectory().isReturnNull());
bean.setPrincipalFactory(principalFactory);
return bean;
}
use of org.springframework.cloud.context.config.annotation.RefreshScope 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.springframework.cloud.context.config.annotation.RefreshScope 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;
}
Aggregations