Skip to content

Commit

Permalink
Merge pull request #915 from jplana/fix_no_userinfo_endpoint
Browse files Browse the repository at this point in the history
Skip userinfo if provider doesn't support it.
  • Loading branch information
russjones authored Apr 11, 2017
2 parents 5d46d52 + 95c249f commit d46f4d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,10 @@ func claimsFromUserInfo(oidcClient *oidc.Client, issuerURL string, accessToken s
if err != nil {
return nil, trace.Wrap(err)
}
// If the provider doesn't offer a UserInfo endpoint don't err.
if pc.UserInfoEndpoint == nil {
return nil, nil
}
endpoint := pc.UserInfoEndpoint.String()
err = isHTTPS(endpoint)
if err != nil {
Expand Down Expand Up @@ -979,6 +983,11 @@ func (a *AuthServer) getClaims(oidcClient *oidc.Client, issuerURL string, code s
log.Debugf("[OIDC] Unable to fetch UserInfo claims: %v", err)
return nil, trace.Wrap(err)
}
if userInfoClaims == nil {
log.Warn("[OIDC] Provider doesn't offer UserInfo endpoint. Only token claims will be used.")
return idTokenClaims, nil
}

log.Debugf("[OIDC] UserInfo claims: %v", userInfoClaims)

// make sure that the subject in the userinfo claim matches the subject in
Expand Down

0 comments on commit d46f4d2

Please sign in to comment.