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

Allow for using the password grant with a confidential client #114

Merged
merged 3 commits into from Jun 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions keycloak/keycloak_client.go
Expand Up @@ -42,14 +42,14 @@ func NewKeycloakClient(baseUrl, clientId, clientSecret, realm, username, passwor
Timeout: time.Second * 5,
}
clientCredentials := &ClientCredentials{
ClientId: clientId,
ClientId: clientId,
ClientSecret: clientSecret,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The zero value for a string is the empty string, so this shouldn't affect public clients.

}
if password != "" && username != "" {
clientCredentials.Username = username
clientCredentials.Password = password
clientCredentials.GrantType = "password"
} else if clientSecret != "" {
clientCredentials.ClientSecret = clientSecret
clientCredentials.GrantType = "client_credentials"
} else {
return nil, fmt.Errorf("must specify client id, username and password for password grant, or client id and secret for client credentials grant")
Expand Down