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 Jun 17, 2019
1 parent 79acef9 commit 58b06ce
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 @@ -901,6 +901,7 @@ func (p *OAuthProxy) GetJwtSession(req *http.Request) (*sessionsapi.SessionState
}

var claims struct {
Subject string `json:"sub"`
Email string `json:"email"`
Verified *bool `json:"email_verified"`
}
Expand All @@ -910,7 +911,7 @@ func (p *OAuthProxy) GetJwtSession(req *http.Request) (*sessionsapi.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 58b06ce

Please sign in to comment.