mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-22 05:27:13 +02:00
Prototype device authorization flow (core)
This commit is contained in:
parent
56ce79e662
commit
18aed33aa5
2 changed files with 2 additions and 7 deletions
|
@ -97,7 +97,6 @@ func (a *Authenticate) mountDashboard(r *mux.Router) {
|
|||
sr.Path("/sign_out").Handler(httputil.HandlerFunc(a.SignOut))
|
||||
sr.Path("/signed_out").Handler(httputil.HandlerFunc(a.signedOut)).Methods(http.MethodGet)
|
||||
sr.Path("/device_auth").Handler(httputil.HandlerFunc(a.DeviceAuthLogin)).
|
||||
Queries(urlutil.QueryDeviceAuthRouteURI, "").
|
||||
Methods(http.MethodGet, http.MethodPost)
|
||||
|
||||
// routes that need a session:
|
||||
|
@ -577,7 +576,7 @@ func (a *Authenticate) getRetryTokenForRequest(r *http.Request) []byte {
|
|||
if err := r.ParseForm(); err != nil {
|
||||
return nil
|
||||
}
|
||||
dec, _ := base64.URLEncoding.DecodeString(r.Form.Get(urlutil.QueryDeviceAuthRetryToken))
|
||||
dec, _ := base64.StdEncoding.DecodeString(r.Form.Get(urlutil.QueryDeviceAuthRetryToken))
|
||||
return dec
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ func (p *Proxy) registerDashboardHandlers(r *mux.Router, opts *config.Options) *
|
|||
}))
|
||||
|
||||
a.Path("/v1/device_auth").Handler(httputil.HandlerFunc(p.DeviceAuthLogin)).
|
||||
Queries(urlutil.QueryDeviceAuthRouteURI, "").
|
||||
Methods(http.MethodGet, http.MethodPost)
|
||||
|
||||
return r
|
||||
|
@ -169,10 +168,7 @@ func (p *Proxy) DeviceAuthLogin(w http.ResponseWriter, r *http.Request) error {
|
|||
options := p.currentOptions.Load()
|
||||
|
||||
params := url.Values{}
|
||||
routeUri, err := urlutil.ParseAndValidateURL(r.FormValue(urlutil.QueryDeviceAuthRouteURI))
|
||||
if err != nil {
|
||||
return httputil.NewError(http.StatusBadRequest, err)
|
||||
}
|
||||
routeUri := urlutil.GetAbsoluteURL(r)
|
||||
params.Set(urlutil.QueryDeviceAuthRouteURI, routeUri.String())
|
||||
|
||||
idp, err := options.GetIdentityProviderForRequestURL(routeUri.String())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue