@@ -28,6 +28,9 @@ const (
2828 microsoftGraphUSHost = "graph.microsoft.us"
2929 microsoftGraphAPIVersion = "/v1.0"
3030
31+ // Microsoft Graph API paths for group membership information
32+ getMemberObjectsPath = "/me/getMemberObjects"
33+
3134 // Distributed claim fields
3235 claimNamesField = "_claim_names"
3336 claimSourcesField = "_claim_sources"
@@ -70,10 +73,11 @@ func (a *AzureProvider) FetchGroups(_ context.Context, b *jwtAuthBackend, allCla
7073 if err != nil {
7174 return nil , fmt .Errorf ("unable to create CA Context: %s" , err )
7275 }
73- groups , err := a .getAzureGroups (a . buildGraphEndpoint ( "me/getMemberObjects" ), tokenSource )
76+ groups , err := a .getAzureGroups (fmt . Sprintf ( "https://%s%s%s" , microsoftGraphHost , microsoftGraphAPIVersion , getMemberObjectsPath ), tokenSource )
7477 if err != nil {
7578 return nil , fmt .Errorf ("unable to fetch groups from Microsoft Graph API: %s" , err )
7679 }
80+ b .Logger ().Debug (fmt .Sprintf ("groups from Microsoft Graph API: %v" , groups ))
7781 return groups , nil
7882 }
7983
@@ -158,11 +162,6 @@ func (a *AzureProvider) getClaimSource(logger log.Logger, allClaims map[string]i
158162 return urlParsed .String (), nil
159163}
160164
161- // buildGraphEndpoint constructs a Microsoft Graph API endpoint URL
162- func (a * AzureProvider ) buildGraphEndpoint (path string ) string {
163- return fmt .Sprintf ("https://%s%s/%s" , microsoftGraphHost , microsoftGraphAPIVersion , path )
164- }
165-
166165// Fetch user groups from the Microsoft Graph API
167166func (a * AzureProvider ) getAzureGroups (groupsURL string , tokenSource oauth2.TokenSource ) (interface {}, error ) {
168167 urlParsed , err := url .Parse (groupsURL )
0 commit comments