Skip to content

Commit

Permalink
refactor(consent): rename SDK method from acceptLoginRequest to `ad…
Browse files Browse the repository at this point in the history
…minAcceptOAuth2LoginRequest`

BREAKING CHANGE: Rename SDK method from `acceptLoginRequest` to `adminAcceptOAuth2LoginRequest`.
  • Loading branch information
aeneasr committed Sep 7, 2022
1 parent 9053040 commit fa27d0c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
10 changes: 0 additions & 10 deletions consent/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ type swaggerGetLogoutRequestByChallenge struct {
Challenge string `json:"logout_challenge"`
}

// swagger:parameters acceptLoginRequest
type swaggerAcceptLoginRequest struct {
// in: query
// required: true
Challenge string `json:"login_challenge"`

// in: body
Body HandledLoginRequest
}

// swagger:parameters acceptConsentRequest
type swaggerAcceptConsentRequest struct {
// in: query
Expand Down
40 changes: 22 additions & 18 deletions consent/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ func (h *Handler) adminRevokeOAuth2LoginSessions(w http.ResponseWriter, r *http.
// Schemes: http, https
//
// Responses:
// 200: loginRequest
// 200: oAuth2LoginRequest
// 410: handledOAuth2Request
// default: oAuth2ApiError
func (h *Handler) GetLoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
Expand Down Expand Up @@ -311,12 +311,22 @@ 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/accept admin acceptLoginRequest
// swagger:parameters acceptLoginRequest
type swaggerAcceptLoginRequest struct {
// in: query
// required: true
Challenge string `json:"login_challenge"`

// in: body
Body HandledLoginRequest
}

// swagger:route PUT /admin/oauth2/auth/requests/login/accept v1 adminAcceptOAuth2LoginRequest
//
// Accept a Login Request
// Accept an OAuth 2.0 Login Request
//
// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider
// (sometimes called "identity provider") to authenticate the subject and then tell ORY Hydra now about it. The login
// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory Hydra asks the login provider
// (sometimes called "identity provider") to authenticate the subject and then tell Ory Hydra now about it. The login
// provider is an web-app you write and host, and it must be able to authenticate ("show the subject a login screen")
// a subject (in OAuth2 the proper name for subject is "resource owner").
//
Expand All @@ -338,11 +348,8 @@ func (h *Handler) GetLoginRequest(w http.ResponseWriter, r *http.Request, ps htt
// Schemes: http, https
//
// Responses:
// 200: completedRequest
// 400: oAuth2ApiError
// 404: oAuth2ApiError
// 401: oAuth2ApiError
// 500: oAuth2ApiError
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("login_challenge"),
Expand Down Expand Up @@ -404,9 +411,9 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
})
}

// swagger:route PUT /oauth2/auth/requests/login/reject admin rejectLoginRequest
// swagger:route PUT /admin/oauth2/auth/requests/login/reject admin rejectOAuth2LoginRequest
//
// Reject a Login Request
// Reject an OAuth 2.0 Login Request
//
// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, ORY Hydra asks the login provider
// (sometimes called "identity provider") to authenticate the subject and then tell ORY Hydra now about it. The login
Expand All @@ -417,7 +424,7 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
// provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
//
// This endpoint tells ORY Hydra that the subject has not authenticated and includes a reason why the authentication
// was be denied.
// was denied.
//
// The response contains a redirect URL which the login provider should redirect the user-agent to.
//
Expand All @@ -430,11 +437,8 @@ func (h *Handler) AcceptLoginRequest(w http.ResponseWriter, r *http.Request, ps
// Schemes: http, https
//
// Responses:
// 200: completedRequest
// 400: oAuth2ApiError
// 401: oAuth2ApiError
// 404: oAuth2ApiError
// 500: oAuth2ApiError
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
func (h *Handler) RejectLoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("login_challenge"),
Expand Down
2 changes: 1 addition & 1 deletion consent/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (

// The response payload sent when accepting or rejecting a login or consent request.
//
// swagger:model completedRequest
// swagger:model successfulOAuth2RequestResponse
type RequestHandlerResponse struct {
// RedirectURL is the URL which you should redirect the user to once the authentication process is completed.
//
Expand Down

0 comments on commit fa27d0c

Please sign in to comment.