mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
use keycloak_realm properly for keycloak user lookups (#14401)
In case a user-defined a value for the MINIO_IDENTITY_OPENID_KEYCLOAK_REALM environment variable, construct the path properly.
This commit is contained in:
parent
2cea944cdb
commit
5307e18085
@ -23,6 +23,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
@ -83,11 +84,12 @@ func (k *KeycloakProvider) LoginWithClientID(clientID, clientSecret string) erro
|
||||
|
||||
// LookupUser lookup user by their userid.
|
||||
func (k *KeycloakProvider) LookupUser(userid string) (User, error) {
|
||||
lookupUserID := k.adminURL + "/realms" + k.realm + "/users/" + userid
|
||||
req, err := http.NewRequest(http.MethodGet, lookupUserID, nil)
|
||||
req, err := http.NewRequest(http.MethodGet, k.adminURL, nil)
|
||||
if err != nil {
|
||||
return User{}, err
|
||||
}
|
||||
req.URL.Path = path.Join(req.URL.Path, "realms", k.realm, "users", userid)
|
||||
|
||||
k.Lock()
|
||||
accessToken := k.accessToken
|
||||
k.Unlock()
|
||||
|
Loading…
Reference in New Issue
Block a user