Search in sources :

Example 1 with RejectResultCodeLdapPasswordPolicyHandlingStrategy

use of org.apereo.cas.authentication.support.RejectResultCodeLdapPasswordPolicyHandlingStrategy in project cas by apereo.

the class LdapAuthenticationConfiguration method createLdapPasswordPolicyHandlingStrategy.

private LdapPasswordPolicyHandlingStrategy createLdapPasswordPolicyHandlingStrategy(final LdapAuthenticationProperties l) {
    if (l.getPasswordPolicy().getStrategy() == PasswordPolicyProperties.PasswordPolicyHandlingOptions.REJECT_RESULT_CODE) {
        LOGGER.debug("Created LDAP password policy handling strategy based on blacklisted authentication result codes");
        return new RejectResultCodeLdapPasswordPolicyHandlingStrategy();
    }
    final Resource location = l.getPasswordPolicy().getGroovy().getLocation();
    if (l.getPasswordPolicy().getStrategy() == PasswordPolicyProperties.PasswordPolicyHandlingOptions.GROOVY && location != null) {
        LOGGER.debug("Created LDAP password policy handling strategy based on Groovy script [{}]", location);
        return new GroovyLdapPasswordPolicyHandlingStrategy(location);
    }
    LOGGER.debug("Created default LDAP password policy handling strategy");
    return new DefaultLdapPasswordPolicyHandlingStrategy();
}
Also used : DefaultLdapPasswordPolicyHandlingStrategy(org.apereo.cas.authentication.support.DefaultLdapPasswordPolicyHandlingStrategy) RejectResultCodeLdapPasswordPolicyHandlingStrategy(org.apereo.cas.authentication.support.RejectResultCodeLdapPasswordPolicyHandlingStrategy) Resource(org.springframework.core.io.Resource) GroovyLdapPasswordPolicyHandlingStrategy(org.apereo.cas.authentication.support.GroovyLdapPasswordPolicyHandlingStrategy)

Aggregations

DefaultLdapPasswordPolicyHandlingStrategy (org.apereo.cas.authentication.support.DefaultLdapPasswordPolicyHandlingStrategy)1 GroovyLdapPasswordPolicyHandlingStrategy (org.apereo.cas.authentication.support.GroovyLdapPasswordPolicyHandlingStrategy)1 RejectResultCodeLdapPasswordPolicyHandlingStrategy (org.apereo.cas.authentication.support.RejectResultCodeLdapPasswordPolicyHandlingStrategy)1 Resource (org.springframework.core.io.Resource)1