diff options
| author | mo khan <mo@mokhan.ca> | 2022-04-14 12:48:31 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2022-04-14 12:48:31 -0600 |
| commit | f142f0181277c8bfd513ce7e86429478f2b7b8e8 (patch) | |
| tree | 96b78f0936a7b5d6e9961bedbb4fcac2d8926c5d | |
| parent | 1fa09e4216e9e317d8718dfa028ea028e67b1aee (diff) | |
use hashicorp uuid
| -rw-r--r-- | src/oidc/go.mod | 3 | ||||
| -rw-r--r-- | src/oidc/go.sum | 4 | ||||
| -rw-r--r-- | src/oidc/main.go | 8 |
3 files changed, 7 insertions, 8 deletions
diff --git a/src/oidc/go.mod b/src/oidc/go.mod index 9a421fc..532ffb2 100644 --- a/src/oidc/go.mod +++ b/src/oidc/go.mod @@ -2,10 +2,9 @@ module github.com/hashicorp/xlgmokha/src/oidc go 1.18 -require github.com/google/uuid v1.3.0 - require ( github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c github.com/lestrrat-go/jwx/v2 v2.0.0-beta1 ) diff --git a/src/oidc/go.sum b/src/oidc/go.sum index 8abdeef..6edc397 100644 --- a/src/oidc/go.sum +++ b/src/oidc/go.sum @@ -7,8 +7,8 @@ github.com/goccy/go-json v0.9.6 h1:5/4CtRQdtsX0sal8fdVhTaiMN01Ri8BExZZ8iRmHQ6E= github.com/goccy/go-json v0.9.6/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c h1:nQcv325vxv2fFHJsOt53eSRf1eINt6vOdYUFfXs4rgk= +github.com/hashicorp/uuid v0.0.0-20160311170451-ebb0a03e909c/go.mod h1:fHzc09UnyJyqyW+bFuq864eh+wC7dj65aXmXLRe5to0= github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= diff --git a/src/oidc/main.go b/src/oidc/main.go index ac077fc..a237774 100644 --- a/src/oidc/main.go +++ b/src/oidc/main.go @@ -13,7 +13,7 @@ import ( "time" "github.com/golang-jwt/jwt" - "github.com/google/uuid" + "github.com/hashicorp/uuid" "github.com/lestrrat-go/jwx/v2/jwk" ) @@ -62,7 +62,7 @@ func createIdToken(clientId string) string { ExpiresAt: expiresAt.Unix(), NotBefore: now.Unix(), IssuedAt: now.Unix(), - Id: uuid.NewString(), + Id: uuid.GenerateUUID(), }) keyData, _ := ioutil.ReadFile("insecure.pem") @@ -86,8 +86,8 @@ func handler(w http.ResponseWriter, r *http.Request) { State: r.FormValue("state"), RedirectUri: r.FormValue("redirect_uri"), } - code := uuid.NewString() - tokens[code] = uuid.NewString() + code := uuid.GenerateUUID() + tokens[code] = uuid.GenerateUUID() url := fmt.Sprintf("%s?code=%s&state=%s", ar.RedirectUri, code, ar.State) http.Redirect(w, r, url, 302) } else if responseType == "id_token token" || responseType == "id_token" { |
