Skip to content
Permalink
Browse files

consent: Use query parameters for challenges (#1351)

Closes #1307

Signed-off-by: aeneasr <aeneas@ory.sh>
  • Loading branch information...
aeneasr committed Apr 11, 2019
1 parent 6a16b1e commit d88fb128f26793e2f313c63ede0906782280d9b9
Showing with 387 additions and 367 deletions.
  1. +6 −0 UPGRADE.md
  2. +4 −4 consent/doc.go
  3. +37 −26 consent/handler.go
  4. +2 −2 consent/handler_test.go
  5. +1 −1 consent/strategy_default_test.go
  6. +43 −43 docs/api.swagger.json
  7. +1 −0 go.sum
  8. +7 −3 sdk/go/hydra/client/admin/accept_consent_request_parameters.go
  9. +3 −3 sdk/go/hydra/client/admin/accept_consent_request_responses.go
  10. +7 −3 sdk/go/hydra/client/admin/accept_login_request_parameters.go
  11. +4 −4 sdk/go/hydra/client/admin/accept_login_request_responses.go
  12. +6 −6 sdk/go/hydra/client/admin/admin_client.go
  13. +7 −3 sdk/go/hydra/client/admin/get_consent_request_parameters.go
  14. +4 −4 sdk/go/hydra/client/admin/get_consent_request_responses.go
  15. +7 −3 sdk/go/hydra/client/admin/get_login_request_parameters.go
  16. +4 −4 sdk/go/hydra/client/admin/get_login_request_responses.go
  17. +7 −3 sdk/go/hydra/client/admin/reject_consent_request_parameters.go
  18. +3 −3 sdk/go/hydra/client/admin/reject_consent_request_responses.go
  19. +7 −3 sdk/go/hydra/client/admin/reject_login_request_parameters.go
  20. +4 −4 sdk/go/hydra/client/admin/reject_login_request_responses.go
  21. +5 −1 sdk/go/hydra/models/authentication_session.go
  22. +9 −1 sdk/go/hydra/models/client.go
  23. +1 −1 sdk/go/hydra/models/consent_request.go
  24. +1 −5 sdk/go/hydra/models/flush_inactive_o_auth2_tokens_request.go
  25. +1 −1 sdk/go/hydra/models/handled_authentication_request.go
  26. +1 −1 sdk/go/hydra/models/handled_consent_request.go
  27. +1 −1 sdk/go/hydra/models/introspection.go
  28. +1 −1 sdk/go/hydra/models/previous_consent_session.go
  29. +1 −1 sdk/go/hydra/models/well_known.go
  30. +6 −6 sdk/java/hydra-client-resttemplate/README.md
  31. +6 −6 sdk/java/hydra-client-resttemplate/docs/AdminApi.md
  32. +1 −1 sdk/java/hydra-client-resttemplate/docs/AuthenticationSession.md
  33. +2 −2 sdk/java/hydra-client-resttemplate/docs/Client.md
  34. +1 −1 sdk/java/hydra-client-resttemplate/docs/OAuth2Client.md
  35. +1 −1 sdk/java/hydra-client-resttemplate/docs/PreviousConsentSession.md
  36. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/ApiClient.java
  37. +19 −25 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/api/AdminApi.java
  38. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/api/HealthApi.java
  39. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/api/PublicApi.java
  40. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/api/VersionApi.java
  41. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/auth/ApiKeyAuth.java
  42. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/auth/HttpBasicAuth.java
  43. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/auth/OAuth.java
  44. +1 −1 ...java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/AcceptConsentRequest.java
  45. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/AcceptLoginRequest.java
  46. +1 −1 ...ava/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/AuthenticationRequest.java
  47. +5 −5 ...ava/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/AuthenticationSession.java
  48. +5 −5 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/Client.java
  49. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/CompletedRequest.java
  50. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/ConsentRequest.java
  51. +1 −1 ...ava/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/ConsentRequestSession.java
  52. +1 −1 ...hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/ConsentRequestSessionData.java
  53. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/CreateRequest.java
  54. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/EmptyResponse.java
  55. +1 −1 ...lient-resttemplate/src/main/java/com/github/ory/hydra/model/FlushInactiveOAuth2TokensRequest.java
  56. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/GenericError.java
  57. +1 −1 ...ra-client-resttemplate/src/main/java/com/github/ory/hydra/model/HandledAuthenticationRequest.java
  58. +1 −1 ...ava/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/HandledConsentRequest.java
  59. +1 −1 ...java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/HealthNotReadyStatus.java
  60. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/HealthStatus.java
  61. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/Introspection.java
  62. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/JSONWebKey.java
  63. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/JSONWebKeySet.java
  64. +1 −1 ...a-client-resttemplate/src/main/java/com/github/ory/hydra/model/JsonWebKeySetGeneratorRequest.java
  65. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/LoginRequest.java
  66. +3 −3 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/OAuth2Client.java
  67. +1 −1 .../hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/OAuth2TokenIntrospection.java
  68. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/Oauth2TokenResponse.java
  69. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/OauthTokenResponse.java
  70. +1 −1 ...java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/OpenIDConnectContext.java
  71. +8 −8 ...va/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/PreviousConsentSession.java
  72. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/RejectRequest.java
  73. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/RequestDeniedError.java
  74. +1 −1 ...va/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/RequestHandlerResponse.java
  75. +1 −1 ...lient-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerFlushInactiveAccessTokens.java
  76. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerHealthStatus.java
  77. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJSONWebKey.java
  78. +1 −1 ...java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJSONWebKeySet.java
  79. +1 −1 ...va/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJsonWebKeyQuery.java
  80. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJwkCreateSet.java
  81. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJwkSetQuery.java
  82. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJwkUpdateSet.java
  83. +1 −1 ...va/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerJwkUpdateSetKey.java
  84. +1 −1 ...ava/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerNotReadyStatus.java
  85. +1 −1 ...lient-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerOAuthIntrospectionRequest.java
  86. +1 −1 ...hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerOAuthTokenResponse.java
  87. +1 −1 ...ent-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerRevokeOAuth2TokenParameters.java
  88. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggerVersion.java
  89. +1 −1 ...ra-client-resttemplate/src/main/java/com/github/ory/hydra/model/Swaggeroauth2TokenParameters.java
  90. +1 −1 ...ydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/Swaggeroauth2TokenResponse.java
  91. +1 −1 ...-client-resttemplate/src/main/java/com/github/ory/hydra/model/SwaggeruserinfoResponsePayload.java
  92. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/UserinfoResponse.java
  93. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/Version.java
  94. +1 −1 sdk/java/hydra-client-resttemplate/src/main/java/com/github/ory/hydra/model/WellKnown.java
  95. +6 −6 sdk/js/swagger/README.md
  96. +6 −6 sdk/js/swagger/docs/AdminApi.md
  97. +1 −1 sdk/js/swagger/docs/AuthenticationSession.md
  98. +2 −2 sdk/js/swagger/docs/Client.md
  99. +1 −1 sdk/js/swagger/docs/OAuth2Client.md
  100. +1 −1 sdk/js/swagger/docs/PreviousConsentSession.md
  101. +12 −12 sdk/js/swagger/src/api/AdminApi.js
  102. +2 −2 sdk/js/swagger/src/model/AuthenticationSession.js
  103. +2 −2 sdk/js/swagger/src/model/Client.js
  104. +1 −1 sdk/js/swagger/src/model/OAuth2Client.js
  105. +7 −7 sdk/js/swagger/src/model/PreviousConsentSession.js
  106. +6 −6 sdk/php/swagger/README.md
  107. +6 −6 sdk/php/swagger/docs/Api/AdminApi.md
  108. +1 −1 sdk/php/swagger/docs/Model/AuthenticationSession.md
  109. +2 −2 sdk/php/swagger/docs/Model/Client.md
  110. +1 −1 sdk/php/swagger/docs/Model/OAuth2Client.md
  111. +1 −1 sdk/php/swagger/docs/Model/PreviousConsentSession.md
  112. +24 −48 sdk/php/swagger/lib/Api/AdminApi.php
  113. +2 −2 sdk/php/swagger/lib/Model/AuthenticationSession.php
  114. +2 −2 sdk/php/swagger/lib/Model/Client.php
  115. +1 −1 sdk/php/swagger/lib/Model/OAuth2Client.php
  116. +4 −4 sdk/php/swagger/lib/Model/PreviousConsentSession.php
@@ -151,8 +151,11 @@ The old Go SDK is still available but moved to a new path. To use it, change:
Previously, login and consent requests were accepted/rejected by doing one of:

```
GET /oauth2/auth/requests/login/{challenge}
PUT /oauth2/auth/requests/login/{challenge}/accept
PUT /oauth2/auth/requests/login/{challenge}/reject
GET /oauth2/auth/requests/consent/{challenge}
PUT /oauth2/auth/requests/consent/{challenge}/accept
PUT /oauth2/auth/requests/consent/{challenge}/reject
```
@@ -164,8 +167,11 @@ causing the login/consent app to execute a request it is not supposed to be maki
From now on, the challenge has to be sent using a query parameter instead:

```
GET /oauth2/auth/requests/login?challenge={challenge}
PUT /oauth2/auth/requests/login/accept?challenge={challenge}
PUT /oauth2/auth/requests/login/reject?challenge={challenge}
GET /oauth2/auth/requests/consent?challenge={challenge}
PUT /oauth2/auth/requests/consent/accept?challenge={challenge}
PUT /oauth2/auth/requests/consent/reject?challenge={challenge}
```
@@ -22,7 +22,7 @@ package consent

// swagger:parameters getLoginRequest getConsentRequest
type swaggerGetRequestByChallenge struct {
// in: path
// in: query
// required: true
Challenge string `json:"challenge"`
}
@@ -61,7 +61,7 @@ type swaggerRevokeAuthenticationSessionPayload struct {

// swagger:parameters acceptLoginRequest
type swaggerAcceptAuthenticationRequest struct {
// in: path
// in: query
// required: true
Challenge string `json:"challenge"`

@@ -71,7 +71,7 @@ type swaggerAcceptAuthenticationRequest struct {

// swagger:parameters acceptConsentRequest
type swaggerAcceptConsentRequest struct {
// in: path
// in: query
// required: true
Challenge string `json:"challenge"`

@@ -81,7 +81,7 @@ type swaggerAcceptConsentRequest struct {

// swagger:parameters rejectLoginRequest rejectConsentRequest
type swaggerRejectRequest struct {
// in: path
// in: query
// required: true
Challenge string `json:"challenge"`

@@ -57,13 +57,13 @@ func NewHandler(
}

func (h *Handler) SetRoutes(admin *x.RouterAdmin, public *x.RouterPublic) {
admin.GET(LoginPath+"/:challenge", h.GetLoginRequest)
admin.PUT(LoginPath+"/:challenge/accept", h.AcceptLoginRequest)
admin.PUT(LoginPath+"/:challenge/reject", h.RejectLoginRequest)
admin.GET(LoginPath, h.GetLoginRequest)
admin.PUT(LoginPath+"/accept", h.AcceptLoginRequest)
admin.PUT(LoginPath+"/reject", h.RejectLoginRequest)

admin.GET(ConsentPath+"/:challenge", h.GetConsentRequest)
admin.PUT(ConsentPath+"/:challenge/accept", h.AcceptConsentRequest)
admin.PUT(ConsentPath+"/:challenge/reject", h.RejectConsentRequest)
admin.GET(ConsentPath, h.GetConsentRequest)
admin.PUT(ConsentPath+"/accept", h.AcceptConsentRequest)
admin.PUT(ConsentPath+"/reject", h.RejectConsentRequest)

admin.DELETE(SessionsPath+"/login/:user", h.DeleteLoginSession)
admin.GET(SessionsPath+"/consent/:user", h.GetConsentSessions)
@@ -218,7 +218,7 @@ func (h *Handler) DeleteLoginSession(w http.ResponseWriter, r *http.Request, ps
w.WriteHeader(http.StatusNoContent)
}

// swagger:route GET /oauth2/auth/requests/login/{challenge} admin getLoginRequest
// swagger:route GET /oauth2/auth/requests/login admin getLoginRequest
//
// Get an login request
//
@@ -245,7 +245,8 @@ func (h *Handler) DeleteLoginSession(w http.ResponseWriter, r *http.Request, ps
// 409: genericError
// 500: genericError
func (h *Handler) GetLoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
request, err := h.r.ConsentManager().GetAuthenticationRequest(r.Context(), ps.ByName("challenge"))
challenge := r.URL.Query().Get("challenge")
request, err := h.r.ConsentManager().GetAuthenticationRequest(r.Context(), challenge)
if err != nil {
h.r.Writer().WriteError(w, r, err)
return
@@ -259,7 +260,7 @@ func (h *Handler) GetLoginRequest(w http.ResponseWriter, r *http.Request, ps htt
h.r.Writer().Write(w, r, request)
}

// swagger:route PUT /oauth2/auth/requests/login/{challenge}/accept admin acceptLoginRequest
// swagger:route PUT /oauth2/auth/requests/login/accept admin acceptLoginRequest
//
// Accept an login request
//
@@ -291,6 +292,8 @@ func (h *Handler) GetLoginRequest(w http.ResponseWriter, r *http.Request, ps htt
// 401: genericError
// 500: genericError
func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := r.URL.Query().Get("challenge")

var p HandledAuthenticationRequest
d := json.NewDecoder(r.Body)
d.DisallowUnknownFields()
@@ -302,8 +305,8 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
h.r.Writer().WriteErrorCode(w, r, http.StatusBadRequest, errors.New("Subject from payload can not be empty"))
}

p.Challenge = ps.ByName("challenge")
ar, err := h.r.ConsentManager().GetAuthenticationRequest(r.Context(), ps.ByName("challenge"))
p.Challenge = challenge
ar, err := h.r.ConsentManager().GetAuthenticationRequest(r.Context(), challenge)
if err != nil {
h.r.Writer().WriteError(w, r, err)
return
@@ -320,7 +323,7 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
}
p.RequestedAt = ar.RequestedAt

request, err := h.r.ConsentManager().HandleAuthenticationRequest(r.Context(), ps.ByName("challenge"), &p)
request, err := h.r.ConsentManager().HandleAuthenticationRequest(r.Context(), challenge, &p)
if err != nil {
h.r.Writer().WriteError(w, r, errors.WithStack(err))
return
@@ -337,7 +340,7 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
})
}

// swagger:route PUT /oauth2/auth/requests/login/{challenge}/reject admin rejectLoginRequest
// swagger:route PUT /oauth2/auth/requests/login/reject admin rejectLoginRequest
//
// Reject a login request
//
@@ -368,6 +371,8 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
// 404: genericError
// 500: genericError
func (h *Handler) RejectLoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := r.URL.Query().Get("challenge")

var p RequestDeniedError
d := json.NewDecoder(r.Body)
d.DisallowUnknownFields()
@@ -376,15 +381,15 @@ func (h *Handler) RejectLoginRequest(w http.ResponseWriter, r *http.Request, ps
return
}

ar, err := h.r.ConsentManager().GetAuthenticationRequest(r.Context(), ps.ByName("challenge"))
ar, err := h.r.ConsentManager().GetAuthenticationRequest(r.Context(), challenge)
if err != nil {
h.r.Writer().WriteError(w, r, err)
return
}

request, err := h.r.ConsentManager().HandleAuthenticationRequest(r.Context(), ps.ByName("challenge"), &HandledAuthenticationRequest{
request, err := h.r.ConsentManager().HandleAuthenticationRequest(r.Context(), challenge, &HandledAuthenticationRequest{
Error: &p,
Challenge: ps.ByName("challenge"),
Challenge: challenge,
RequestedAt: ar.RequestedAt,
})
if err != nil {
@@ -403,7 +408,7 @@ func (h *Handler) RejectLoginRequest(w http.ResponseWriter, r *http.Request, ps
})
}

// swagger:route GET /oauth2/auth/requests/consent/{challenge} admin getConsentRequest
// swagger:route GET /oauth2/auth/requests/consent admin getConsentRequest
//
// Get consent request information
//
@@ -432,7 +437,9 @@ func (h *Handler) RejectLoginRequest(w http.ResponseWriter, r *http.Request, ps
// 409: genericError
// 500: genericError
func (h *Handler) GetConsentRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
request, err := h.r.ConsentManager().GetConsentRequest(r.Context(), ps.ByName("challenge"))
challenge := r.URL.Query().Get("challenge")

request, err := h.r.ConsentManager().GetConsentRequest(r.Context(), challenge)
if err != nil {
h.r.Writer().WriteError(w, r, err)
return
@@ -446,7 +453,7 @@ func (h *Handler) GetConsentRequest(w http.ResponseWriter, r *http.Request, ps h
h.r.Writer().Write(w, r, request)
}

// swagger:route PUT /oauth2/auth/requests/consent/{challenge}/accept admin acceptConsentRequest
// swagger:route PUT /oauth2/auth/requests/consent/accept admin acceptConsentRequest
//
// Accept an consent request
//
@@ -480,6 +487,8 @@ func (h *Handler) GetConsentRequest(w http.ResponseWriter, r *http.Request, ps h
// 404: genericError
// 500: genericError
func (h *Handler) AcceptConsentRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := r.URL.Query().Get("challenge")

var p HandledConsentRequest
d := json.NewDecoder(r.Body)
d.DisallowUnknownFields()
@@ -488,16 +497,16 @@ func (h *Handler) AcceptConsentRequest(w http.ResponseWriter, r *http.Request, p
return
}

cr, err := h.r.ConsentManager().GetConsentRequest(r.Context(), ps.ByName("challenge"))
cr, err := h.r.ConsentManager().GetConsentRequest(r.Context(), challenge)
if err != nil {
h.r.Writer().WriteError(w, r, errors.WithStack(err))
return
}

p.Challenge = ps.ByName("challenge")
p.Challenge = challenge
p.RequestedAt = cr.RequestedAt

hr, err := h.r.ConsentManager().HandleConsentRequest(r.Context(), ps.ByName("challenge"), &p)
hr, err := h.r.ConsentManager().HandleConsentRequest(r.Context(), challenge, &p)
if err != nil {
h.r.Writer().WriteError(w, r, errors.WithStack(err))
return
@@ -516,7 +525,7 @@ func (h *Handler) AcceptConsentRequest(w http.ResponseWriter, r *http.Request, p
})
}

// swagger:route PUT /oauth2/auth/requests/consent/{challenge}/reject admin rejectConsentRequest
// swagger:route PUT /oauth2/auth/requests/consent/reject admin rejectConsentRequest
//
// Reject an consent request
//
@@ -549,6 +558,8 @@ func (h *Handler) AcceptConsentRequest(w http.ResponseWriter, r *http.Request, p
// 404: genericError
// 500: genericError
func (h *Handler) RejectConsentRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := r.URL.Query().Get("challenge")

var p RequestDeniedError
d := json.NewDecoder(r.Body)
d.DisallowUnknownFields()
@@ -557,15 +568,15 @@ func (h *Handler) RejectConsentRequest(w http.ResponseWriter, r *http.Request, p
return
}

hr, err := h.r.ConsentManager().GetConsentRequest(r.Context(), ps.ByName("challenge"))
hr, err := h.r.ConsentManager().GetConsentRequest(r.Context(), challenge)
if err != nil {
h.r.Writer().WriteError(w, r, errors.WithStack(err))
return
}

request, err := h.r.ConsentManager().HandleConsentRequest(r.Context(), ps.ByName("challenge"), &HandledConsentRequest{
request, err := h.r.ConsentManager().HandleConsentRequest(r.Context(), challenge, &HandledConsentRequest{
Error: &p,
Challenge: ps.ByName("challenge"),
Challenge: challenge,
RequestedAt: hr.RequestedAt,
})
if err != nil {
@@ -129,7 +129,7 @@ func TestGetLoginRequest(t *testing.T) {
defer ts.Close()

c := &http.Client{}
resp, err := c.Get(ts.URL + LoginPath + "/" + challenge)
resp, err := c.Get(ts.URL + LoginPath + "?challenge=" + challenge)
require.NoError(t, err)
require.EqualValues(t, tc.status, resp.StatusCode)
})
@@ -169,7 +169,7 @@ func TestGetConsentRequest(t *testing.T) {
defer ts.Close()

c := &http.Client{}
resp, err := c.Get(ts.URL + ConsentPath + "/" + challenge)
resp, err := c.Get(ts.URL + ConsentPath + "?challenge=" + challenge)
require.NoError(t, err)
require.EqualValues(t, tc.status, resp.StatusCode)
})
@@ -686,7 +686,7 @@ func TestStrategy(t *testing.T) {

body := `{"grant_scope": ["scope-a"], "remember": true}`
require.NoError(t, err)
req, err := http.NewRequest("PUT", api.URL+"/oauth2/auth/requests/consent/"+r.URL.Query().Get("consent_challenge")+"/accept", strings.NewReader(body))
req, err := http.NewRequest("PUT", api.URL+"/oauth2/auth/requests/consent/accept?challenge="+r.URL.Query().Get("consent_challenge"), strings.NewReader(body))
req.Header.Add("Content-Type", "application/json")
require.NoError(t, err)

0 comments on commit d88fb12

Please sign in to comment.
You can’t perform that action at this time.