Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rest.identity): fixed passswordAuthEnabled property #5020

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading