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

Commit

Permalink
Verify id token not access token
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavol Ipoth committed Nov 12, 2020
1 parent b043dea commit fe7edee
Showing 1 changed file with 7 additions and 7 deletions.
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

0 comments on commit fe7edee

Please sign in to comment.