Closed HarikrishnanBalagopal closed 2 years ago
Is this query param available for more than one request?
@Nerzal yes, searching around for briefRepresentation
in https://www.keycloak.org/docs-api/15.0/rest-api/index.html
gives 16 endpoints:
GET /{realm}/groups/{id}/role-mappings/clients/{client}/composite
GET /{realm}/users/{id}/role-mappings/clients/{client}/composite
GET /{realm}/groups
GET /{realm}/groups/{id}/members
GET /{realm}/groups/{id}/role-mappings/realm/composite
GET /{realm}/users/{id}/role-mappings/realm/composite
GET /{realm}/clients/{id}/roles
GET /{realm}/clients/{id}/roles/{role-name}/groups
GET /{realm}/roles
GET /{realm}/roles/{role-name}/groups
GET /{realm}/client-scopes/{id}/scope-mappings/clients/{client}/composite
GET /{realm}/client-scopes/{id}/scope-mappings/realm/composite
GET /{realm}/clients/{id}/scope-mappings/clients/{client}/composite
GET /{realm}/clients/{id}/scope-mappings/realm/composite
GET /{realm}/users
GET /{realm}/users/{id}/groups
Okay so for the solution it feels like being able to control this param per request feels more natural. Are you aware of any similar params, that we might not have implemented yet?
We might want to add an optional parameter to these functions and hand in a param struct/map/whatever, which could contain all of these params, that we know
Another solution is to add a functional option that allows the user to set a custom resty
client when constructing a gocloak
client.
This way the user can set a custom resty
client that manipulates the request before it is sent out.
This is a more generic solution but it may not be the most user friendly.
That is already possible, as that function returns a pointer.
func (client *gocloak) RestyClient() *resty.Client { return client.restyClient }
But that is a too complicated usecase for a feature, that feels like it should be "natively" supported by this library.
Are you aware of any similar params, that we might not have implemented yet?
There are some endpoints like POST /{realm}/user-storage/{parentId}/mappers/{id}/sync
which aren't exposed by this library.
It takes a direction
query parameter.
Other than that I am not sure.
That is already possible, as that function returns a pointer.
Oh nice!
But that is a too complicated usecase for a feature, that feels like it should be "natively" supported by this library.
Yes for this issue it would be too complicated, but being able to set a custom resty client can be useful. Usecases:
@Nerzal has this issue been fixed by commit ae82f6cd6f24e28502a100cc3099ef1b8af421e6 ?
https://github.com/Nerzal/gocloak/commit/ae82f6cd6f24e28502a100cc3099ef1b8af421e6#diff-4b667feae66c9d46b21b9ecc19e8958cf4472d162ce0a47ac3e8386af8bbd8cfR1414 https://github.com/Nerzal/gocloak/commit/ae82f6cd6f24e28502a100cc3099ef1b8af421e6#diff-72487d6e423e37c0af7994baddca95c1e2acc7e7ca51b8d13d03caa8e4485a16R348
Made by PRs: https://github.com/Nerzal/gocloak/pull/285 https://github.com/Nerzal/gocloak/pull/314
I made this issue while this library was on v8. It seems in v10 the signature was changed and the function now takes a struct to allow additional query parameters:
roleInfos, err := common.AuthServerClient.GetClientRoles(context.TODO(), accessToken, realm, clientIdNotClientId, gocloak.GetRoleParams{BriefRepresentation: &brief})
This allows to return non-brief representation including role attributes.
at first glance it looks like we have fixed the issues.
Is your feature request related to a problem? Please describe. See https://github.com/Nerzal/gocloak/issues/216
Describe the solution you'd like Change the function signature of
GetCompositeClientRolesByUserID
and other similar functions to allow setting the query parameter.Describe alternatives you've considered Could possibly add a way to specify this and other common query parameters when constructing a new client
Additional context The java library already exposes the query parameter: https://stackoverflow.com/questions/63116643/keycloak-can-not-get-attributes-of-a-role