Skip to content

Commit 9abdfd0

Browse files
authored
Resolve issues with error handling (#174)
* errors: do not convert errors compliant with rfcerrors * handler/oauth2: improve redirect message for insecure http
1 parent 524d3b6 commit 9abdfd0

File tree

4 files changed

+47
-48
lines changed

4 files changed

+47
-48
lines changed

errors.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ type RFC6749Error struct {
6666
}
6767

6868
func ErrorToRFC6749Error(err error) *RFC6749Error {
69+
if e, ok := err.(*RFC6749Error); ok {
70+
return e
71+
}
72+
6973
switch errors.Cause(err) {
7074
case ErrInactiveToken:
7175
{

glide.lock

Lines changed: 30 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
package: github.com/ory/fosite
22
import:
33
- package: github.com/asaskevich/govalidator
4-
version: ~5.0.0
4+
version: ~6.0.0
55
- package: github.com/dgrijalva/jwt-go
66
version: ~3.0.0
77
- package: github.com/golang/mock
88
subpackages:
99
- gomock
10+
- package: github.com/oleiade/reflections
11+
version: ~1.0.0
1012
- package: github.com/pborman/uuid
1113
version: ~1.0.0
1214
- package: github.com/pkg/errors
1315
version: ~0.8.0
1416
- package: github.com/square/go-jose
15-
version: ~1.1.0
17+
version: ~2.1.1
1618
subpackages:
1719
- json
18-
- package: golang.org/x/crypto
19-
subpackages:
20-
- bcrypt
21-
- package: golang.org/x/net
22-
subpackages:
23-
- context
24-
testImport:
25-
- package: github.com/gorilla/mux
26-
version: ~1.1.0
2720
- package: github.com/stretchr/testify
2821
version: ~1.1.4
2922
subpackages:
3023
- assert
3124
- require
25+
- package: golang.org/x/crypto
26+
subpackages:
27+
- bcrypt
28+
testImport:
29+
- package: github.com/gorilla/mux
30+
version: ~1.4.0
31+
- package: github.com/parnurzeal/gorequest
32+
version: ~0.2.15
3233
- package: golang.org/x/oauth2
3334
subpackages:
3435
- clientcredentials

handler/oauth2/flow_authorize_code_auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func (c *AuthorizeExplicitGrantHandler) HandleAuthorizeEndpointRequest(ctx conte
4242
}
4343

4444
if !fosite.IsRedirectURISecure(ar.GetRedirectURI()) {
45-
return errors.Wrap(fosite.ErrInvalidRequest, "Redirect URL is using an insecure protocol")
45+
return errors.Wrap(fosite.ErrInvalidRequest, "Redirect URL is using an insecure protocol, http is only allowed for hosts with suffix `localhost`, for example: http://myapp.localhost/")
4646
}
4747

4848
client := ar.GetClient()

0 commit comments

Comments
 (0)