Skip to content

Commit

Permalink
chore: update Ory Hydra SDK (#3729)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Feb 5, 2024
1 parent 35a820b commit e3bfa10
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion courier/template/load_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ func loadRemoteTemplate(ctx context.Context, d templateDependencies, url string,
b = t.([]byte)
} else {
f := fetcher.NewFetcher(fetcher.WithClient(d.HTTPClient(ctx)))
b, err = f.FetchContext(ctx, url)
bb, err := f.FetchContext(ctx, url)
if err != nil {
return nil, errors.WithStack(err)
}
b = bb.Bytes()
_ = Cache.Add(url, b)
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ require (
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe
github.com/ory/graceful v0.1.4-0.20230301144740-e222150c51d0
github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88
github.com/ory/hydra-client-go/v2 v2.2.0-rc.3
github.com/ory/hydra-client-go/v2 v2.2.0-rc.3.0.20240202131107-1c7b57df3bb0
github.com/ory/jsonschema/v3 v3.0.8
github.com/ory/mail/v3 v3.0.0
github.com/ory/nosurf v1.2.7
github.com/ory/x v0.0.611
github.com/ory/x v0.0.613
github.com/peterhellberg/link v1.2.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -808,8 +808,8 @@ github.com/ory/graceful v0.1.4-0.20230301144740-e222150c51d0 h1:VMUeLRfQD14fOMvh
github.com/ory/graceful v0.1.4-0.20230301144740-e222150c51d0/go.mod h1:hg2iCy+LCWOXahBZ+NQa4dk8J2govyQD79rrqrgMyY8=
github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88 h1:J0CIFKdpUeqKbVMw7pQ1qLtUnflRM1JWAcOEq7Hp4yg=
github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88/go.mod h1:MMNmY6MG1uB6fnXYFaHoqdV23DTWctlPsmRCeq/2+wc=
github.com/ory/hydra-client-go/v2 v2.2.0-rc.3 h1:0AT8RYiPhT/+brKMSIX/0guSlDK3tg1AcXZgrb5F/tw=
github.com/ory/hydra-client-go/v2 v2.2.0-rc.3/go.mod h1:BS2mJTU+3d+Ii4JXLHlXcjS/BBSIu8OEH0AO71rAVt0=
github.com/ory/hydra-client-go/v2 v2.2.0-rc.3.0.20240202131107-1c7b57df3bb0 h1:D5w0EQBqZU5UcdW0iLTxqbBiEAhOwT2cWHWE6vjxJ3o=
github.com/ory/hydra-client-go/v2 v2.2.0-rc.3.0.20240202131107-1c7b57df3bb0/go.mod h1:JwnnsLd402LPTmIA+EDMsu5Nwr6IRl777pE0QvOq66c=
github.com/ory/jsonschema/v3 v3.0.8 h1:Ssdb3eJ4lDZ/+XnGkvQS/te0p+EkolqwTsDOCxr/FmU=
github.com/ory/jsonschema/v3 v3.0.8/go.mod h1:ZPzqjDkwd3QTnb2Z6PAS+OTvBE2x5i6m25wCGx54W/0=
github.com/ory/mail v2.3.1+incompatible/go.mod h1:87D9/1gB6ewElQoN0lXJ0ayfqcj3cW3qCTXh+5E9mfU=
Expand All @@ -819,8 +819,8 @@ github.com/ory/nosurf v1.2.7 h1:YrHrbSensQyU6r6HT/V5+HPdVEgrOTMJiLoJABSBOp4=
github.com/ory/nosurf v1.2.7/go.mod h1:d4L3ZBa7Amv55bqxCBtCs63wSlyaiCkWVl4vKf3OUxA=
github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2 h1:zm6sDvHy/U9XrGpixwHiuAwpp0Ock6khSVHkrv6lQQU=
github.com/ory/sessions v1.2.2-0.20220110165800-b09c17334dc2/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/ory/x v0.0.611 h1:mB23kkg8EYebmKo25JYubXQZmu1l4qLFJnkwr3DnpzA=
github.com/ory/x v0.0.611/go.mod h1:uH065puz8neija0neqwIN3PmXXfDsB9VbZTZ20Znoos=
github.com/ory/x v0.0.613 h1:MHT0scH7hcrOkc3aH7qqYLzXVJkjhB0szWTwpD2lh8Q=
github.com/ory/x v0.0.613/go.mod h1:uH065puz8neija0neqwIN3PmXXfDsB9VbZTZ20Znoos=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
Expand Down
2 changes: 1 addition & 1 deletion hydra/hydra.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (h *DefaultHydra) getAdminURL(ctx context.Context) (string, error) {
return u.String(), nil
}

func (h *DefaultHydra) getAdminAPIClient(ctx context.Context) (hydraclientgo.OAuth2Api, error) {
func (h *DefaultHydra) getAdminAPIClient(ctx context.Context) (*hydraclientgo.OAuth2ApiService, error) {
url, err := h.getAdminURL(ctx)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions internal/client-go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion request/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (b *Builder) readTemplate(ctx context.Context) ([]byte, error) {
return nil, err
}

return tpl, nil
return tpl.Bytes(), nil
}

func isNilInterface(i interface{}) bool {
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/oidc/strategy_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func (s *Strategy) processRegistration(w http.ResponseWriter, r *http.Request, r
return nil, s.handleError(w, r, rf, provider.Config().ID, nil, err)
}

i, va, err := s.createIdentity(w, r, rf, claims, provider, container, jsonnetMapperSnippet)
i, va, err := s.createIdentity(w, r, rf, claims, provider, container, jsonnetMapperSnippet.Bytes())
if err != nil {
return nil, s.handleError(w, r, rf, provider.Config().ID, nil, err)
}
Expand Down
6 changes: 3 additions & 3 deletions selfservice/strategy/password/op_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ type testConfig struct {
browserClient *http.Client
kratosPublicTS *httptest.Server
clientAppTS *httptest.Server
hydraAdminClient hydraclientgo.OAuth2Api
hydraAdminClient *hydraclientgo.OAuth2ApiService
consentRemember bool
requestedScope []string
callTrace *[]callTrace
}

func createHydraOAuth2ApiClient(url string) hydraclientgo.OAuth2Api {
func createHydraOAuth2ApiClient(url string) *hydraclientgo.OAuth2ApiService {
configuration := hydraclientgo.NewConfiguration()
configuration.Host = urlx.ParseOrPanic(url).Host
configuration.Servers = hydraclientgo.ServerConfigurations{{URL: url}}

return hydraclientgo.NewAPIClient(configuration).OAuth2Api
}

func createOAuth2Client(t *testing.T, ctx context.Context, hydraAdmin hydraclientgo.OAuth2Api, redirectURIs []string, scope string, skipConsent bool) string {
func createOAuth2Client(t *testing.T, ctx context.Context, hydraAdmin *hydraclientgo.OAuth2ApiService, redirectURIs []string, scope string, skipConsent bool) string {
t.Helper()

clientName := "kratos-hydra-integration-test-client-1"
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/password/op_registration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestOAuth2ProviderRegistration(t *testing.T) {
errTS := testhelpers.NewErrorTestServer(t, reg)
redirTS := testhelpers.NewRedirSessionEchoTS(t, reg)

var hydraAdminClient hydraclientgo.OAuth2Api
var hydraAdminClient *hydraclientgo.OAuth2ApiService

router := x.NewRouterPublic()

Expand Down
2 changes: 1 addition & 1 deletion session/tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *Tokenizer) TokenizeSession(ctx context.Context, template string, sessio
if err != nil {
return err
}
evaluated, err := vm.EvaluateAnonymousSnippet(tpl.ClaimsMapperURL, string(jsonnet))
evaluated, err := vm.EvaluateAnonymousSnippet(tpl.ClaimsMapperURL, jsonnet.String())
if err != nil {
return errors.WithStack(herodot.ErrBadRequest.WithWrap(err).WithDebug(err.Error()).WithReasonf("Unable to execute tokenizer JsonNet."))
}
Expand Down

0 comments on commit e3bfa10

Please sign in to comment.