mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -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"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
@ -83,11 +84,12 @@ func (k *KeycloakProvider) LoginWithClientID(clientID, clientSecret string) erro
|
|||||||
|
|
||||||
// LookupUser lookup user by their userid.
|
// LookupUser lookup user by their userid.
|
||||||
func (k *KeycloakProvider) LookupUser(userid string) (User, error) {
|
func (k *KeycloakProvider) LookupUser(userid string) (User, error) {
|
||||||
lookupUserID := k.adminURL + "/realms" + k.realm + "/users/" + userid
|
req, err := http.NewRequest(http.MethodGet, k.adminURL, nil)
|
||||||
req, err := http.NewRequest(http.MethodGet, lookupUserID, nil)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return User{}, err
|
return User{}, err
|
||||||
}
|
}
|
||||||
|
req.URL.Path = path.Join(req.URL.Path, "realms", k.realm, "users", userid)
|
||||||
|
|
||||||
k.Lock()
|
k.Lock()
|
||||||
accessToken := k.accessToken
|
accessToken := k.accessToken
|
||||||
k.Unlock()
|
k.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user