From 9efebcf1ff56625a2129e09ab56cfe113fd560f6 Mon Sep 17 00:00:00 2001 From: Alex Ashley Date: Wed, 22 May 2019 21:01:47 -0500 Subject: [PATCH 1/2] Allow for using the password grant with a confidential client --- keycloak/keycloak_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keycloak/keycloak_client.go b/keycloak/keycloak_client.go index f131a97f9..0b4d2809d 100644 --- a/keycloak/keycloak_client.go +++ b/keycloak/keycloak_client.go @@ -43,13 +43,13 @@ func NewKeycloakClient(baseUrl, clientId, clientSecret, realm, username, passwor } clientCredentials := &ClientCredentials{ ClientId: clientId, + ClientSecret: clientSecret, } 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") From d8c263add32482daebe7f071327354258c1756ff Mon Sep 17 00:00:00 2001 From: Alex Ashley Date: Wed, 22 May 2019 21:06:24 -0500 Subject: [PATCH 2/2] go fmt --- keycloak/keycloak_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keycloak/keycloak_client.go b/keycloak/keycloak_client.go index 0b4d2809d..7906e2c43 100644 --- a/keycloak/keycloak_client.go +++ b/keycloak/keycloak_client.go @@ -42,7 +42,7 @@ func NewKeycloakClient(baseUrl, clientId, clientSecret, realm, username, passwor Timeout: time.Second * 5, } clientCredentials := &ClientCredentials{ - ClientId: clientId, + ClientId: clientId, ClientSecret: clientSecret, } if password != "" && username != "" {