From ffd13ec6835453525fef1255b56ddbdc3b6142b2 Mon Sep 17 00:00:00 2001 From: ARUNANGSHU CHATTERJEE Date: Fri, 31 Mar 2023 23:13:42 +0000 Subject: [PATCH] Fix ctxSetSession signature for sitekey change --- gateway/mw_jwt.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gateway/mw_jwt.go b/gateway/mw_jwt.go index 97963382fee..a2f8efbbf9f 100644 --- a/gateway/mw_jwt.go +++ b/gateway/mw_jwt.go @@ -240,9 +240,9 @@ func (k *JWTMiddleware) getSecretToVerifySignature(r *http.Request, token *jwt.T session, rawKeyExists := k.CheckSessionAndIdentityForValidKey(tykId, r) tykId = session.KeyID if !rawKeyExists { - //Cisco change to try search "sitekey-" + // Cisco change to try search "sitekey-" sitekey := "sitekey-" + tykId - session, siteKeyExists := k.CheckSessionAndIdentityForValidKey(&sitekey, r) + session, siteKeyExists := k.CheckSessionAndIdentityForValidKey(sitekey, r) if !siteKeyExists { return nil, errors.New("token invalid, key not found") } else { @@ -654,16 +654,16 @@ func (k *JWTMiddleware) processOneToOneTokenMap(r *http.Request, token *jwt.Toke tykId = session.KeyID if !exists { - //Cisco change to try search "sitekey-" + // Cisco change to try search "sitekey-" sitekey := "sitekey-" + tykId k.Logger().Debug("Using sitekey ID: ", sitekey) - session, siteKeyExists := k.CheckSessionAndIdentityForValidKey(&sitekey, r) + session, siteKeyExists := k.CheckSessionAndIdentityForValidKey(sitekey, r) if !siteKeyExists { k.reportLoginFailure(tykId, r) return errors.New("Key not authorized"), http.StatusForbidden } else { k.Logger().Debug("sitekey ID found.") - ctxSetSession(r, &session, sitekey, false) + ctxSetSession(r, &session, false, k.Gw.GetConfig().HashKeys) ctxSetJWTContextVars(k.Spec, r, token) return nil, http.StatusOK }