(cherry picked from commit 3049534c40)
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
co-authored by
Gabriel MABILLE
parent
f591c64661
commit
77dccd54ca
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -214,9 +215,11 @@ func extractGroups(client *http.Client, claims azureClaims, token *oauth2.Token)
|
|||||||
if res.StatusCode != http.StatusOK {
|
if res.StatusCode != http.StatusOK {
|
||||||
if res.StatusCode == http.StatusForbidden {
|
if res.StatusCode == http.StatusForbidden {
|
||||||
logger.Warn("AzureAD OAuh: Token need GroupMember.Read.All permission to fetch all groups")
|
logger.Warn("AzureAD OAuh: Token need GroupMember.Read.All permission to fetch all groups")
|
||||||
return []string{}, nil
|
} else {
|
||||||
|
body, _ := io.ReadAll(res.Body)
|
||||||
|
logger.Warn("AzureAD OAuh: could not fetch user groups", "code", res.StatusCode, "body", string(body))
|
||||||
}
|
}
|
||||||
return nil, errors.New("error fetching groups")
|
return []string{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var body getAzureGroupResponse
|
var body getAzureGroupResponse
|
||||||
|
|||||||
Reference in New Issue
Block a user