Commit a82b809b authored by Anno van Vliet's avatar Anno van Vliet

OF-1345 Can't create/reset passwords when using HybridAuthProvider

Although not in line with that what has been stated in this issue, this
fixes the possibility to change passwords in the GUI for those users
which are stored in the DefaultUserProvider.
parent f961503d
......@@ -216,7 +216,42 @@ public class HybridAuthProvider implements AuthProvider {
public void setPassword(String username, String password)
throws UserNotFoundException, UnsupportedOperationException
{
throw new UnsupportedOperationException();
// Check overrides first.
if (primaryOverrides.contains(username.toLowerCase())) {
primaryProvider.setPassword(username, password);
return;
}
else if (secondaryOverrides.contains(username.toLowerCase())) {
secondaryProvider.setPassword(username, password);
return;
}
else if (tertiaryOverrides.contains(username.toLowerCase())) {
tertiaryProvider.setPassword(username, password);
return;
}
// Now perform normal
try {
primaryProvider.setPassword(username, password);
}
catch (UserNotFoundException | UnsupportedOperationException ue) {
if (secondaryProvider != null) {
try {
secondaryProvider.setPassword(username, password);
}
catch (UserNotFoundException | UnsupportedOperationException ue2) {
if (tertiaryProvider != null) {
tertiaryProvider.setPassword(username, password);
}
else {
throw ue2;
}
}
}
else {
throw ue;
}
}
}
@Override
......
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