Skip to content

Commit

Permalink
Fall back to using sub if email is none (as in PR oauth2-proxy#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianv0 committed May 1, 2019
1 parent 68a074f commit d568cfa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ func (p *OAuthProxy) GetJwtSession(req *http.Request) (*providers.SessionState,
}

var claims struct {
Subject string `json:"sub"`
Email string `json:"email"`
Verified *bool `json:"email_verified"`
}
Expand All @@ -1049,7 +1050,7 @@ func (p *OAuthProxy) GetJwtSession(req *http.Request) (*providers.SessionState,
}

if claims.Email == "" {
return nil, fmt.Errorf("id_token did not contain an email")
claims.Email = claims.Subject
}

if claims.Verified != nil && !*claims.Verified {
Expand Down

0 comments on commit d568cfa

Please sign in to comment.