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

Expose resetCredentials via api to allow root user to reset credentials for one time use for an existing principal. #1047

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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 @@ -250,6 +250,13 @@ public Response rotateCredentials(
return Response.ok(adminService.rotateCredentials(principalName)).build();
}

@Override
public Response resetCredentials(
String principalName, RealmContext realmContext, SecurityContext securityContext) {
PolarisAdminService adminService = newAdminService(realmContext, securityContext);
return Response.ok(adminService.resetCredentials(principalName)).build();
}

/** From PolarisPrincipalsApiService */
@Override
public Response listPrincipals(RealmContext realmContext, SecurityContext securityContext) {
Expand Down
31 changes: 30 additions & 1 deletion spec/polaris-management-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ paths:
post:
operationId: rotateCredentials
description: Rotate a principal's credentials. The new credentials will be returned in the response. This is the only
API, aside from createPrincipal, that returns the user's credentials. This API is *not* idempotent.
API, aside from createPrincipal and resetCredentials, that returns the user's credentials. This API is *not* idempotent.
responses:
200:
description: The principal details along with the newly rotated credentials
Expand All @@ -255,6 +255,35 @@ paths:
404:
description: "The principal does not exist"

/principals/{principalName}/reset:
parameters:
- name: principalName
in: path
description: The user name
required: true
schema:
type: string
minLength: 1
maxLength: 256
pattern: '^(?!\s*[s|S][y|Y][s|S][t|T][e|E][m|M]\$).*$'
post:
operationId: resetCredentials
description:
Reset a principal's credentials to a set of credentials that can only be used to rotate the principal's
credentials. The new credentials will be returned in the response. This is the only API, aside from
createPrincipal and rotateCredentials, that returns the user's credentials. This API is *not* idempotent.
responses:
200:
description: The principal details along with the newly reset credentials that require rotating
content:
application/json:
schema:
$ref: "#/components/schemas/PrincipalWithCredentials"
403:
description: "The caller does not have permission to reset credentials"
404:
description: "The principal does not exist"

/principals/{principalName}/principal-roles:
parameters:
- name: principalName
Expand Down