Skip to content

Commit

Permalink
fix(rest.identity): fixed passswordAuthEnabled property (#5020)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfiorani authored Nov 23, 2023
1 parent a626f44 commit 14e1b7c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class IdentityService {
private static final String USER_ROLE_NAME_PREFIX = "kura.user.";

private static final String KURA_NEED_PASSWORD_CHANGE_PROPERTY = "kura.need.password.change";
private static final String PASSWORD_PROPERTY = "kura.password";

private final UserAdminHelper userAdminHelper;
private final ConfigurationService configurationService;
Expand Down Expand Up @@ -112,8 +113,7 @@ public Set<UserDTO> getUserConfig() {

private UserDTO initUserConfig(final User user) {

final boolean isPasswordEnabled = user.getCredentials()
.get(KURA_NEED_PASSWORD_CHANGE_PROPERTY) instanceof String;
final boolean isPasswordEnabled = user.getCredentials().get(PASSWORD_PROPERTY) instanceof String;
final boolean isPasswordChangeRequired = Objects.equals("true",
user.getProperties().get(KURA_NEED_PASSWORD_CHANGE_PROPERTY));

Expand Down Expand Up @@ -201,13 +201,13 @@ private void updatePasswordOptions(UserDTO userDTO, final Dictionary<String, Obj
if (password != null) {
validateUserPassword(password);
try {
credentials.put(KURA_NEED_PASSWORD_CHANGE_PROPERTY, this.cryptoService.sha256Hash(password));
credentials.put(PASSWORD_PROPERTY, this.cryptoService.sha256Hash(password));
} catch (final Exception e) {
throw new KuraException(KuraErrorCode.SERVICE_UNAVAILABLE, e);
}
}
} else {
credentials.remove(KURA_NEED_PASSWORD_CHANGE_PROPERTY);
credentials.remove(PASSWORD_PROPERTY);
}
}

Expand Down

0 comments on commit 14e1b7c

Please sign in to comment.