Skip to content
Merged
Show file tree
Hide file tree
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 @@ -892,7 +892,7 @@ public void removeCredential(final @PathParam("credentialId") String credentialI
@APIResponse(responseCode = "404", description = "Not Found")
})
public void setCredentialUserLabel(final @PathParam("credentialId") String credentialId, String userLabel) {
auth.users().requireManage(user);
auth.users().requireResetPassword(user);
CredentialModel credential = user.credentialManager().getStoredCredentialById(credentialId);
if (credential == null) {
// we do this to make sure somebody can't phish ids
Expand Down Expand Up @@ -1324,4 +1324,4 @@ public SendEmailParams(String redirectUri, String clientId, Integer lifespan) {
this.lifespan = lifespan;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.keycloak.tests.admin.authz.fgap;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -474,6 +475,11 @@ public void testResetPassword() {
createPermission(client, userAlice.admin().toRepresentation().getId(), usersType, Set.of(VIEW), allowMyAdminPermission);

users.get(search.get(0).getId()).resetPassword(credential);

// set credential label - admin UI sets the label upon resetting the password
List<CredentialRepresentation> credentials = users.get(search.get(0).getId()).credentials();
assertThat(credentials, hasSize(1));
users.get(search.get(0).getId()).setCredentialUserLabel(credentials.get(0).getId(), "User Label");
}

@Test
Expand Down
Loading