Skip to content

Commit

Permalink
Add support for get client scope permissions (#490)
Browse files Browse the repository at this point in the history
Add the permissions request for a client scope
  • Loading branch information
ncthompson authored Nov 5, 2024
1 parent 8f8cdf1 commit d77c788
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3740,6 +3740,21 @@ func (g *GoCloak) GetPermissionResources(ctx context.Context, token, realm, idOf
return result, nil
}

// GetScopePermissions returns permissions associated with the client scope
func (g *GoCloak) GetScopePermissions(ctx context.Context, token, realm, idOfClient, idOfScope string) ([]*PolicyRepresentation, error) {
const errMessage = "could not get scope permissions"

var result []*PolicyRepresentation
resp, err := g.GetRequestWithBearerAuth(ctx, token).
SetResult(&result).
Get(g.getAdminRealmURL(realm, "clients", idOfClient, "authz", "resource-server", "scope", idOfScope, "permissions"))
if err := checkForError(resp, err, errMessage); err != nil {
return nil, err
}

return result, nil
}

// GetPermissionScopes returns a client's scopes configured for the given permission id
func (g *GoCloak) GetPermissionScopes(ctx context.Context, token, realm, idOfClient, permissionID string) ([]*PermissionScope, error) {
const errMessage = "could not get permission scopes"
Expand Down

0 comments on commit d77c788

Please sign in to comment.