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

GetClientxxx functions should take the ClientID instead of the internal uuid ID #357

Open
adamwoolhether opened this issue Jun 22, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@adamwoolhether
Copy link

adamwoolhether commented Jun 22, 2022

Describe the bug
The API to run GetClientxxx methods is unnecessarily clunky.

I realize this is not necessarily a bug, but i'm having trouble understanding logic behind the current implementation, which makes for an overly verbose operation, when considering that the "clientid" parameter is unique in KeyCloak.

To Reproduce
Try to get a client's secret with the Client ID:

creds, err := client.GetClientSecret(ctx.Background, token.AccessToken, "master", "my-client")
if err != nil {
	panic(err)
}

Expected behavior
This should return the client secret of the client with the client ID of "my-client"

Additional context
Instead, we have to first define a string, run GetClients with the pointer of the string, and then run GetClientSecret with a dereferenced pointer of the first index of the response from GetClients

clientName := "my-client"
c, err := client.GetClients(ctx, token.AccessToken, "master", gocloak.GetClientsParams{ClientID: &clientName})
if err != nil {
	panic(err)
}

creds, err := client.GetClientSecret(ctx, token.AccessToken, "master", *c[0].ID)
if err != nil {
	panic(err)
}
@Nerzal Nerzal added the enhancement New feature or request label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants