Search in sources :

Example 1 with RejectResultCodePasswordPolicyHandlingStrategy

use of org.apereo.cas.authentication.support.password.RejectResultCodePasswordPolicyHandlingStrategy in project cas by apereo.

the class CoreAuthenticationUtils method newPasswordPolicyHandlingStrategy.

/**
 * New password policy handling strategy.
 *
 * @param properties         the properties
 * @param applicationContext the application context
 * @return the authentication password policy handling strategy
 */
public static AuthenticationPasswordPolicyHandlingStrategy newPasswordPolicyHandlingStrategy(final PasswordPolicyProperties properties, final ApplicationContext applicationContext) {
    if (properties.getStrategy() == PasswordPolicyProperties.PasswordPolicyHandlingOptions.REJECT_RESULT_CODE) {
        LOGGER.debug("Created password policy handling strategy based on blocked authentication result codes");
        return new RejectResultCodePasswordPolicyHandlingStrategy<>();
    }
    val location = properties.getGroovy().getLocation();
    if (properties.getStrategy() == PasswordPolicyProperties.PasswordPolicyHandlingOptions.GROOVY && location != null) {
        LOGGER.debug("Created password policy handling strategy based on Groovy script [{}]", location);
        return new GroovyPasswordPolicyHandlingStrategy<>(location, applicationContext);
    }
    LOGGER.trace("Created default password policy handling strategy");
    return new DefaultPasswordPolicyHandlingStrategy<>();
}
Also used : lombok.val(lombok.val) RejectResultCodePasswordPolicyHandlingStrategy(org.apereo.cas.authentication.support.password.RejectResultCodePasswordPolicyHandlingStrategy) GroovyPasswordPolicyHandlingStrategy(org.apereo.cas.authentication.support.password.GroovyPasswordPolicyHandlingStrategy) DefaultPasswordPolicyHandlingStrategy(org.apereo.cas.authentication.support.password.DefaultPasswordPolicyHandlingStrategy)

Aggregations

lombok.val (lombok.val)1 DefaultPasswordPolicyHandlingStrategy (org.apereo.cas.authentication.support.password.DefaultPasswordPolicyHandlingStrategy)1 GroovyPasswordPolicyHandlingStrategy (org.apereo.cas.authentication.support.password.GroovyPasswordPolicyHandlingStrategy)1 RejectResultCodePasswordPolicyHandlingStrategy (org.apereo.cas.authentication.support.password.RejectResultCodePasswordPolicyHandlingStrategy)1