From 6f985ec61104def1b155f10742f95950b2cee1f6 Mon Sep 17 00:00:00 2001 From: Joel Unzain Date: Thu, 25 Jan 2018 15:04:35 -0800 Subject: [PATCH] Need to define metrics setter for validator --- src/glide.lock | 36 +++++++++++++++++++----------------- src/glide.yaml | 2 +- src/tr1d1um/tr1d1um.go | 18 +++++++++--------- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/glide.lock b/src/glide.lock index b560679f..25fc6e9c 100644 --- a/src/glide.lock +++ b/src/glide.lock @@ -1,5 +1,5 @@ -hash: 714353a67b5d0840d640483a31b05330bb4cb30c75aebb380f01ad7b94f8d42e -updated: 2018-01-25T13:40:05.780887129-08:00 +hash: 88a29a144a59f67dfd21467ebaf53c7838202f510509442cbd08ed3c1c18ddd3 +updated: 2018-01-25T15:03:05.691984-08:00 imports: - name: github.com/aws/aws-sdk-go version: 7be45195c3af1b54a609812f90c05a7e492e2491 @@ -38,7 +38,7 @@ imports: subpackages: - linux - name: github.com/Comcast/webpa-common - version: ff81f093033bfdf7c8d71b36697f9895026dc78b + version: f61a77521d8fbad863a4700fab405d688f979e3b subpackages: - concurrent - convey @@ -62,7 +62,7 @@ imports: subpackages: - spew - name: github.com/fsnotify/fsnotify - version: c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9 + version: 4da3e2cfbabc9f751898f250b49f2439785783a1 - name: github.com/go-ini/ini version: 32e4c1e6bc4e7d0d8451aa6b75200d19e37a536a - name: github.com/go-kit/kit @@ -90,7 +90,7 @@ imports: - name: github.com/go-stack/stack version: 817915b46b97fd7bb80e8ab6b69f01a53ac3eebf - name: github.com/golang/protobuf - version: 1e59b77b52bf8e4b449a57e6f79f21226d571845 + version: b50ceb1fa9818fa4d78b016c2d4ae025593a7ce3 subpackages: - proto - name: github.com/gorilla/context @@ -100,7 +100,7 @@ imports: - name: github.com/gorilla/websocket version: ea4d1f681babbce9545c9c5f3d5194a789c89f5b - name: github.com/hashicorp/hcl - version: 23c074d0eceb2b8a5bfdbb271ab780cde70f05a8 + version: a4b07c25de5ff55ad3b8936cea69a79a3d95a855 subpackages: - hcl/ast - hcl/parser @@ -111,7 +111,7 @@ imports: - json/scanner - json/token - name: github.com/influxdata/influxdb - version: 28f3912491a564677bfafc4602aa126023d1bfb2 + version: fd11e200c8b2e4d23c31945e330b2768b83d46f5 subpackages: - client/v2 - models @@ -125,15 +125,17 @@ imports: - name: github.com/kr/logfmt version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0 - name: github.com/magiconair/properties - version: 49d762b9817ba1c2e9d0c69183c2b4a8b8f1d934 + version: 51463bfca2576e06c62a8504b5c0f06d61312647 - name: github.com/matttproud/golang_protobuf_extensions version: c12348ce28de40eed0136aa2b644d0ee0650e56c subpackages: - pbutil - name: github.com/mitchellh/mapstructure - version: b4575eea38cca1123ec2dc90c26529b5c5acfcff + version: cc8532a8e9a55ea36402aa21efdf403a60d34096 +- name: github.com/pelletier/go-buffruneio + version: c37440a7cf42ac63b919c752ca73a85067e05992 - name: github.com/pelletier/go-toml - version: acdc4509485b587f5e675510c4f2c63e90ff68a8 + version: 23f644976aa7c724adf4aec911dadf4af17840ab - name: github.com/pmezard/go-difflib version: d8ed2627bdf02c080bf22230dbb337003b7aba2d subpackages: @@ -148,7 +150,7 @@ imports: subpackages: - go - name: github.com/prometheus/common - version: 89604d197083d4781071d3c65855d24ecfb0a563 + version: 2e54d0b93cba2fd133edc32211dcc32c06ef72ca subpackages: - expfmt - internal/bitbucket.org/ww/goautoneg @@ -164,13 +166,13 @@ imports: - jws - jwt - name: github.com/spf13/afero - version: bb8f1927f2a9d3ab41c9340aa034f6b803f4359c + version: 9be650865eab0c12963d8753212f4f9c66cdcf12 subpackages: - mem - name: github.com/spf13/cast version: acbeb36b902d72a7a4c18e8f3241075e7ab763e4 - name: github.com/spf13/jwalterweatherman - version: 7c0cea34c8ece3fbeb2b27ab9b59511d360fb394 + version: fa7ca7e836cf3a8bb4ebf799f472c12d7e903d66 - name: github.com/spf13/pflag version: e57e3eeb33f795204c1ca35f56c44f83227c6e66 - name: github.com/spf13/viper @@ -191,20 +193,20 @@ imports: - name: github.com/VividCortex/gohistogram version: 51564d9861991fb0ad0f531c99ef602d0f9866e6 - name: golang.org/x/net - version: 5ccada7d0a7ba9aeb5d3aca8d3501b4c2a509fec + version: d866cfc389cec985d6fda2859936a575a55a3ab6 subpackages: - netutil - name: golang.org/x/sys - version: af50095a40f9041b3b38960738837185c26e9419 + version: 9ccfe848b9db8435a24c424abbc07a921adf1df5 subpackages: - unix - name: golang.org/x/text - version: e19ae1496984b1c655b8044a65c0300a3c878dd3 + version: 470f45bf29f4147d6fbd7dfd0a02a848e49f5bf4 subpackages: - transform - unicode/norm - name: gopkg.in/natefinch/lumberjack.v2 version: a96e63847dc3c67d17befa69c303767e2f84e54f - name: gopkg.in/yaml.v2 - version: d670f9405373e636a5a2765eea47fac0c9bc91a4 + version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b testImports: [] diff --git a/src/glide.yaml b/src/glide.yaml index 5c753086..4fc3e913 100644 --- a/src/glide.yaml +++ b/src/glide.yaml @@ -2,6 +2,6 @@ package: . homepage: https://github.com/Comcast/tr1d1um import: - package: github.com/Comcast/webpa-common - version: ff81f093033bfdf7c8d71b36697f9895026dc78b + version: f61a77521d8fbad863a4700fab405d688f979e3b - package: github.com/go-ozzo/ozzo-validation version: v3.3 diff --git a/src/tr1d1um/tr1d1um.go b/src/tr1d1um/tr1d1um.go index 7ca1d9f3..49af65ad 100644 --- a/src/tr1d1um/tr1d1um.go +++ b/src/tr1d1um/tr1d1um.go @@ -275,6 +275,8 @@ func GetValidator(v *viper.Viper, m *secure.JWTValidationMeasures) (validator se validators := make(secure.Validators, 0, len(jwtVals)) for _, validatorDescriptor := range jwtVals { + validatorDescriptor.Custom.DefineMeasures(m) + var keyResolver key.Resolver keyResolver, err = validatorDescriptor.Keys.NewResolver() if err != nil { @@ -282,16 +284,14 @@ func GetValidator(v *viper.Viper, m *secure.JWTValidationMeasures) (validator se return } - validatorDescriptor.Custom.DefineMeasures(m) + validator := secure.JWSValidator{ + DefaultKeyId: DefaultKeyID, + Resolver: keyResolver, + JWTValidators: []*jwt.Validator{validatorDescriptor.Custom.New()}, + } - validators = append( - validators, - secure.JWSValidator{ - DefaultKeyId: DefaultKeyID, - Resolver: keyResolver, - JWTValidators: []*jwt.Validator{validatorDescriptor.Custom.New()}, - }, - ) + validator.DefineMeasures(m) + validators = append(validators, validator) } basicAuth := v.GetStringSlice("authHeader")