diff --git a/gateway/mw_jwt.go b/gateway/mw_jwt.go index 0d05ea511fb..d85a5f73440 100644 --- a/gateway/mw_jwt.go +++ b/gateway/mw_jwt.go @@ -229,9 +229,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 { @@ -643,16 +643,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 } diff --git a/go.mod b/go.mod index 6e93b10ac0a..0a296945d86 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,8 @@ module github.com/TykTechnologies/tyk -go 1.16 +go 1.17 require ( - github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect github.com/Jeffail/gabs v1.4.0 github.com/Jeffail/tunny v0.1.4 github.com/Masterminds/sprig/v3 v3.2.2 @@ -24,48 +23,36 @@ require ( github.com/buger/jsonparser v1.1.1 github.com/cenk/backoff v2.2.1+incompatible github.com/cenkalti/backoff/v4 v4.0.2 - github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 // indirect github.com/clbanning/mxj v1.8.4 github.com/evalphobia/logrus_sentry v0.8.2 - github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect github.com/garyburd/redigo v1.6.4 github.com/gemnasium/logrus-graylog-hook v2.0.7+incompatible github.com/getkin/kin-openapi v0.89.0 - github.com/getsentry/raven-go v0.2.0 // indirect github.com/go-redis/redis/v8 v8.11.5 github.com/gocraft/health v0.0.0-20170925182251-8675af27fef0 github.com/gofrs/uuid v3.3.0+incompatible github.com/golang-jwt/jwt/v4 v4.4.2 github.com/golang/protobuf v1.5.2 - github.com/google/uuid v1.3.0 // indirect github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.5.0 github.com/hashicorp/consul/api v1.3.0 - github.com/hashicorp/go-msgpack v0.5.4 // indirect github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-retryablehttp v0.5.4 github.com/hashicorp/go-version v1.4.0 github.com/hashicorp/vault/api v1.0.4 - github.com/huandu/xstrings v1.3.2 // indirect - github.com/imdario/mergo v0.3.12 // indirect github.com/jensneuse/abstractlogger v0.0.4 github.com/justinas/alice v1.2.0 github.com/kelseyhightower/envconfig v1.4.0 - github.com/lonelycode/go-uuid v0.0.0-20141202165402-ed3ca8a15a93 // indirect github.com/lonelycode/osin v0.0.0-20160423095202-da239c9dacb6 - github.com/mavricknz/asn1-ber v0.0.0-20151103223136-b9df1c2f4213 // indirect github.com/mavricknz/ldap v0.0.0-20160227184754-f5a958005e43 github.com/miekg/dns v1.0.14 - github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.4.1 - github.com/nats-io/nats-server/v2 v2.3.4 // indirect github.com/newrelic/go-agent v2.13.0+incompatible github.com/nsf/jsondiff v0.0.0-20210303162244-6ea32392771e // test github.com/opentracing/opentracing-go v1.2.0 github.com/openzipkin/zipkin-go v0.2.2 github.com/oschwald/maxminddb-golang v1.5.0 github.com/paulbellamy/ratecounter v0.2.0 - github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect github.com/pires/go-proxyproto v0.0.0-20190615163442-2c19fd512994 github.com/pmylund/go-cache v2.1.0+incompatible github.com/robertkrimen/otto v0.0.0-20180617131154-15f95af6e78d @@ -75,26 +62,128 @@ require ( github.com/square/go-jose v2.4.1+incompatible github.com/stretchr/testify v1.8.1 // test github.com/uber/jaeger-client-go v2.30.1-0.20220110192849-8d8e8fcfd04d+incompatible - github.com/uber/jaeger-lib v2.4.2-0.20210604143007-135cf5605a6d+incompatible // indirect github.com/valyala/fasthttp v1.43.0 // test github.com/vmihailenco/msgpack v4.0.4+incompatible - github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonschema v1.2.0 golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 - golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect golang.org/x/net v0.0.0-20220906165146-f3363e06e74c golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 google.golang.org/grpc v1.36.0 google.golang.org/grpc/examples v0.0.0-20220317213542-f95b001a48df // test gopkg.in/alecthomas/kingpin.v2 v2.2.6 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 - gopkg.in/sourcemap.v1 v1.0.5 // indirect gopkg.in/vmihailenco/msgpack.v2 v2.9.1 gopkg.in/xmlpath.v2 v2.0.0-20150820204837-860cbeca3ebc - gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) +require ( + github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver v1.5.0 // indirect + github.com/Masterminds/semver/v3 v3.1.1 // indirect + github.com/Masterminds/sprig v2.22.0+incompatible // indirect + github.com/Shopify/sarama v1.29.1 // indirect + github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect + github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect + github.com/andybalholm/brotli v1.0.4 // indirect + github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect + github.com/asyncapi/converter-go v0.0.0-20190802111537-d8459b2bd403 // indirect + github.com/asyncapi/parser-go v0.4.2 // indirect + github.com/asyncapi/spec-json-schemas/v2 v2.14.0 // indirect + github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/eapache/go-resiliency v1.2.0 // indirect + github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect + github.com/eapache/queue v1.1.0 // indirect + github.com/eclipse/paho.mqtt.golang v1.2.0 // indirect + github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/getsentry/raven-go v0.2.0 // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/swag v0.19.5 // indirect + github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee // indirect + github.com/gobwas/pool v0.2.0 // indirect + github.com/gobwas/ws v1.0.4 // indirect + github.com/golang/snappy v0.0.3 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.1 // indirect + github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/go-msgpack v0.5.4 // indirect + github.com/hashicorp/go-rootcerts v1.0.1 // indirect + github.com/hashicorp/go-sockaddr v1.0.2 // indirect + github.com/hashicorp/go-uuid v1.0.2 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/serf v0.8.2 // indirect + github.com/hashicorp/vault/sdk v0.1.13 // indirect + github.com/huandu/xstrings v1.3.2 // indirect + github.com/iancoleman/strcase v0.2.0 // indirect + github.com/imdario/mergo v0.3.12 // indirect + github.com/jcmturner/aescts/v2 v2.0.0 // indirect + github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect + github.com/jcmturner/gofork v1.0.0 // indirect + github.com/jcmturner/gokrb5/v8 v8.4.2 // indirect + github.com/jcmturner/rpc/v2 v2.0.3 // indirect + github.com/jensneuse/byte-template v0.0.0-20200214152254-4f3cf06e5c68 // indirect + github.com/jensneuse/pipeline v0.0.0-20200117120358-9fb4de085cd6 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.1 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/klauspost/compress v1.15.9 // indirect + github.com/lonelycode/go-uuid v0.0.0-20141202165402-ed3ca8a15a93 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mavricknz/asn1-ber v0.0.0-20151103223136-b9df1c2f4213 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/nats-io/nats-server/v2 v2.3.4 // indirect + github.com/nats-io/nats.go v1.11.1-0.20210623165838-4b75fc59ae30 // indirect + github.com/nats-io/nkeys v0.3.0 // indirect + github.com/nats-io/nuid v1.0.1 // indirect + github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect + github.com/pierrec/lz4 v2.6.0+incompatible // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/qri-io/jsonpointer v0.1.1 // indirect + github.com/qri-io/jsonschema v0.2.1 // indirect + github.com/r3labs/sse/v2 v2.8.1 // indirect + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect + github.com/ryanuber/go-glob v1.0.0 // indirect + github.com/shopspring/decimal v1.2.0 // indirect + github.com/spf13/cast v1.3.1 // indirect + github.com/tidwall/gjson v1.11.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/sjson v1.0.4 // indirect + github.com/uber/jaeger-lib v2.4.2-0.20210604143007-135cf5605a6d+incompatible // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.18.1 // indirect + golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect + golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect + golang.org/x/text v0.3.7 // indirect + golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/appengine v1.6.5 // indirect + google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98 // indirect + google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect + gopkg.in/sourcemap.v1 v1.0.5 // indirect + gopkg.in/square/go-jose.v2 v2.3.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gorm.io/gorm v1.21.10 // indirect + nhooyr.io/websocket v1.8.7 // indirect +) + replace gorm.io/gorm => github.com/TykTechnologies/gorm v1.20.7-0.20210409171139-b5c340f85ed0 //replace github.com/TykTechnologies/graphql-go-tools => ../graphql-go-tools