Skip to content

Commit

Permalink
Add support for get client scope permissions
Browse files Browse the repository at this point in the history
Add the permissions request for a client scope
  • Loading branch information
ncthompson committed Oct 29, 2024
1 parent fec0d9e commit 4ea810d
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 @@ -3721,6 +3721,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 4ea810d

Please sign in to comment.