Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

Verify id token not access token #693

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
14 changes: 7 additions & 7 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,20 @@ func (r *oauthProxy) oauthCallbackHandler(w http.ResponseWriter, req *http.Reque
return
}

// step: check the id token is valid
if err = verifyToken(r.client, token); err != nil {
r.log.Error("unable to verify the id token", zap.Error(err))
r.accessForbidden(w, req)
return
}

access, id, err := parseToken(resp.AccessToken)
if err == nil {
token = access
identity = id
} else {
r.log.Warn("unable to parse the access token, using id token only", zap.Error(err))
}

// step: check the access token is valid
if err = verifyToken(r.client, token); err != nil {
r.log.Error("unable to verify the id token", zap.Error(err))
r.accessForbidden(w, req)
return
}
accessToken := token.Encode()

// step: are we encrypting the access token?
Expand Down