Search in sources :

Example 1 with ShiroAuthenticationProperties

use of org.apereo.cas.configuration.model.support.generic.ShiroAuthenticationProperties in project cas by apereo.

the class ShiroAuthenticationConfiguration method shiroAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler shiroAuthenticationHandler() {
    final ShiroAuthenticationProperties shiro = casProperties.getAuthn().getShiro();
    final ShiroAuthenticationHandler h = new ShiroAuthenticationHandler(shiro.getName(), servicesManager, shiroPrincipalFactory(), shiro.getRequiredRoles(), shiro.getRequiredPermissions());
    h.loadShiroConfiguration(shiro.getLocation());
    h.setPasswordEncoder(PasswordEncoderUtils.newPasswordEncoder(shiro.getPasswordEncoder()));
    if (shiroPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(shiroPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(PrincipalNameTransformerUtils.newPrincipalNameTransformer(shiro.getPrincipalTransformation()));
    return h;
}
Also used : ShiroAuthenticationHandler(org.apereo.cas.adaptors.generic.ShiroAuthenticationHandler) ShiroAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.ShiroAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with ShiroAuthenticationProperties

use of org.apereo.cas.configuration.model.support.generic.ShiroAuthenticationProperties in project cas by apereo.

the class ShiroAuthenticationEventExecutionPlanConfiguration method shiroAuthenticationHandler.

@RefreshScope
@Bean
public AuthenticationHandler shiroAuthenticationHandler() {
    final ShiroAuthenticationProperties shiro = casProperties.getAuthn().getShiro();
    final ShiroAuthenticationHandler h = new ShiroAuthenticationHandler(shiro.getName(), servicesManager, shiroPrincipalFactory(), shiro.getRequiredRoles(), shiro.getRequiredPermissions());
    h.loadShiroConfiguration(shiro.getConfig().getLocation());
    h.setPasswordEncoder(Beans.newPasswordEncoder(shiro.getPasswordEncoder()));
    if (shiroPasswordPolicyConfiguration != null) {
        h.setPasswordPolicyConfiguration(shiroPasswordPolicyConfiguration);
    }
    h.setPrincipalNameTransformer(Beans.newPrincipalNameTransformer(shiro.getPrincipalTransformation()));
    return h;
}
Also used : ShiroAuthenticationHandler(org.apereo.cas.adaptors.generic.ShiroAuthenticationHandler) ShiroAuthenticationProperties(org.apereo.cas.configuration.model.support.generic.ShiroAuthenticationProperties) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ShiroAuthenticationHandler (org.apereo.cas.adaptors.generic.ShiroAuthenticationHandler)2 ShiroAuthenticationProperties (org.apereo.cas.configuration.model.support.generic.ShiroAuthenticationProperties)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)2 Bean (org.springframework.context.annotation.Bean)2