Skip to content

Commit

Permalink
re-enable GraphService using preferred_username
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Jacob Muller committed Mar 16, 2019
1 parent 846f4ef commit 26e62b7
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions internal/auth/providers/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ func (p *AzureV2Provider) Redeem(redirectURL, code string) (*sessions.SessionSta

// Extract custom claims.
var claims struct {
Email string `json:"email"`
UPN string `json:"upn"`
Nonce string `json:"nonce"`
Email string `json:"email"`
UPN string `json:"upn"`
Nonce string `json:"nonce"`
PreferredUsername string `json:"preferred_username"`
}
if err := idToken.Claims(&claims); err != nil {
return nil, fmt.Errorf("failed to parse id_token claims: %v", err)
Expand Down Expand Up @@ -138,15 +139,13 @@ func (p *AzureV2Provider) Redeem(redirectURL, code string) (*sessions.SessionSta
User: claims.UPN,
}

/*
if p.GraphService != nil {
groupNames, err := p.GraphService.GetGroups(claims.Email)
if err != nil {
return nil, fmt.Errorf("could not get groups: %v", err)
}
s.Groups = groupNames
if p.GraphService != nil {
groupNames, err := p.GraphService.GetGroups(claims.PreferredUsername)
if err != nil {
return nil, fmt.Errorf("could not get groups: %v", err)
}
*/
s.Groups = groupNames
}

return s, nil
}
Expand Down

0 comments on commit 26e62b7

Please sign in to comment.