Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(client): Reduce SQL boilerplate code #1758

Merged
merged 21 commits into from
Mar 14, 2020
Prev Previous commit
Next Next commit
u
  • Loading branch information
aeneasr committed Mar 14, 2020
commit a57ce06d35ba63d60483bc4b22c73d2aa45192b6
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ func (c *Client) GetJSONWebKeysURI() string {
}

func (c *Client) GetJSONWebKeys() *jose.JSONWebKeySet {
if c.JSONWebKeys == nil {
return nil
}
return c.JSONWebKeys.JSONWebKeySet
}

Expand Down
7 changes: 5 additions & 2 deletions client/manager_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
jose "gopkg.in/square/go-jose.v2"

"github.com/ory/fosite"

"github.com/ory/hydra/x"
)

Expand All @@ -44,7 +45,7 @@ func TestHelperClientAutoGenerateKey(k string, m Storage) func(t *testing.T) {
TermsOfServiceURI: "foo",
}
assert.NoError(t, m.CreateClient(ctx, c))
//assert.NotEmpty(t, c.ID)
// assert.NotEmpty(t, c.ID)
assert.NoError(t, m.DeleteClient(ctx, c.GetID()))
}
}
Expand Down Expand Up @@ -147,6 +148,7 @@ func TestHelperCreateGetUpdateDeleteClient(k string, m Storage) func(t *testing.
Secret: "secret-new",
RedirectURIs: []string{"http://redirect/new"},
TermsOfServiceURI: "bar",
JSONWebKeys: new(x.JoseJSONWebKeySet),
})
require.NoError(t, err)

Expand Down Expand Up @@ -207,7 +209,8 @@ func compare(t *testing.T, expected *Client, actual fosite.Client, k string) {
}

if actual, ok := actual.(fosite.OpenIDConnectClient); ok {
assert.EqualValues(t, expected.JSONWebKeys.Keys, actual.GetJSONWebKeys().Keys)
require.NotNil(t, expected.JSONWebKeys)
assert.EqualValues(t, expected.JSONWebKeys.JSONWebKeySet, actual.GetJSONWebKeys())
assert.EqualValues(t, expected.JSONWebKeysURI, actual.GetJSONWebKeysURI())
assert.EqualValues(t, expected.TokenEndpointAuthMethod, actual.GetTokenEndpointAuthMethod())
assert.EqualValues(t, expected.RequestURIs, actual.GetRequestURIs())
Expand Down
89 changes: 46 additions & 43 deletions docs/api.swagger.json

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
module github.com/ory/hydra

require (
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-bindata/go-bindata v3.1.1+incompatible
Expand All @@ -22,7 +20,6 @@ require (
github.com/jackc/pgx/v4 v4.4.1
github.com/jmoiron/sqlx v1.2.0
github.com/julienschmidt/httprouter v1.2.0
github.com/kevinburke/go-bindata v3.16.0+incompatible // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
Expand All @@ -37,7 +34,6 @@ require (
github.com/ory/viper v1.5.6
github.com/ory/x v0.0.100
github.com/pborman/uuid v1.2.0
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/phayes/freeport v0.0.0-20171002181615-b8543db493a5
github.com/pkg/errors v0.9.1
github.com/pkg/profile v1.3.0 // indirect
Expand All @@ -47,7 +43,6 @@ require (
github.com/sawadashota/encrypta v0.0.2
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v0.0.6
github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518
github.com/stretchr/testify v1.4.0
Expand All @@ -56,15 +51,12 @@ require (
github.com/toqueteos/webbrowser v1.2.0
github.com/uber/jaeger-client-go v2.22.1+incompatible
github.com/urfave/negroni v1.0.0
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
github.com/ziutek/mymysql v1.5.4 // indirect
go.opentelemetry.io/otel v0.2.1
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
golang.org/x/tools v0.0.0-20200313205530-4303120df7d8
gopkg.in/gorp.v1 v1.7.2 // indirect
gopkg.in/ini.v1 v1.54.0 // indirect
gopkg.in/square/go-jose.v2 v2.4.1
)
Expand Down
31 changes: 13 additions & 18 deletions go.sum

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading