Search in sources :

Example 1 with RejectUsersAuthenticationHandler

use of org.apereo.cas.adaptors.generic.RejectUsersAuthenticationHandler in project cas by apereo.

the class RejectUsersAuthenticationEventExecutionPlanConfiguration method rejectUsersAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler rejectUsersAuthenticationHandler() {
    final RejectAuthenticationProperties rejectProperties = casProperties.getAuthn().getReject();
    final Set<String> users = org.springframework.util.StringUtils.commaDelimitedListToSet(rejectProperties.getUsers());
    final RejectUsersAuthenticationHandler h = new RejectUsersAuthenticationHandler(rejectProperties.getName(), servicesManager, rejectUsersPrincipalFactory(), users);
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(rejectProperties.getPasswordEncoder()));
    if (rejectPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(rejectPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(rejectProperties.getPrincipalTransformation()));
    return h;
}
Also used : RejectUsersAuthenticationHandler(org.apereo.cas.adaptors.generic.RejectUsersAuthenticationHandler) RejectAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.RejectAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

RejectUsersAuthenticationHandler (org.apereo.cas.adaptors.generic.RejectUsersAuthenticationHandler)1 RejectAuthenticationProperties (org.apereo.cas.configuration.model.support.generic.RejectAuthenticationProperties)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1