Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip userinfo if provider doesn't support it. #915

Merged
merged 3 commits into from
Apr 11, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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