mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-12 06:18:19 +02:00
Prototype device authorization flow (core)
This commit is contained in:
parent
4eda7479ce
commit
6d947ebd26
13 changed files with 331 additions and 24 deletions
|
@ -339,6 +339,17 @@ func (s *Stateful) AuthenticateSignInURL(
|
|||
return redirectTo, nil
|
||||
}
|
||||
|
||||
func (s *Stateful) AuthenticateDeviceCode(w http.ResponseWriter, r *http.Request, params url.Values) error {
|
||||
deviceAuthURL := s.authenticateURL.ResolveReference(&url.URL{
|
||||
Path: "/.pomerium/device_auth",
|
||||
RawQuery: params.Encode(),
|
||||
})
|
||||
|
||||
signedURL := urlutil.NewSignedURL(s.sharedKey, deviceAuthURL)
|
||||
httputil.Redirect(w, r, signedURL.String(), http.StatusFound)
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetIdentityProviderIDForURLValues returns the identity provider ID
|
||||
// associated with the given URL values.
|
||||
func (s *Stateful) GetIdentityProviderIDForURLValues(vs url.Values) string {
|
||||
|
|
|
@ -365,6 +365,17 @@ func (s *Stateless) AuthenticateSignInURL(
|
|||
)
|
||||
}
|
||||
|
||||
func (s *Stateless) AuthenticateDeviceCode(w http.ResponseWriter, r *http.Request, params url.Values) error {
|
||||
signinURL := s.authenticateURL.ResolveReference(&url.URL{
|
||||
Path: "/.pomerium/device_auth",
|
||||
RawQuery: params.Encode(),
|
||||
})
|
||||
|
||||
signedURL := urlutil.NewSignedURL(s.sharedKey, signinURL)
|
||||
httputil.Redirect(w, r, signedURL.String(), http.StatusFound)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Callback handles a redirect to a route domain once signed in.
|
||||
func (s *Stateless) Callback(w http.ResponseWriter, r *http.Request) error {
|
||||
if err := r.ParseForm(); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue