ilhan
ilhan

Reputation: 8995

Password Policies do not Work When There is a User Federation

I have build an custom user storage provider using this example.

Unfortunately when you activate this user federation then password policies do not work. For example under Authentication → Password Policy → Add policy… → Minimum Length. This does not work. Is there any workaround to activate password policies?

Upvotes: 1

Views: 767

Answers (1)

Boomer
Boomer

Reputation: 3721

You may call the password policies check yourself in method updateCredential() of yor custom UserStorageProvider.

Use this code snippet:

PasswordPolicyManagerProvider pwPolicyManager = session.getProvider(PasswordPolicyManagerProvider.class);
PolicyError err = pwPolicyManager.validate(user.getUsername(), cred.getValue());
if (err != null) {
  // log error here
  return false;
}

Upvotes: 3

Related Questions