use of org.apereo.cas.redis.RedisAuthenticationHandler in project cas by apereo.
the class RedisAuthenticationConfiguration method redisAuthenticationHandler.
@Bean
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
@ConditionalOnMissingBean(name = "redisAuthenticationHandler")
public AuthenticationHandler redisAuthenticationHandler(final CasConfigurationProperties casProperties, final ConfigurableApplicationContext applicationContext, @Qualifier("redisPrincipalFactory") final PrincipalFactory redisPrincipalFactory, @Qualifier("authenticationRedisTemplate") final CasRedisTemplate authenticationRedisTemplate, @Qualifier(ServicesManager.BEAN_NAME) final ServicesManager servicesManager) {
return BeanSupplier.of(AuthenticationHandler.class).when(CONDITION.given(applicationContext.getEnvironment())).supply(() -> {
val redis = casProperties.getAuthn().getRedis();
val handler = new RedisAuthenticationHandler(redis.getName(), servicesManager, redisPrincipalFactory, redis.getOrder(), authenticationRedisTemplate);
handler.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(redis.getPrincipalTransformation()));
handler.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(redis.getPasswordEncoder(), applicationContext));
return handler;
}).otherwiseProxy().get();
}
Aggregations