callback_handler.go: assert correct args are passed to token exchange

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Andrew Keesler
2020-11-19 10:20:46 -05:00
parent 48e0250649
commit 2e62be3ebb
5 changed files with 173 additions and 118 deletions
+4 -3
View File
@@ -47,13 +47,14 @@ func NewHandler(idpListGetter oidc.IDPListGetter, oauthHelper fosite.OAuth2Provi
}
// Grant the openid scope only if it was requested.
// TODO: shouldn't we be potentially granting more scopes than just openid...
grantOpenIDScopeIfRequested(authorizeRequester)
_, idTokenClaims, err := upstreamIDPConfig.ExchangeAuthcodeAndValidateTokens(
r.Context(),
"TODO", // TODO use the upstream authcode (code param) here
"TODO", // TODO use the pkce value from the decoded state param here
"TODO", // TODO use the nonce value from the decoded state param here
r.URL.Query().Get("code"), // TODO: do we need to validate this?
state.PKCECode,
state.Nonce,
)
if err != nil {
return httperr.New(http.StatusBadGateway, "error exchanging and validating upstream tokens")