Commit b37b91d8 authored by Matija Obreza's avatar Matija Obreza
Browse files

Expose #assureGoodPassword

parent 9afc28c6
......@@ -118,15 +118,25 @@ public abstract class BasicUserServiceImpl<R extends GrantedAuthority, T extends
protected void setPassword(final T user, final String password) throws PasswordPolicyException {
if (user.getAccountType() == AccountType.LOCAL) {
if (passwordPolicy != null) {
passwordPolicy.assureGoodPassword(password);
}
assureGoodPassword(password);
user.setPassword(password == null ? null : passwordEncoder.encode(password));
} else {
user.setPassword(THIS_IS_NOT_A_PASSWORD);
}
}
/**
* Test if password passes the password policy (if set)
*
* @param password candidate password
* @throws PasswordPolicyException if password does not match policy
*/
public void assureGoodPassword(final String password) throws PasswordPolicyException {
if (passwordPolicy != null) {
passwordPolicy.assureGoodPassword(password);
}
}
/**
* For internal use only.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment