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

Fix 1285 #1297

Merged
merged 26 commits into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0b8615d
config: Support multi proxies between TLS termination proxy and hydra…
Feb 14, 2019
756f74e
oauth2: Fix swagger documentation for oauth2/token (#1284)
aeneasr Feb 18, 2019
de76049
docs: Update patrons
aeneasr Feb 18, 2019
6537bd4
docker: Bump alpine version (#1291)
Feb 27, 2019
b034b8e
docker: Bump golang to 1.12.0 (#1293)
Feb 28, 2019
6beb788
cmd: Add --allowed-cors-origins to `client create` (#1290)
jgiles Feb 28, 2019
1e469de
Remove defaults for error, error_description, and error_hint
kminehart Mar 5, 2019
581f954
Provide generic defaults for RequestDeniedError name & description
kminehart Mar 5, 2019
d43f75d
De-capitalize and remove RequestDeniedError.debug default
kminehart Mar 5, 2019
5c62398
go mod tidy
kminehart Mar 5, 2019
1c7a719
go get -u golang.org/x/crypto
kminehart Mar 5, 2019
c3b900a
Add unit tests
kminehart Mar 5, 2019
2a4f265
circleci: Disable modules temporarily when fetching a tool (#1302)
aaslamin Mar 6, 2019
180963a
cmd: Fix description of clients create --subject-type option (#1305)
Mar 7, 2019
8b567c9
cmd: Fix no-open inverted flag check (#1306)
RomanMinkin Mar 9, 2019
3d4be1f
Default name if none is provided, but not description or hint
kminehart Mar 12, 2019
cfff0d0
Update tests to reflect requirements
kminehart Mar 12, 2019
ef1c677
Remove defaults for error, error_description, and error_hint
kminehart Mar 5, 2019
54172c5
Provide generic defaults for RequestDeniedError name & description
kminehart Mar 5, 2019
771c920
De-capitalize and remove RequestDeniedError.debug default
kminehart Mar 5, 2019
b34b567
go mod tidy
kminehart Mar 5, 2019
bb4a260
go get -u golang.org/x/crypto
kminehart Mar 5, 2019
bb4801e
Add unit tests
kminehart Mar 5, 2019
36b0cae
Default name if none is provided, but not description or hint
kminehart Mar 12, 2019
2ff1f0b
Update tests to reflect requirements
kminehart Mar 12, 2019
2265944
Merge branch 'fix-1285' of github.com:kminehart/hydra into fix-1285
kminehart Mar 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions consent/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import (
"github.com/ory/hydra/client"
)

const (
requestDeniedErrorName = "consent request denied"
)

// The response payload sent when accepting or rejecting a login or consent request.
//
// swagger:model completedRequest
Expand Down Expand Up @@ -54,20 +58,12 @@ type RequestDeniedError struct {

func (e *RequestDeniedError) toRFCError() *fosite.RFC6749Error {
if e.Name == "" {
e.Name = fosite.ErrInvalidRequest.Name
e.Name = requestDeniedErrorName
}

if e.Code == 0 {
e.Code = fosite.ErrInvalidRequest.Code
}
if e.Description == "" {
e.Description = fosite.ErrInvalidRequest.Description
}
if e.Hint == "" {
e.Hint = fosite.ErrInvalidRequest.Hint
}
if e.Debug == "" {
e.Debug = fosite.ErrInvalidRequest.Debug
}

return &fosite.RFC6749Error{
Name: e.Name,
Expand Down
54 changes: 54 additions & 0 deletions consent/types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package consent

import (
"fmt"
"testing"

"github.com/ory/fosite"
"github.com/stretchr/testify/require"
)

func TestToRFCError(t *testing.T) {
for k, tc := range []struct {
input *RequestDeniedError
expect *fosite.RFC6749Error
}{
{
input: &RequestDeniedError{
Name: "not empty",
},
expect: &fosite.RFC6749Error{
Name: "not empty",
Description: "",
Code: fosite.ErrInvalidRequest.Code,
Debug: "",
},
},
{
input: &RequestDeniedError{
Name: "",
Description: "not empty",
},
expect: &fosite.RFC6749Error{
Name: requestDeniedErrorName,
Description: "not empty",
Code: fosite.ErrInvalidRequest.Code,
Debug: "",
},
},
{
input: &RequestDeniedError{},
expect: &fosite.RFC6749Error{
Name: requestDeniedErrorName,
Description: "",
Hint: "",
Code: fosite.ErrInvalidRequest.Code,
Debug: "",
},
},
} {
t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) {
require.EqualValues(t, tc.input.toRFCError(), tc.expect)
})
}
}
44 changes: 2 additions & 42 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,27 @@ module github.com/ory/hydra

require (
cloud.google.com/go v0.36.0 // indirect
dmitri.shuralyov.com/app/changes v0.0.0-20181114035150-5af16e21babb // indirect
dmitri.shuralyov.com/service/change v0.0.0-20190203163610-217368fe4577 // indirect
git.apache.org/thrift.git v0.12.0 // indirect
github.com/Shopify/sarama v1.21.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190212144455-93d5ec2c7f76 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/gliderlabs/ssh v0.1.3 // indirect
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/go-sql-driver/mysql v1.4.0
github.com/gobuffalo/packd v0.0.0-20181029140631-cf76bd87a5a6 // indirect
github.com/gobwas/glob v0.2.3
github.com/gogo/protobuf v1.2.1 // indirect
github.com/golang/lint v0.0.0-20181217174547-8f45f776aaf1 // indirect
github.com/golang/mock v1.2.0
github.com/golang/protobuf v1.3.0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/pprof v0.0.0-20190226225141-b51a6544410d // indirect
github.com/googleapis/gax-go v2.0.2+incompatible // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/context v1.1.1
github.com/gorilla/mux v1.7.0 // indirect
github.com/gorilla/securecookie v0.0.0-20160422134519-667fe4e3466a
github.com/gorilla/sessions v0.0.0-20160922145804-ca9ada445741
github.com/gregjones/httpcache v0.0.0-20190212212710-3befbb6ad0cc // indirect
github.com/grpc-ecosystem/grpc-gateway v1.7.0 // indirect
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69
github.com/imdario/mergo v0.0.0-20171009183408-7fe0c75c13ab
github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0
github.com/julienschmidt/httprouter v1.2.0
github.com/kisielk/errcheck v1.2.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/lib/pq v1.0.0
github.com/meatballhat/negroni-logrus v0.0.0-20170801195057-31067281800f
github.com/mendsley/gojwk v0.0.0-20141217222730-4d5ec6e58103
github.com/microcosm-cc/bluemonday v1.0.2 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/oleiade/reflections v1.0.0
github.com/opentracing/opentracing-go v1.0.2
github.com/openzipkin/zipkin-go v0.1.5 // indirect
github.com/ory/dockertest v3.3.2+incompatible
github.com/ory/fosite v0.29.0
github.com/ory/go-convenience v0.1.0
Expand All @@ -57,21 +39,6 @@ require (
github.com/prometheus/procfs v0.0.0-20190225181712-6ed1f7e10411 // indirect
github.com/rs/cors v1.6.0
github.com/rubenv/sql-migrate v0.0.0-20180704111356-ba2c6a7295c59448dbc195cef2f41df5163b3892
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/shurcooL/go v0.0.0-20190121191506-3fef8c783dec // indirect
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d // indirect
github.com/shurcooL/highlight_diff v0.0.0-20181222201841-111da2e7d480 // indirect
github.com/shurcooL/highlight_go v0.0.0-20181215221002-9d8641ddf2e1 // indirect
github.com/shurcooL/home v0.0.0-20190204141146-5c8ae21d4240 // indirect
github.com/shurcooL/htmlg v0.0.0-20190120222857-1e8a37b806f3 // indirect
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414 // indirect
github.com/shurcooL/issues v0.0.0-20190120000219-08d8dadf8acb // indirect
github.com/shurcooL/issuesapp v0.0.0-20181229001453-b8198a402c58 // indirect
github.com/shurcooL/notifications v0.0.0-20181111060504-bcc2b3082a7a // indirect
github.com/shurcooL/octicon v0.0.0-20181222203144-9ff1a4cf27f4 // indirect
github.com/shurcooL/reactions v0.0.0-20181222204718-145cd5e7f3d1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/shurcooL/webdavfs v0.0.0-20181215192745-5988b2d638f6 // indirect
github.com/sirupsen/logrus v1.3.0
github.com/spf13/cobra v0.0.3
github.com/spf13/viper v1.2.1
Expand All @@ -83,20 +50,13 @@ require (
github.com/ziutek/mymysql v1.5.4 // indirect
go.opencensus.io v0.19.0 // indirect
go.uber.org/atomic v1.3.2 // indirect
go4.org v0.0.0-20190218023631-ce4c26f7be8e // indirect
golang.org/x/build v0.0.0-20190227044025-202164ea31fc // indirect
golang.org/x/crypto v0.0.0-20190227175134-215aa809caaf
golang.org/x/exp v0.0.0-20190221220918-438050ddec5e // indirect
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25
golang.org/x/net v0.0.0-20190227022144-312bce6e941f // indirect
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
golang.org/x/perf v0.0.0-20190124201629-844a5f5b46f4 // indirect
golang.org/x/sys v0.0.0-20190226215855-775f8194d0f9 // indirect
golang.org/x/tools v0.0.0-20190226205152-f727befe758c // indirect
golang.org/x/sys v0.0.0-20190305064518-30e92a19ae4a // indirect
google.golang.org/genproto v0.0.0-20190226184841-fc2db5cae922 // indirect
google.golang.org/grpc v1.19.0 // indirect
gopkg.in/resty.v1 v1.9.1
gopkg.in/square/go-jose.v2 v2.1.9
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
honnef.co/go/tools v0.0.0-20190215041234-466a0476246c // indirect
sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
)
Loading