Package org.keycloak.policy
Class BlacklistPasswordPolicyProvider
- java.lang.Object
-
- org.keycloak.policy.BlacklistPasswordPolicyProvider
-
- All Implemented Interfaces:
PasswordPolicyProvider
,Provider
public class BlacklistPasswordPolicyProvider extends Object implements PasswordPolicyProvider
Checks a password against a configured password blacklist.- Author:
- Thomas Darimont
-
-
Field Summary
Fields Modifier and Type Field Description static String
ERROR_MESSAGE
-
Fields inherited from interface org.keycloak.policy.PasswordPolicyProvider
INT_CONFIG_TYPE, STRING_CONFIG_TYPE
-
-
Constructor Summary
Constructors Constructor Description BlacklistPasswordPolicyProvider(KeycloakContext context, BlacklistPasswordPolicyProviderFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Object
parseConfig(String blacklistName)
Parses the allowed configuration for aBlacklistPasswordPolicyProvider
.PolicyError
validate(String username, String password)
Checks whether the provided password is contained in the configured blacklist.PolicyError
validate(RealmModel realm, UserModel user, String password)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.policy.PasswordPolicyProvider
parseInteger
-
-
-
-
Field Detail
-
ERROR_MESSAGE
public static final String ERROR_MESSAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BlacklistPasswordPolicyProvider
public BlacklistPasswordPolicyProvider(KeycloakContext context, BlacklistPasswordPolicyProviderFactory factory)
-
-
Method Detail
-
validate
public PolicyError validate(String username, String password)
Checks whether the provided password is contained in the configured blacklist.- Specified by:
validate
in interfacePasswordPolicyProvider
- Parameters:
username
-password
-- Returns:
- null if the password is not blacklisted otherwise a
PolicyError
-
validate
public PolicyError validate(RealmModel realm, UserModel user, String password)
- Specified by:
validate
in interfacePasswordPolicyProvider
-
parseConfig
public Object parseConfig(String blacklistName)
Parses the allowed configuration for aBlacklistPasswordPolicyProvider
. Supported syntax is {@¢ode passwordBlacklist(fileName)} Example configurations:passwordBlacklist(test-password-blacklist.txt)
- Specified by:
parseConfig
in interfacePasswordPolicyProvider
- Parameters:
blacklistName
-- Returns:
-
-