diff options
Diffstat (limited to 'pkg/web/authorize.go')
| -rw-r--r-- | pkg/web/authorize.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/pkg/web/authorize.go b/pkg/web/authorize.go index b223699..87de962 100644 --- a/pkg/web/authorize.go +++ b/pkg/web/authorize.go @@ -5,23 +5,15 @@ import ( "net/http" "github.com/hashicorp/uuid" + "mokhan.ca/xlgmokha/oauth/pkg/dto" ) -type AuthorizationRequest struct { - ResponseType string - Scope string - ClientId string - State string - RedirectUri string - Nonce string -} - func (h *HttpContext) Authorize(w http.ResponseWriter, r *http.Request) { if r.Method == "GET" { responseType := r.FormValue("response_type") if responseType == "code" { // Authorization Code Flow https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth - ar := &AuthorizationRequest{ + ar := &dto.AuthorizationRequest{ ResponseType: r.FormValue("response_type"), Scope: r.FormValue("scope"), ClientId: r.FormValue("client_id"), @@ -34,7 +26,7 @@ func (h *HttpContext) Authorize(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, url, 302) } else if responseType == "id_token token" || responseType == "id_token" { // Implicit Flow https://openid.net/specs/openid-connect-core-1_0.html#ImplicitFlowAuth - ar := &AuthorizationRequest{ + ar := &dto.AuthorizationRequest{ ResponseType: r.FormValue("response_type"), RedirectUri: r.FormValue("redirect_uri"), Nonce: r.FormValue("nonce"), |
