From 3f6a57f14d1b9aedd92d73f0b503e0864dee1ac7 Mon Sep 17 00:00:00 2001 From: Mike Mondragon Date: Thu, 18 May 2023 09:03:56 -0700 Subject: [PATCH] Correct okta-jwt-verifier-golang version reference to v2 Closes #97 --- CHANGELOG.md | 6 +++++ README.md | 8 +++--- adaptors/lestrratGoJwx/lestrratGoJwx.go | 4 +-- discovery/oidc/oidc.go | 2 +- go.mod | 27 +++++++++++++------ go.sum | 35 ------------------------- jwtverifier.go | 12 ++++----- jwtverifier_test.go | 6 ++--- utils/cache_example_test.go | 4 +-- utils/cache_test.go | 2 +- 10 files changed, 44 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a8eac4..e6fa390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v2.0.2 (May 18th, 2023) + +### Updates: + +* Correct okta-jwt-verifier-golang version reference to v2 [#101](https://github.com/okta/okta-jwt-verifier-golang/pull/101) + ## v2.0.1 (May 15th, 2023) ### Enhancements: diff --git a/README.md b/README.md index c710e99..ad0724c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This library was built to keep configuration to a minimum. To get it running at #### Access Token Validation ```go -import "github.com/okta/okta-jwt-verifier-golang" +import "github.com/okta/okta-jwt-verifier-golang/v2" toValidate := map[string]string{} toValidate["aud"] = "api://default" @@ -46,7 +46,7 @@ token, err := verifier.VerifyAccessToken("{JWT}") #### Id Token Validation ```go -import "github.com/okta/okta-jwt-verifier-golang" +import "github.com/okta/okta-jwt-verifier-golang/v2" toValidate := map[string]string{} toValidate["nonce"] = "{NONCE}" @@ -112,7 +112,7 @@ The below utilities are available in this package that can be used for Authentic **Nonce Generator** ```go -import jwtUtils "github.com/okta/okta-jwt-verifier-golang/utils" +import jwtUtils "github.com/okta/okta-jwt-verifier-golang/v2/utils" nonce, err := jwtUtils.GenerateNonce() ``` @@ -120,7 +120,7 @@ nonce, err := jwtUtils.GenerateNonce() **PKCE Code Verifier and Challenge Generator** ```go -import jwtUtils "github.com/okta/okta-jwt-verifier-golang/utils" +import jwtUtils "github.com/okta/okta-jwt-verifier-golang/v2/utils" codeVerifier, err := jwtUtils.GenerateCodeVerifier() // or diff --git a/adaptors/lestrratGoJwx/lestrratGoJwx.go b/adaptors/lestrratGoJwx/lestrratGoJwx.go index 9242974..c405412 100644 --- a/adaptors/lestrratGoJwx/lestrratGoJwx.go +++ b/adaptors/lestrratGoJwx/lestrratGoJwx.go @@ -25,8 +25,8 @@ import ( "github.com/lestrrat-go/jwx/jwk" "github.com/lestrrat-go/jwx/jws" - "github.com/okta/okta-jwt-verifier-golang/adaptors" - "github.com/okta/okta-jwt-verifier-golang/utils" + "github.com/okta/okta-jwt-verifier-golang/v2/adaptors" + "github.com/okta/okta-jwt-verifier-golang/v2/utils" ) func (lgj *LestrratGoJwx) fetchJwkSet(jwkUri string) (interface{}, error) { diff --git a/discovery/oidc/oidc.go b/discovery/oidc/oidc.go index d1aef5f..deb97ae 100644 --- a/discovery/oidc/oidc.go +++ b/discovery/oidc/oidc.go @@ -16,7 +16,7 @@ package oidc -import "github.com/okta/okta-jwt-verifier-golang/discovery" +import "github.com/okta/okta-jwt-verifier-golang/v2/discovery" type Oidc struct { wellKnownUrl string diff --git a/go.mod b/go.mod index 657623c..6557fbf 100644 --- a/go.mod +++ b/go.mod @@ -1,14 +1,25 @@ -module github.com/okta/okta-jwt-verifier-golang +module github.com/okta/okta-jwt-verifier-golang/v2 + +go 1.19 require ( - github.com/jarcoal/httpmock v1.1.0 // indirect - github.com/lestrrat-go/codegen v1.0.0 // indirect + github.com/jarcoal/httpmock v1.1.0 github.com/lestrrat-go/jwx v1.2.18 - github.com/lestrrat-go/pdebug/v3 v3.0.1 // indirect github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 - github.com/stretchr/testify v1.7.1 // indirect - golang.org/x/mod v0.4.1 // indirect - golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963 // indirect + github.com/stretchr/testify v1.7.1 ) -go 1.15 +require ( + github.com/davecgh/go-spew v1.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d // indirect + github.com/goccy/go-json v0.9.4 // indirect + github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect + github.com/lestrrat-go/blackmagic v1.0.0 // indirect + github.com/lestrrat-go/httpcc v1.0.0 // indirect + github.com/lestrrat-go/iter v1.0.1 // indirect + github.com/lestrrat-go/option v1.0.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/crypto v0.0.0-20201217014255-9d1352758620 // indirect + gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect +) diff --git a/go.sum b/go.sum index 4b25209..81c188d 100644 --- a/go.sum +++ b/go.sum @@ -3,34 +3,22 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d h1:1iy2qD6JEhHKKhUOA9IWs7mjco7lnw2qx8FsRI2wirE= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= -github.com/goccy/go-json v0.3.5 h1:HqrLjEWx7hD62JRhBh+mHv+rEEzBANIu6O0kbDlaLzU= -github.com/goccy/go-json v0.3.5/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.9.4 h1:L8MLKG2mvVXiQu07qB6hmfqeSYQdOnqPot2GhsIwIaI= github.com/goccy/go-json v0.9.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/jarcoal/httpmock v1.1.0 h1:F47ChZj1Y2zFsCXxNkBPwNNKnAyOATcdQibk0qEdVCE= github.com/jarcoal/httpmock v1.1.0/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/lestrrat-go/backoff/v2 v2.0.7 h1:i2SeK33aOFJlUNJZzf2IpXRBvqBBnaGXfY5Xaop/GsE= -github.com/lestrrat-go/backoff/v2 v2.0.7/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A= github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= github.com/lestrrat-go/blackmagic v1.0.0 h1:XzdxDbuQTz0RZZEmdU7cnQxUtFUzgCSPq8RCz4BxIi4= github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= -github.com/lestrrat-go/codegen v1.0.0/go.mod h1:JhJw6OQAuPEfVKUCLItpaVLumDGWQznd1VaXrBk9TdM= github.com/lestrrat-go/httpcc v1.0.0 h1:FszVC6cKfDvBKcJv646+lkh4GydQg2Z29scgUfkOpYc= github.com/lestrrat-go/httpcc v1.0.0/go.mod h1:tGS/u00Vh5N6FHNkExqGGNId8e0Big+++0Gf8MBnAvE= -github.com/lestrrat-go/iter v1.0.0 h1:QD+hHQPDSHC4rCJkZYY/yXChYr/vjfBopKekTc+7l4Q= -github.com/lestrrat-go/iter v1.0.0/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= github.com/lestrrat-go/iter v1.0.1 h1:q8faalr2dY6o8bV45uwrxq12bRa1ezKrB6oM9FUgN4A= github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= -github.com/lestrrat-go/jwx v1.1.1 h1:L7TqffHhO0qSyUcDGfCkDV42GQMp9fNOBi/zFOigMEY= -github.com/lestrrat-go/jwx v1.1.1/go.mod h1:vn9FzD6gJtKkgYs7RTKV7CjWtEka8F/voUollhnn4QE= github.com/lestrrat-go/jwx v1.2.18 h1:RV4hcTRUlPVYUnGqATKXEojoOsLexoU8Na4KheVzxQ8= github.com/lestrrat-go/jwx v1.2.18/go.mod h1:bWTBO7IHHVMtNunM8so9MT8wD+euEY1PzGEyCnuI2qM= -github.com/lestrrat-go/option v0.0.0-20210103042652-6f1ecfceda35/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= -github.com/lestrrat-go/pdebug/v3 v3.0.1 h1:3G5sX/aw/TbMTtVc9U7IHBWRZtMvwvBziF1e4HoQtv8= -github.com/lestrrat-go/pdebug/v3 v3.0.1/go.mod h1:za+m+Ve24yCxTEhR59N7UlnJomWwCiIqbJRmKeiADU4= github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 h1:pSCLCl6joCFRnjpeojzOpEYs4q7Vditq8fySFG5ap3Y= github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -39,41 +27,18 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201217014255-9d1352758620 h1:3wPMTskHO3+O6jqTEXyFcsnuxMQOqYSaHsDxcbUXpqA= golang.org/x/crypto v0.0.0-20201217014255-9d1352758620/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/jwtverifier.go b/jwtverifier.go index 22a1f1d..c22eff3 100644 --- a/jwtverifier.go +++ b/jwtverifier.go @@ -25,12 +25,12 @@ import ( "strings" "time" - "github.com/okta/okta-jwt-verifier-golang/adaptors" - "github.com/okta/okta-jwt-verifier-golang/adaptors/lestrratGoJwx" - "github.com/okta/okta-jwt-verifier-golang/discovery" - "github.com/okta/okta-jwt-verifier-golang/discovery/oidc" - "github.com/okta/okta-jwt-verifier-golang/errors" - "github.com/okta/okta-jwt-verifier-golang/utils" + "github.com/okta/okta-jwt-verifier-golang/v2/adaptors" + "github.com/okta/okta-jwt-verifier-golang/v2/adaptors/lestrratGoJwx" + "github.com/okta/okta-jwt-verifier-golang/v2/discovery" + "github.com/okta/okta-jwt-verifier-golang/v2/discovery/oidc" + "github.com/okta/okta-jwt-verifier-golang/v2/errors" + "github.com/okta/okta-jwt-verifier-golang/v2/utils" ) var ( diff --git a/jwtverifier_test.go b/jwtverifier_test.go index 97fe0d8..cd23260 100644 --- a/jwtverifier_test.go +++ b/jwtverifier_test.go @@ -32,9 +32,9 @@ import ( "github.com/jarcoal/httpmock" "github.com/stretchr/testify/require" - "github.com/okta/okta-jwt-verifier-golang/adaptors/lestrratGoJwx" - "github.com/okta/okta-jwt-verifier-golang/discovery/oidc" - "github.com/okta/okta-jwt-verifier-golang/utils" + "github.com/okta/okta-jwt-verifier-golang/v2/adaptors/lestrratGoJwx" + "github.com/okta/okta-jwt-verifier-golang/v2/discovery/oidc" + "github.com/okta/okta-jwt-verifier-golang/v2/utils" ) func Test_the_verifier_defaults_to_oidc_if_nothing_is_provided_for_discovery(t *testing.T) { diff --git a/utils/cache_example_test.go b/utils/cache_example_test.go index db7ade3..ff01dc9 100644 --- a/utils/cache_example_test.go +++ b/utils/cache_example_test.go @@ -4,8 +4,8 @@ import ( "fmt" "time" - jwtverifier "github.com/okta/okta-jwt-verifier-golang" - "github.com/okta/okta-jwt-verifier-golang/utils" + jwtverifier "github.com/okta/okta-jwt-verifier-golang/v2" + "github.com/okta/okta-jwt-verifier-golang/v2/utils" ) // ForeverCache caches values forever diff --git a/utils/cache_test.go b/utils/cache_test.go index b09b7aa..eec3b14 100644 --- a/utils/cache_test.go +++ b/utils/cache_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/okta/okta-jwt-verifier-golang/utils" + "github.com/okta/okta-jwt-verifier-golang/v2/utils" ) type Value struct {