Skip to content

Commit

Permalink
Merge pull request #127 from krakend/replace_dep
Browse files Browse the repository at this point in the history
Replace go-auth0 package imports
  • Loading branch information
kpacha authored Nov 2, 2023
2 parents eb76a07 + 95b2c72 commit 37d2ed8
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 24 deletions.
2 changes: 1 addition & 1 deletion gin/jose.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"regexp"
"strings"

auth0 "github.com/auth0-community/go-auth0"
"github.com/gin-gonic/gin"
auth0 "github.com/krakend/go-auth0"
krakendjose "github.com/krakendio/krakend-jose/v2"
"github.com/luraproject/lura/v2/config"
"github.com/luraproject/lura/v2/logging"
Expand Down
12 changes: 5 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/krakendio/krakend-jose/v2
go 1.17

require (
github.com/auth0-community/go-auth0 v1.0.0
github.com/gin-gonic/gin v1.8.2
github.com/krakend/go-auth0 v1.0.0
github.com/luraproject/lura/v2 v2.0.5
gocloud.dev v0.28.0
gocloud.dev/secrets/hashivault v0.28.0
Expand Down Expand Up @@ -96,11 +96,11 @@ require (
github.com/valyala/fastrand v1.1.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.2.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.2.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.103.0 // indirect
Expand All @@ -111,6 +111,4 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
)

replace github.com/auth0-community/go-auth0 v1.0.0 => github.com/devopsfaith/go-auth0 v0.0.0-20220422124632-a1358a81b559

replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible
39 changes: 31 additions & 8 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jose.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"strings"

"github.com/auth0-community/go-auth0"
"github.com/krakend/go-auth0"
"github.com/luraproject/lura/v2/proxy"
jose "gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
Expand Down
2 changes: 1 addition & 1 deletion jwk.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"sync"
"time"

auth0 "github.com/auth0-community/go-auth0"
auth0 "github.com/krakend/go-auth0"
"github.com/luraproject/lura/v2/core"
jose "gopkg.in/square/go-jose.v2"

Expand Down
2 changes: 1 addition & 1 deletion jwk_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package jose
import (
"net/http"

"github.com/auth0-community/go-auth0"
"github.com/krakend/go-auth0"
"gopkg.in/square/go-jose.v2/jwt"
)

Expand Down
5 changes: 3 additions & 2 deletions jwk_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/auth0-community/go-auth0"
"github.com/krakend/go-auth0"
"github.com/luraproject/lura/v2/config"
"github.com/luraproject/lura/v2/logging"
)
Expand All @@ -24,7 +24,8 @@ func TestJWKClient_globalCache(t *testing.T) {

var count uint64
backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "application/json")
// Content-Type defined in https://datatracker.ietf.org/doc/html/rfc7517#section-8.5.1
w.Header().Add("Content-Type", "application/jwk-set+json")
atomic.AddUint64(&count, 1)
w.Write(jwk)
}))
Expand Down
2 changes: 1 addition & 1 deletion jws.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"strings"

"github.com/auth0-community/go-auth0"
"github.com/krakend/go-auth0"
"github.com/luraproject/lura/v2/config"
jose "gopkg.in/square/go-jose.v2"
)
Expand Down
5 changes: 3 additions & 2 deletions mux/jose.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/http"
"strings"

"github.com/auth0-community/go-auth0"
"github.com/krakend/go-auth0"
krakendjose "github.com/krakendio/krakend-jose/v2"
"github.com/luraproject/lura/v2/config"
"github.com/luraproject/lura/v2/logging"
Expand Down Expand Up @@ -75,13 +75,14 @@ var emptyResponse = []byte("{}")

func jsonRender(w http.ResponseWriter, response *proxy.Response) error {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(response.Metadata.StatusCode)

if response == nil {
_, err := w.Write(emptyResponse)
return err
}

w.WriteHeader(response.Metadata.StatusCode)

js, err := json.Marshal(response.Data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
Expand Down

0 comments on commit 37d2ed8

Please sign in to comment.