diff --git a/compose/compose.go b/compose/compose.go index 94cf44e89..c79553aea 100644 --- a/compose/compose.go +++ b/compose/compose.go @@ -56,8 +56,8 @@ func Compose(config *fosite.Config, storage interface{}, strategy interface{}, f if dh, ok := res.(fosite.DeviceEndpointHandler); ok { config.DeviceEndpointHandlers.Append(dh) } - if dah, ok := res.(fosite.DeviceAuthorizeEndpointHandler); ok { - config.DeviceAuthorizeEndpointHandlers.Append(dah) + if dah, ok := res.(fosite.DeviceUserEndpointHandler); ok { + config.DeviceUserEndpointHandlers.Append(dah) } } diff --git a/compose/compose_rfc8628.go b/compose/compose_rfc8628.go index b3574f0aa..37b8503fd 100644 --- a/compose/compose_rfc8628.go +++ b/compose/compose_rfc8628.go @@ -24,7 +24,7 @@ func RFC8628DeviceFactory(config fosite.Configurator, storage interface{}, strat func RFC8628DeviceAuthorizationTokenFactory(config fosite.Configurator, storage interface{}, strategy interface{}) interface{} { return &rfc8628.DeviceCodeTokenEndpointHandler{ GenericCodeTokenEndpointHandler: oauth2.GenericCodeTokenEndpointHandler{ - CodeTokenEndpointHandler: &rfc8628.DeviceAuthorizeHandler{ + CodeTokenEndpointHandler: &rfc8628.DeviceUserHandler{ DeviceStrategy: strategy.(rfc8628.DeviceCodeStrategy), DeviceStorage: storage.(rfc8628.DeviceCodeStorage), }, diff --git a/config.go b/config.go index 36dce6a52..cb027c182 100644 --- a/config.go +++ b/config.go @@ -26,7 +26,7 @@ type DeviceAndUserCodeLifespanProvider interface { GetDeviceAndUserCodeLifespan(ctx context.Context) time.Duration } -type DeviceAuthorizeProvider interface { +type DeviceUserProvider interface { GetDeviceDone(ctx context.Context) string } @@ -300,10 +300,10 @@ type DeviceEndpointHandlersProvider interface { GetDeviceEndpointHandlers(ctx context.Context) DeviceEndpointHandlers } -// DeviceAuthorizeEndpointHandlersProvider returns the provider for setting up the Device Authorize handlers. -type DeviceAuthorizeEndpointHandlersProvider interface { - // GetDeviceAuthorizeEndpointHandlers returns the handlers. - GetDeviceAuthorizeEndpointHandlers(ctx context.Context) DeviceAuthorizeEndpointHandlers +// DeviceUserEndpointHandlersProvider returns the provider for setting up the Device Authorize handlers. +type DeviceUserEndpointHandlersProvider interface { + // GetDeviceUserEndpointHandlers returns the handlers. + GetDeviceUserEndpointHandlers(ctx context.Context) DeviceUserEndpointHandlers } // UseLegacyErrorFormatProvider returns the provider for configuring whether to use the legacy error format. diff --git a/config_default.go b/config_default.go index 54b9b860b..2d81cc571 100644 --- a/config_default.go +++ b/config_default.go @@ -213,8 +213,8 @@ type Config struct { // DeviceEndpointHandlers is a list of handlers that are called before the device endpoint is served. DeviceEndpointHandlers DeviceEndpointHandlers - // DeviceAuthorizeEndpointHandlers is a list of handlers that are called before the device authorize endpoint is served. - DeviceAuthorizeEndpointHandlers DeviceAuthorizeEndpointHandlers + // DeviceUserEndpointHandlers is a list of handlers that are called before the device authorize endpoint is served. + DeviceUserEndpointHandlers DeviceUserEndpointHandlers // GlobalSecret is the global secret used to sign and verify signatures. GlobalSecret []byte @@ -268,8 +268,8 @@ func (c *Config) GetDeviceEndpointHandlers(ctx context.Context) DeviceEndpointHa return c.DeviceEndpointHandlers } -func (c *Config) GetDeviceAuthorizeEndpointHandlers(ctx context.Context) DeviceAuthorizeEndpointHandlers { - return c.DeviceAuthorizeEndpointHandlers +func (c *Config) GetDeviceUserEndpointHandlers(ctx context.Context) DeviceUserEndpointHandlers { + return c.DeviceUserEndpointHandlers } func (c *Config) GetRevocationHandlers(ctx context.Context) RevocationHandlers { diff --git a/device_authorize_request.go b/device_authorize_request.go deleted file mode 100644 index d3802d174..000000000 --- a/device_authorize_request.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -package fosite - -// DeviceAuthorizeRequest is an implementation of DeviceAuthorizeRequester -type DeviceAuthorizeRequest struct { - signature string - Request -} - -func (d *DeviceAuthorizeRequest) GetDeviceCodeSignature() string { - return d.signature -} - -func (d *DeviceAuthorizeRequest) SetDeviceCodeSignature(signature string) { - d.signature = signature -} - -func NewDeviceAuthorizeRequest() *DeviceAuthorizeRequest { - return &DeviceAuthorizeRequest{ - Request: *NewRequest(), - } -} diff --git a/device_authorize_response.go b/device_authorize_response.go deleted file mode 100644 index 58bd44886..000000000 --- a/device_authorize_response.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -package fosite - -import "net/http" - -type DeviceAuthorizeResponse struct { - Header http.Header -} - -func NewDeviceAuthorizeResponse() *DeviceAuthorizeResponse { - return &DeviceAuthorizeResponse{} -} - -func (a *DeviceAuthorizeResponse) GetHeader() http.Header { - return a.Header -} - -func (a *DeviceAuthorizeResponse) AddHeader(key, value string) { - a.Header.Add(key, value) -} diff --git a/device_authorize_response_writer.go b/device_authorize_response_writer.go deleted file mode 100644 index 954d66f7d..000000000 --- a/device_authorize_response_writer.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright © 2023 Ory Corp -// SPDX-License-Identifier: Apache-2.0 - -package fosite - -import ( - "context" -) - -func (f *Fosite) NewDeviceAuthorizeResponse(ctx context.Context, dar DeviceAuthorizeRequester, session Session) (DeviceAuthorizeResponder, error) { - var resp = &DeviceAuthorizeResponse{} - - dar.SetSession(session) - for _, h := range f.Config.GetDeviceAuthorizeEndpointHandlers(ctx) { - if err := h.HandleDeviceAuthorizeEndpointRequest(ctx, dar, resp); err != nil { - return nil, err - } - } - - return resp, nil -} diff --git a/device_request_handler_test.go b/device_request_handler_test.go index e1dd52392..6d6f69fe4 100644 --- a/device_request_handler_test.go +++ b/device_request_handler_test.go @@ -28,7 +28,7 @@ func TestNewDeviceRequest(t *testing.T) { query url.Values expectedError error mock func() - expect *DeviceAuthorizeRequest + expect *DeviceUserRequest }{ /* empty request */ { @@ -88,7 +88,7 @@ func TestNewDeviceRequest(t *testing.T) { GrantTypes: []string{"urn:ietf:params:oauth:grant-type:device_code"}, }, nil) }, - expect: &DeviceAuthorizeRequest{ + expect: &DeviceUserRequest{ Request: Request{ Client: &DefaultClient{ Scopes: []string{"foo", "bar"}, diff --git a/device_response_writer_test.go b/device_response_writer_test.go index 6f81afcbb..88c23222f 100644 --- a/device_response_writer_test.go +++ b/device_response_writer_test.go @@ -18,7 +18,7 @@ import ( func TestNewDeviceResponse(t *testing.T) { ctrl := gomock.NewController(t) handlers := []*MockDeviceEndpointHandler{NewMockDeviceEndpointHandler(ctrl)} - dar := NewMockDeviceAuthorizeRequester(ctrl) + dar := NewMockDeviceUserRequester(ctrl) defer ctrl.Finish() ctx := context.Background() diff --git a/device_user_request.go b/device_user_request.go new file mode 100644 index 000000000..e99529b8d --- /dev/null +++ b/device_user_request.go @@ -0,0 +1,24 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package fosite + +// DeviceUserRequest is an implementation of DeviceUserRequester +type DeviceUserRequest struct { + signature string + Request +} + +func (d *DeviceUserRequest) GetDeviceCodeSignature() string { + return d.signature +} + +func (d *DeviceUserRequest) SetDeviceCodeSignature(signature string) { + d.signature = signature +} + +func NewDeviceUserRequest() *DeviceUserRequest { + return &DeviceUserRequest{ + Request: *NewRequest(), + } +} diff --git a/device_authorize_request_handler.go b/device_user_request_handler.go similarity index 76% rename from device_authorize_request_handler.go rename to device_user_request_handler.go index 715579abd..9367de5b4 100644 --- a/device_authorize_request_handler.go +++ b/device_user_request_handler.go @@ -13,15 +13,15 @@ import ( "go.opentelemetry.io/otel/trace" ) -func (f *Fosite) NewDeviceAuthorizeRequest(ctx context.Context, r *http.Request) (_ DeviceAuthorizeRequester, err error) { - ctx, span := trace.SpanFromContext(ctx).TracerProvider().Tracer("github.com/ory/fosite").Start(ctx, "Fosite.NewDeviceAuthorizeRequest") +func (f *Fosite) NewDeviceUserRequest(ctx context.Context, r *http.Request) (_ DeviceUserRequester, err error) { + ctx, span := trace.SpanFromContext(ctx).TracerProvider().Tracer("github.com/ory/fosite").Start(ctx, "Fosite.NewDeviceUserRequest") defer otelx.End(span, &err) - return f.newDeviceAuthorizeRequest(ctx, r) + return f.newDeviceUserRequest(ctx, r) } -func (f *Fosite) newDeviceAuthorizeRequest(ctx context.Context, r *http.Request) (DeviceAuthorizeRequester, error) { - request := NewDeviceAuthorizeRequest() +func (f *Fosite) newDeviceUserRequest(ctx context.Context, r *http.Request) (DeviceUserRequester, error) { + request := NewDeviceUserRequest() request.Lang = i18n.GetLangFromRequest(f.Config.GetMessageCatalog(ctx), r) if err := r.ParseForm(); err != nil { diff --git a/device_authorize_request_handler_test.go b/device_user_request_handler_test.go similarity index 93% rename from device_authorize_request_handler_test.go rename to device_user_request_handler_test.go index 8922fd717..df937a16c 100644 --- a/device_authorize_request_handler_test.go +++ b/device_user_request_handler_test.go @@ -21,7 +21,7 @@ import ( . "github.com/ory/fosite/internal" ) -func TestNewDeviceAuthorizeRequest(t *testing.T) { +func TestNewDeviceUserRequest(t *testing.T) { var store *MockStorage for k, c := range []struct { desc string @@ -31,7 +31,7 @@ func TestNewDeviceAuthorizeRequest(t *testing.T) { form url.Values expectedError error mock func() - expect *DeviceAuthorizeRequest + expect *DeviceUserRequest }{ /* invalid client */ { @@ -49,7 +49,7 @@ func TestNewDeviceAuthorizeRequest(t *testing.T) { conf: &Fosite{Store: store, Config: &Config{ScopeStrategy: ExactScopeStrategy, AudienceMatchingStrategy: DefaultAudienceMatchingStrategy}}, r: &http.Request{}, mock: func() {}, - expect: &DeviceAuthorizeRequest{ + expect: &DeviceUserRequest{ Request: Request{}, }, }, @@ -65,7 +65,7 @@ func TestNewDeviceAuthorizeRequest(t *testing.T) { GrantTypes: []string{"urn:ietf:params:oauth:grant-type:device_code"}, }, nil) }, - expect: &DeviceAuthorizeRequest{ + expect: &DeviceUserRequest{ Request: Request{ Client: &DefaultClient{ GrantTypes: []string{"urn:ietf:params:oauth:grant-type:device_code"}, @@ -85,7 +85,7 @@ func TestNewDeviceAuthorizeRequest(t *testing.T) { GrantTypes: []string{"urn:ietf:params:oauth:grant-type:device_code"}, }, nil) }, - expect: &DeviceAuthorizeRequest{ + expect: &DeviceUserRequest{ Request: Request{ Client: &DefaultClient{ GrantTypes: []string{"urn:ietf:params:oauth:grant-type:device_code"}, @@ -125,7 +125,7 @@ func TestNewDeviceAuthorizeRequest(t *testing.T) { } c.conf.Store = store - ar, err := c.conf.NewDeviceAuthorizeRequest(context.Background(), c.r) + ar, err := c.conf.NewDeviceUserRequest(context.Background(), c.r) if c.expectedError != nil { assert.EqualError(t, err, c.expectedError.Error()) } else { diff --git a/device_authorize_request_test.go b/device_user_request_test.go similarity index 83% rename from device_authorize_request_test.go rename to device_user_request_test.go index 34e28b36c..473c1a561 100644 --- a/device_authorize_request_test.go +++ b/device_user_request_test.go @@ -10,25 +10,25 @@ import ( "github.com/stretchr/testify/assert" ) -func TestDeviceAuthorizeRequest(t *testing.T) { +func TestDeviceUserRequest(t *testing.T) { for k, c := range []struct { - ar *DeviceAuthorizeRequest + ar *DeviceUserRequest }{ { - ar: NewDeviceAuthorizeRequest(), + ar: NewDeviceUserRequest(), }, { - ar: &DeviceAuthorizeRequest{}, + ar: &DeviceUserRequest{}, }, { - ar: &DeviceAuthorizeRequest{ + ar: &DeviceUserRequest{ Request: Request{ Client: &DefaultClient{RedirectURIs: []string{""}}, }, }, }, { - ar: &DeviceAuthorizeRequest{ + ar: &DeviceUserRequest{ signature: "AAAA", Request: Request{ Client: &DefaultClient{RedirectURIs: []string{""}}, @@ -36,7 +36,7 @@ func TestDeviceAuthorizeRequest(t *testing.T) { }, }, { - ar: &DeviceAuthorizeRequest{ + ar: &DeviceUserRequest{ Request: Request{ Client: &DefaultClient{RedirectURIs: []string{"https://foobar.com/cb"}}, RequestedAt: time.Now().UTC(), diff --git a/device_user_response.go b/device_user_response.go new file mode 100644 index 000000000..00c4165aa --- /dev/null +++ b/device_user_response.go @@ -0,0 +1,22 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package fosite + +import "net/http" + +type DeviceUserResponse struct { + Header http.Header +} + +func NewDeviceUserResponse() *DeviceUserResponse { + return &DeviceUserResponse{} +} + +func (a *DeviceUserResponse) GetHeader() http.Header { + return a.Header +} + +func (a *DeviceUserResponse) AddHeader(key, value string) { + a.Header.Add(key, value) +} diff --git a/device_user_response_writer.go b/device_user_response_writer.go new file mode 100644 index 000000000..cd473c441 --- /dev/null +++ b/device_user_response_writer.go @@ -0,0 +1,21 @@ +// Copyright © 2023 Ory Corp +// SPDX-License-Identifier: Apache-2.0 + +package fosite + +import ( + "context" +) + +func (f *Fosite) NewDeviceUserResponse(ctx context.Context, dar DeviceUserRequester, session Session) (DeviceUserResponder, error) { + var resp = &DeviceUserResponse{} + + dar.SetSession(session) + for _, h := range f.Config.GetDeviceUserEndpointHandlers(ctx) { + if err := h.HandleDeviceUserEndpointRequest(ctx, dar, resp); err != nil { + return nil, err + } + } + + return resp, nil +} diff --git a/device_authorize_writer.go b/device_user_writer.go similarity index 80% rename from device_authorize_writer.go rename to device_user_writer.go index 474235ef3..0c75cfc0e 100644 --- a/device_authorize_writer.go +++ b/device_user_writer.go @@ -29,9 +29,9 @@ import ( "net/http" ) -// Once the user has approved the grant he will be redirected on his loggin machine +// Once the user has approved the grant he will be redirected on his interactive device // to a webpage (usally hosted in hydra-ui) to understand that he was connected successfully -// and that he can close this tab and return to his non-interactive device; -func (f *Fosite) WriteDeviceAuthorizeResponse(ctx context.Context, r *http.Request, rw http.ResponseWriter, requester DeviceAuthorizeRequester, responder DeviceAuthorizeResponder) { +// and that he can close this tab safely and return to his non-interactive device; +func (f *Fosite) WriteDeviceUserResponse(ctx context.Context, r *http.Request, rw http.ResponseWriter, requester DeviceUserRequester, responder DeviceUserResponder) { http.Redirect(rw, r, f.Config.GetDeviceDone(ctx), http.StatusSeeOther) } diff --git a/device_write_test.go b/device_write_test.go index d4e9437df..0ed418cb7 100644 --- a/device_write_test.go +++ b/device_write_test.go @@ -15,7 +15,7 @@ import ( . "github.com/ory/fosite" ) -func TestWriteDeviceAuthorizeResponse(t *testing.T) { +func TestWriteDeviceUserResponse(t *testing.T) { oauth2 := &Fosite{Config: &Config{ DeviceAndUserCodeLifespan: time.Minute, DeviceAuthTokenPollingInterval: time.Minute, diff --git a/fosite.go b/fosite.go index 4d709443d..e5d30fb77 100644 --- a/fosite.go +++ b/fosite.go @@ -96,11 +96,11 @@ func (a *DeviceEndpointHandlers) Append(h DeviceEndpointHandler) { *a = append(*a, h) } -// DeviceAuthorizeEndpointHandlers is a list of DeviceAuthorizeEndpointHandler -type DeviceAuthorizeEndpointHandlers []DeviceAuthorizeEndpointHandler +// DeviceUserEndpointHandlers is a list of DeviceUserEndpointHandler +type DeviceUserEndpointHandlers []DeviceUserEndpointHandler -// Append adds an DeviceAuthorizeEndpointHandlers to this list. Ignores duplicates based on reflect.TypeOf. -func (a *DeviceAuthorizeEndpointHandlers) Append(h DeviceAuthorizeEndpointHandler) { +// Append adds an DeviceUserEndpointHandlers to this list. Ignores duplicates based on reflect.TypeOf. +func (a *DeviceUserEndpointHandlers) Append(h DeviceUserEndpointHandler) { for _, this := range *a { if reflect.TypeOf(this) == reflect.TypeOf(h) { return @@ -162,9 +162,9 @@ type Configurator interface { RevocationHandlersProvider UseLegacyErrorFormatProvider DeviceEndpointHandlersProvider - DeviceAuthorizeEndpointHandlersProvider + DeviceUserEndpointHandlersProvider DeviceProvider - DeviceAuthorizeProvider + DeviceUserProvider } func NewOAuth2Provider(s Storage, c Configurator) *Fosite { diff --git a/generate-mocks.sh b/generate-mocks.sh index c0ca047d5..c56a5b781 100755 --- a/generate-mocks.sh +++ b/generate-mocks.sh @@ -23,7 +23,7 @@ mockgen -package internal -destination internal/id_token_strategy.go github.com/ mockgen -package internal -destination internal/pkce_storage_strategy.go github.com/ory/fosite/handler/pkce PKCERequestStorage mockgen -package internal -destination internal/authorize_handler.go github.com/ory/fosite AuthorizeEndpointHandler mockgen -package internal -destination internal/device_handler.go github.com/ory/fosite DeviceEndpointHandler -mockgen -package internal -destination internal/device_authorize_handler.go github.com/ory/fosite DeviceAuthorizeEndpointHandler +mockgen -package internal -destination internal/device_user_handler.go github.com/ory/fosite DeviceUserEndpointHandler mockgen -package internal -destination internal/revoke_handler.go github.com/ory/fosite RevocationHandler mockgen -package internal -destination internal/token_handler.go github.com/ory/fosite TokenEndpointHandler mockgen -package internal -destination internal/introspector.go github.com/ory/fosite TokenIntrospector @@ -33,8 +33,8 @@ mockgen -package internal -destination internal/access_request.go github.com/ory mockgen -package internal -destination internal/access_response.go github.com/ory/fosite AccessResponder mockgen -package internal -destination internal/authorize_request.go github.com/ory/fosite AuthorizeRequester mockgen -package internal -destination internal/authorize_response.go github.com/ory/fosite AuthorizeResponder -mockgen -package internal -destination internal/device_authorize_request.go github.com/ory/fosite DeviceAuthorizeRequester -mockgen -package internal -destination internal/device_authorize_response.go github.com/ory/fosite DeviceAuthorizeResponder +mockgen -package internal -destination internal/device_user_request.go github.com/ory/fosite DeviceUserRequester +mockgen -package internal -destination internal/device_user_response.go github.com/ory/fosite DeviceUserResponder mockgen -package internal -destination internal/device_request.go github.com/ory/fosite DeviceRequester mockgen -package internal -destination internal/device_response.go github.com/ory/fosite DeviceResponder diff --git a/generate.go b/generate.go index f11b2ab64..43e211ce8 100644 --- a/generate.go +++ b/generate.go @@ -25,7 +25,7 @@ package fosite //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/pkce_storage_strategy.go github.com/ory/fosite/handler/pkce PKCERequestStorage //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/authorize_handler.go github.com/ory/fosite AuthorizeEndpointHandler //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_handler.go github.com/ory/fosite DeviceEndpointHandler -//go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_authorize_handler.go github.com/ory/fosite DeviceAuthorizeEndpointHandler +//go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_user_handler.go github.com/ory/fosite DeviceUserEndpointHandler //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/revoke_handler.go github.com/ory/fosite RevocationHandler //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/token_handler.go github.com/ory/fosite TokenEndpointHandler //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/introspector.go github.com/ory/fosite TokenIntrospector @@ -35,7 +35,7 @@ package fosite //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/access_response.go github.com/ory/fosite AccessResponder //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/authorize_request.go github.com/ory/fosite AuthorizeRequester //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/authorize_response.go github.com/ory/fosite AuthorizeResponder -//go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_authorize_request.go github.com/ory/fosite DeviceAuthorizeRequester -//go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_authorize_response.go github.com/ory/fosite DeviceAuthorizeResponder +//go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_user_request.go github.com/ory/fosite DeviceUserRequester +//go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_user_response.go github.com/ory/fosite DeviceUserResponder //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_request.go github.com/ory/fosite DeviceRequester //go:generate go run github.com/golang/mock/mockgen -package internal -destination internal/device_response.go github.com/ory/fosite DeviceResponder diff --git a/handler.go b/handler.go index f4ebd19b5..d0a91497f 100644 --- a/handler.go +++ b/handler.go @@ -72,15 +72,15 @@ type DeviceEndpointHandler interface { // is passed along, if further information retrieval is required. If the handler feels that he is not responsible for // the device authorize request, he must return nil and NOT modify session nor responder neither requester. // - // The following spec is a good example of what HandleDeviceAuthorizeRequest should do. + // The following spec is a good example of what HandleDeviceUserRequest should do. // * https://tools.ietf.org/html/rfc8628#section-3.2 HandleDeviceEndpointRequest(ctx context.Context, requester DeviceRequester, responder DeviceResponder) error } -type DeviceAuthorizeEndpointHandler interface { - // HandleDeviceAuthorizeEndpointRequest handles a device authorize endpoint request. +type DeviceUserEndpointHandler interface { + // HandleDeviceUserEndpointRequest handles a device authorize endpoint request. // To extend the handler's capabilities, the http request is passed along, if further // information retrieval is required. If the handler feels that he is not responsible for // the authorize request, he must return nil and NOT modify session nor responder neither requester. - HandleDeviceAuthorizeEndpointRequest(ctx context.Context, requester DeviceAuthorizeRequester, responder DeviceAuthorizeResponder) error + HandleDeviceUserEndpointRequest(ctx context.Context, requester DeviceUserRequester, responder DeviceUserResponder) error } diff --git a/handler/openid/flow_device_auth.go b/handler/openid/flow_device_auth.go index 0c063eb19..56c4b0acc 100644 --- a/handler/openid/flow_device_auth.go +++ b/handler/openid/flow_device_auth.go @@ -22,7 +22,7 @@ type OpenIDConnectDeviceHandler struct { *IDTokenHandleHelper } -func (c *OpenIDConnectDeviceHandler) HandleDeviceAuthorizeEndpointRequest(ctx context.Context, ar fosite.DeviceAuthorizeRequester, resp fosite.DeviceAuthorizeResponder) error { +func (c *OpenIDConnectDeviceHandler) HandleDeviceUserEndpointRequest(ctx context.Context, ar fosite.DeviceUserRequester, resp fosite.DeviceUserResponder) error { if !(ar.GetGrantedScopes().Has("openid")) { return nil } diff --git a/handler/openid/validator_test.go b/handler/openid/validator_test.go index e571bd3d9..3ae72a026 100644 --- a/handler/openid/validator_test.go +++ b/handler/openid/validator_test.go @@ -498,7 +498,7 @@ func TestDeviceValidatePrompt(t *testing.T) { } { t.Run(fmt.Sprintf("case=%d/description=%s", k, tc.d), func(t *testing.T) { t.Logf("%s", tc.idTokenHint) - err := v.ValidatePrompt(context.TODO(), &fosite.DeviceAuthorizeRequest{ + err := v.ValidatePrompt(context.TODO(), &fosite.DeviceUserRequest{ Request: fosite.Request{ Form: url.Values{"prompt": {tc.prompt}, "id_token_hint": {tc.idTokenHint}}, Client: &fosite.DefaultClient{Public: tc.isPublic}, diff --git a/handler/rfc8628/token_endpoint_handler.go b/handler/rfc8628/token_endpoint_handler.go index b916c5344..fc1f71a1b 100644 --- a/handler/rfc8628/token_endpoint_handler.go +++ b/handler/rfc8628/token_endpoint_handler.go @@ -12,9 +12,9 @@ import ( "github.com/ory/fosite" ) -// DeviceAuthorizeHandler is a response handler for the Device Code introduced in the Device Authorize Grant +// DeviceUserHandler is a response handler for the Device Code introduced in the Device Authorize Grant // as defined in https://www.rfc-editor.org/rfc/rfc8628 -type DeviceAuthorizeHandler struct { +type DeviceUserHandler struct { DeviceStrategy DeviceCodeStrategy DeviceStorage DeviceCodeStorage } @@ -23,10 +23,10 @@ type DeviceCodeTokenEndpointHandler struct { oauth2.GenericCodeTokenEndpointHandler } -var _ oauth2.CodeTokenEndpointHandler = (*DeviceAuthorizeHandler)(nil) +var _ oauth2.CodeTokenEndpointHandler = (*DeviceUserHandler)(nil) var _ fosite.TokenEndpointHandler = (*DeviceCodeTokenEndpointHandler)(nil) -func (c *DeviceAuthorizeHandler) ValidateGrantTypes(ctx context.Context, requester fosite.AccessRequester) error { +func (c *DeviceUserHandler) ValidateGrantTypes(ctx context.Context, requester fosite.AccessRequester) error { if !requester.GetClient().GetGrantTypes().Has(string(fosite.GrantTypeDeviceCode)) { return errorsx.WithStack(fosite.ErrUnauthorizedClient.WithHint("The OAuth 2.0 Client is not allowed to use authorization grant \"urn:ietf:params:oauth:grant-type:device_code\".")) } @@ -34,11 +34,11 @@ func (c *DeviceAuthorizeHandler) ValidateGrantTypes(ctx context.Context, request return nil } -func (c *DeviceAuthorizeHandler) ValidateCode(ctx context.Context, request fosite.AccessRequester, code string) error { +func (c *DeviceUserHandler) ValidateCode(ctx context.Context, request fosite.AccessRequester, code string) error { return c.DeviceStrategy.ValidateDeviceCode(ctx, request, code) } -func (c *DeviceAuthorizeHandler) GetCodeAndSession(ctx context.Context, requester fosite.AccessRequester) (code string, signature string, request fosite.Requester, err error) { +func (c *DeviceUserHandler) GetCodeAndSession(ctx context.Context, requester fosite.AccessRequester) (code string, signature string, request fosite.Requester, err error) { code = requester.GetRequestForm().Get("device_code") signature, err = c.DeviceStrategy.DeviceCodeSignature(ctx, code) if err != nil { @@ -48,15 +48,15 @@ func (c *DeviceAuthorizeHandler) GetCodeAndSession(ctx context.Context, requeste return code, signature, req, err } -func (c *DeviceAuthorizeHandler) InvalidateSession(ctx context.Context, signature string) error { +func (c *DeviceUserHandler) InvalidateSession(ctx context.Context, signature string) error { return c.DeviceStorage.InvalidateDeviceCodeSession(ctx, signature) } // implement TokenEndpointHandler -func (c *DeviceAuthorizeHandler) CanSkipClientAuth(ctx context.Context, requester fosite.AccessRequester) bool { +func (c *DeviceUserHandler) CanSkipClientAuth(ctx context.Context, requester fosite.AccessRequester) bool { return requester.GetGrantTypes().ExactOne(string(fosite.GrantTypeDeviceCode)) } -func (c *DeviceAuthorizeHandler) CanHandleTokenEndpointRequest(ctx context.Context, requester fosite.AccessRequester) bool { +func (c *DeviceUserHandler) CanHandleTokenEndpointRequest(ctx context.Context, requester fosite.AccessRequester) bool { return requester.GetGrantTypes().ExactOne(string(fosite.GrantTypeDeviceCode)) } diff --git a/handler/rfc8628/token_endpoint_handler_test.go b/handler/rfc8628/token_endpoint_handler_test.go index 26f5c0c5a..9a9ed6686 100644 --- a/handler/rfc8628/token_endpoint_handler_test.go +++ b/handler/rfc8628/token_endpoint_handler_test.go @@ -40,7 +40,7 @@ var RFC8628HMACSHAStrategy = DefaultDeviceStrategy{ }, } -func TestDeviceAuthorizeCode_PopulateTokenEndpointResponse(t *testing.T) { +func TestDeviceUserCode_PopulateTokenEndpointResponse(t *testing.T) { for k, strategy := range map[string]struct { oauth2.CoreStrategy RFC8628CodeStrategy @@ -212,7 +212,7 @@ func TestDeviceAuthorizeCode_PopulateTokenEndpointResponse(t *testing.T) { RefreshTokenScopes: []string{"offline"}, } h = oauth2.GenericCodeTokenEndpointHandler{ - CodeTokenEndpointHandler: &DeviceAuthorizeHandler{ + CodeTokenEndpointHandler: &DeviceUserHandler{ DeviceStrategy: strategy, DeviceStorage: store, }, @@ -245,7 +245,7 @@ func TestDeviceAuthorizeCode_PopulateTokenEndpointResponse(t *testing.T) { } } -func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { +func TestDeviceUserCode_HandleTokenEndpointRequest(t *testing.T) { for k, strategy := range map[string]struct { oauth2.CoreStrategy RFC8628CodeStrategy @@ -256,7 +256,7 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { store := storage.NewMemoryStore() h := oauth2.GenericCodeTokenEndpointHandler{ - CodeTokenEndpointHandler: &DeviceAuthorizeHandler{ + CodeTokenEndpointHandler: &DeviceUserHandler{ DeviceStrategy: strategy.RFC8628CodeStrategy, DeviceStorage: store, }, @@ -271,10 +271,10 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { } for i, c := range []struct { areq *fosite.AccessRequest - authreq *fosite.DeviceAuthorizeRequest + authreq *fosite.DeviceUserRequest description string - setup func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) - check func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) + setup func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) + check func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) expectErr error }{ { @@ -306,7 +306,7 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { }, }, description: "should fail because device code could not be retrieved", - setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) { + setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) { deviceCode, _, err := strategy.GenerateDeviceCode(context.TODO()) require.NoError(t, err) areq.Form = url.Values{"device_code": {deviceCode}} @@ -335,14 +335,14 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { RequestedAt: time.Now().UTC(), }, }, - authreq: &fosite.DeviceAuthorizeRequest{ + authreq: &fosite.DeviceUserRequest{ Request: fosite.Request{ Client: &fosite.DefaultClient{ID: "bar"}, RequestedScope: fosite.Arguments{"a", "b"}, }, }, description: "should fail because client mismatch", - setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) { + setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) { token, signature, err := strategy.GenerateDeviceCode(context.TODO()) require.NoError(t, err) areq.Form = url.Values{"device_code": {token}} @@ -360,7 +360,7 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { RequestedAt: time.Now().UTC(), }, }, - authreq: &fosite.DeviceAuthorizeRequest{ + authreq: &fosite.DeviceUserRequest{ Request: fosite.Request{ Client: &fosite.DefaultClient{ID: "foo", GrantTypes: []string{"urn:ietf:params:oauth:grant-type:device_code"}}, Session: &fosite.DefaultSession{}, @@ -369,7 +369,7 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { }, }, description: "should pass", - setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) { + setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) { token, signature, err := strategy.GenerateDeviceCode(context.TODO()) require.NoError(t, err) @@ -390,11 +390,11 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { RequestedAt: time.Now().UTC(), }, }, - check: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) { + check: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) { assert.Equal(t, time.Now().Add(time.Minute).UTC().Round(time.Second), areq.GetSession().GetExpiresAt(fosite.AccessToken)) assert.Equal(t, time.Now().Add(time.Minute).UTC().Round(time.Second), areq.GetSession().GetExpiresAt(fosite.RefreshToken)) }, - setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceAuthorizeRequest) { + setup: func(t *testing.T, areq *fosite.AccessRequest, authreq *fosite.DeviceUserRequest) { code, sig, err := strategy.GenerateDeviceCode(context.TODO()) require.NoError(t, err) areq.Form.Add("device_code", code) @@ -427,7 +427,7 @@ func TestDeviceAuthorizeCode_HandleTokenEndpointRequest(t *testing.T) { } } -func TestDeviceAuthorizeCodeTransactional_HandleTokenEndpointRequest(t *testing.T) { +func TestDeviceUserCodeTransactional_HandleTokenEndpointRequest(t *testing.T) { var mockTransactional *internal.MockTransactional var mockCoreStore *internal.MockCoreStorage var mockDeviceStore *internal.MockRFC8628CodeStorage @@ -646,7 +646,7 @@ func TestDeviceAuthorizeCodeTransactional_HandleTokenEndpointRequest(t *testing. testCase.setup() handler := oauth2.GenericCodeTokenEndpointHandler{ - CodeTokenEndpointHandler: &DeviceAuthorizeHandler{ + CodeTokenEndpointHandler: &DeviceUserHandler{ DeviceStrategy: &deviceStrategy, DeviceStorage: deviceTransactionalStore{ mockTransactional, diff --git a/internal/device_authorize_handler.go b/internal/device_authorize_handler.go index f7f3e5f87..ebe2ad150 100644 --- a/internal/device_authorize_handler.go +++ b/internal/device_authorize_handler.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ory/fosite (interfaces: DeviceAuthorizeEndpointHandler) +// Source: github.com/ory/fosite (interfaces: DeviceUserEndpointHandler) // Package internal is a generated GoMock package. package internal @@ -15,39 +15,39 @@ import ( fosite "github.com/ory/fosite" ) -// MockDeviceAuthorizeEndpointHandler is a mock of DeviceAuthorizeEndpointHandler interface. -type MockDeviceAuthorizeEndpointHandler struct { +// MockDeviceUserEndpointHandler is a mock of DeviceUserEndpointHandler interface. +type MockDeviceUserEndpointHandler struct { ctrl *gomock.Controller - recorder *MockDeviceAuthorizeEndpointHandlerMockRecorder + recorder *MockDeviceUserEndpointHandlerMockRecorder } -// MockDeviceAuthorizeEndpointHandlerMockRecorder is the mock recorder for MockDeviceAuthorizeEndpointHandler. -type MockDeviceAuthorizeEndpointHandlerMockRecorder struct { - mock *MockDeviceAuthorizeEndpointHandler +// MockDeviceUserEndpointHandlerMockRecorder is the mock recorder for MockDeviceUserEndpointHandler. +type MockDeviceUserEndpointHandlerMockRecorder struct { + mock *MockDeviceUserEndpointHandler } -// NewMockDeviceAuthorizeEndpointHandler creates a new mock instance. -func NewMockDeviceAuthorizeEndpointHandler(ctrl *gomock.Controller) *MockDeviceAuthorizeEndpointHandler { - mock := &MockDeviceAuthorizeEndpointHandler{ctrl: ctrl} - mock.recorder = &MockDeviceAuthorizeEndpointHandlerMockRecorder{mock} +// NewMockDeviceUserEndpointHandler creates a new mock instance. +func NewMockDeviceUserEndpointHandler(ctrl *gomock.Controller) *MockDeviceUserEndpointHandler { + mock := &MockDeviceUserEndpointHandler{ctrl: ctrl} + mock.recorder = &MockDeviceUserEndpointHandlerMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDeviceAuthorizeEndpointHandler) EXPECT() *MockDeviceAuthorizeEndpointHandlerMockRecorder { +func (m *MockDeviceUserEndpointHandler) EXPECT() *MockDeviceUserEndpointHandlerMockRecorder { return m.recorder } -// HandleDeviceAuthorizeEndpointRequest mocks base method. -func (m *MockDeviceAuthorizeEndpointHandler) HandleDeviceAuthorizeEndpointRequest(arg0 context.Context, arg1 fosite.DeviceAuthorizeRequester, arg2 fosite.DeviceAuthorizeResponder) error { +// HandleDeviceUserEndpointRequest mocks base method. +func (m *MockDeviceUserEndpointHandler) HandleDeviceUserEndpointRequest(arg0 context.Context, arg1 fosite.DeviceUserRequester, arg2 fosite.DeviceUserResponder) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HandleDeviceAuthorizeEndpointRequest", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "HandleDeviceUserEndpointRequest", arg0, arg1, arg2) ret0, _ := ret[0].(error) return ret0 } -// HandleDeviceAuthorizeEndpointRequest indicates an expected call of HandleDeviceAuthorizeEndpointRequest. -func (mr *MockDeviceAuthorizeEndpointHandlerMockRecorder) HandleDeviceAuthorizeEndpointRequest(arg0, arg1, arg2 interface{}) *gomock.Call { +// HandleDeviceUserEndpointRequest indicates an expected call of HandleDeviceUserEndpointRequest. +func (mr *MockDeviceUserEndpointHandlerMockRecorder) HandleDeviceUserEndpointRequest(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleDeviceAuthorizeEndpointRequest", reflect.TypeOf((*MockDeviceAuthorizeEndpointHandler)(nil).HandleDeviceAuthorizeEndpointRequest), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandleDeviceUserEndpointRequest", reflect.TypeOf((*MockDeviceUserEndpointHandler)(nil).HandleDeviceUserEndpointRequest), arg0, arg1, arg2) } diff --git a/internal/device_authorize_request.go b/internal/device_authorize_request.go index 33e318a1d..ce01302de 100644 --- a/internal/device_authorize_request.go +++ b/internal/device_authorize_request.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ory/fosite (interfaces: DeviceAuthorizeRequester) +// Source: github.com/ory/fosite (interfaces: DeviceUserRequester) // Package internal is a generated GoMock package. package internal @@ -16,43 +16,43 @@ import ( fosite "github.com/ory/fosite" ) -// MockDeviceAuthorizeRequester is a mock of DeviceAuthorizeRequester interface. -type MockDeviceAuthorizeRequester struct { +// MockDeviceUserRequester is a mock of DeviceUserRequester interface. +type MockDeviceUserRequester struct { ctrl *gomock.Controller - recorder *MockDeviceAuthorizeRequesterMockRecorder + recorder *MockDeviceUserRequesterMockRecorder } -// MockDeviceAuthorizeRequesterMockRecorder is the mock recorder for MockDeviceAuthorizeRequester. -type MockDeviceAuthorizeRequesterMockRecorder struct { - mock *MockDeviceAuthorizeRequester +// MockDeviceUserRequesterMockRecorder is the mock recorder for MockDeviceUserRequester. +type MockDeviceUserRequesterMockRecorder struct { + mock *MockDeviceUserRequester } -// NewMockDeviceAuthorizeRequester creates a new mock instance. -func NewMockDeviceAuthorizeRequester(ctrl *gomock.Controller) *MockDeviceAuthorizeRequester { - mock := &MockDeviceAuthorizeRequester{ctrl: ctrl} - mock.recorder = &MockDeviceAuthorizeRequesterMockRecorder{mock} +// NewMockDeviceUserRequester creates a new mock instance. +func NewMockDeviceUserRequester(ctrl *gomock.Controller) *MockDeviceUserRequester { + mock := &MockDeviceUserRequester{ctrl: ctrl} + mock.recorder = &MockDeviceUserRequesterMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDeviceAuthorizeRequester) EXPECT() *MockDeviceAuthorizeRequesterMockRecorder { +func (m *MockDeviceUserRequester) EXPECT() *MockDeviceUserRequesterMockRecorder { return m.recorder } // AppendRequestedScope mocks base method. -func (m *MockDeviceAuthorizeRequester) AppendRequestedScope(arg0 string) { +func (m *MockDeviceUserRequester) AppendRequestedScope(arg0 string) { m.ctrl.T.Helper() m.ctrl.Call(m, "AppendRequestedScope", arg0) } // AppendRequestedScope indicates an expected call of AppendRequestedScope. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) AppendRequestedScope(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) AppendRequestedScope(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendRequestedScope", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).AppendRequestedScope), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppendRequestedScope", reflect.TypeOf((*MockDeviceUserRequester)(nil).AppendRequestedScope), arg0) } // GetClient mocks base method. -func (m *MockDeviceAuthorizeRequester) GetClient() fosite.Client { +func (m *MockDeviceUserRequester) GetClient() fosite.Client { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetClient") ret0, _ := ret[0].(fosite.Client) @@ -60,13 +60,13 @@ func (m *MockDeviceAuthorizeRequester) GetClient() fosite.Client { } // GetClient indicates an expected call of GetClient. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetClient() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetClient() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClient", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetClient)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClient", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetClient)) } // GetDeviceCodeSignature mocks base method. -func (m *MockDeviceAuthorizeRequester) GetDeviceCodeSignature() string { +func (m *MockDeviceUserRequester) GetDeviceCodeSignature() string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetDeviceCodeSignature") ret0, _ := ret[0].(string) @@ -74,13 +74,13 @@ func (m *MockDeviceAuthorizeRequester) GetDeviceCodeSignature() string { } // GetDeviceCodeSignature indicates an expected call of GetDeviceCodeSignature. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetDeviceCodeSignature() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetDeviceCodeSignature() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeviceCodeSignature", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetDeviceCodeSignature)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDeviceCodeSignature", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetDeviceCodeSignature)) } // GetGrantedAudience mocks base method. -func (m *MockDeviceAuthorizeRequester) GetGrantedAudience() fosite.Arguments { +func (m *MockDeviceUserRequester) GetGrantedAudience() fosite.Arguments { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetGrantedAudience") ret0, _ := ret[0].(fosite.Arguments) @@ -88,13 +88,13 @@ func (m *MockDeviceAuthorizeRequester) GetGrantedAudience() fosite.Arguments { } // GetGrantedAudience indicates an expected call of GetGrantedAudience. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetGrantedAudience() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetGrantedAudience() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGrantedAudience", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetGrantedAudience)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGrantedAudience", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetGrantedAudience)) } // GetGrantedScopes mocks base method. -func (m *MockDeviceAuthorizeRequester) GetGrantedScopes() fosite.Arguments { +func (m *MockDeviceUserRequester) GetGrantedScopes() fosite.Arguments { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetGrantedScopes") ret0, _ := ret[0].(fosite.Arguments) @@ -102,13 +102,13 @@ func (m *MockDeviceAuthorizeRequester) GetGrantedScopes() fosite.Arguments { } // GetGrantedScopes indicates an expected call of GetGrantedScopes. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetGrantedScopes() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetGrantedScopes() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGrantedScopes", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetGrantedScopes)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetGrantedScopes", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetGrantedScopes)) } // GetID mocks base method. -func (m *MockDeviceAuthorizeRequester) GetID() string { +func (m *MockDeviceUserRequester) GetID() string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetID") ret0, _ := ret[0].(string) @@ -116,13 +116,13 @@ func (m *MockDeviceAuthorizeRequester) GetID() string { } // GetID indicates an expected call of GetID. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetID() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetID() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetID", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetID)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetID", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetID)) } // GetRequestForm mocks base method. -func (m *MockDeviceAuthorizeRequester) GetRequestForm() url.Values { +func (m *MockDeviceUserRequester) GetRequestForm() url.Values { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRequestForm") ret0, _ := ret[0].(url.Values) @@ -130,13 +130,13 @@ func (m *MockDeviceAuthorizeRequester) GetRequestForm() url.Values { } // GetRequestForm indicates an expected call of GetRequestForm. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetRequestForm() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetRequestForm() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestForm", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetRequestForm)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestForm", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetRequestForm)) } // GetRequestedAt mocks base method. -func (m *MockDeviceAuthorizeRequester) GetRequestedAt() time.Time { +func (m *MockDeviceUserRequester) GetRequestedAt() time.Time { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRequestedAt") ret0, _ := ret[0].(time.Time) @@ -144,13 +144,13 @@ func (m *MockDeviceAuthorizeRequester) GetRequestedAt() time.Time { } // GetRequestedAt indicates an expected call of GetRequestedAt. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetRequestedAt() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetRequestedAt() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedAt", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetRequestedAt)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedAt", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetRequestedAt)) } // GetRequestedAudience mocks base method. -func (m *MockDeviceAuthorizeRequester) GetRequestedAudience() fosite.Arguments { +func (m *MockDeviceUserRequester) GetRequestedAudience() fosite.Arguments { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRequestedAudience") ret0, _ := ret[0].(fosite.Arguments) @@ -158,13 +158,13 @@ func (m *MockDeviceAuthorizeRequester) GetRequestedAudience() fosite.Arguments { } // GetRequestedAudience indicates an expected call of GetRequestedAudience. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetRequestedAudience() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetRequestedAudience() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedAudience", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetRequestedAudience)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedAudience", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetRequestedAudience)) } // GetRequestedScopes mocks base method. -func (m *MockDeviceAuthorizeRequester) GetRequestedScopes() fosite.Arguments { +func (m *MockDeviceUserRequester) GetRequestedScopes() fosite.Arguments { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRequestedScopes") ret0, _ := ret[0].(fosite.Arguments) @@ -172,13 +172,13 @@ func (m *MockDeviceAuthorizeRequester) GetRequestedScopes() fosite.Arguments { } // GetRequestedScopes indicates an expected call of GetRequestedScopes. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetRequestedScopes() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetRequestedScopes() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedScopes", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetRequestedScopes)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRequestedScopes", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetRequestedScopes)) } // GetSession mocks base method. -func (m *MockDeviceAuthorizeRequester) GetSession() fosite.Session { +func (m *MockDeviceUserRequester) GetSession() fosite.Session { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSession") ret0, _ := ret[0].(fosite.Session) @@ -186,49 +186,49 @@ func (m *MockDeviceAuthorizeRequester) GetSession() fosite.Session { } // GetSession indicates an expected call of GetSession. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GetSession() *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GetSession() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSession", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GetSession)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSession", reflect.TypeOf((*MockDeviceUserRequester)(nil).GetSession)) } // GrantAudience mocks base method. -func (m *MockDeviceAuthorizeRequester) GrantAudience(arg0 string) { +func (m *MockDeviceUserRequester) GrantAudience(arg0 string) { m.ctrl.T.Helper() m.ctrl.Call(m, "GrantAudience", arg0) } // GrantAudience indicates an expected call of GrantAudience. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GrantAudience(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GrantAudience(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrantAudience", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GrantAudience), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrantAudience", reflect.TypeOf((*MockDeviceUserRequester)(nil).GrantAudience), arg0) } // GrantScope mocks base method. -func (m *MockDeviceAuthorizeRequester) GrantScope(arg0 string) { +func (m *MockDeviceUserRequester) GrantScope(arg0 string) { m.ctrl.T.Helper() m.ctrl.Call(m, "GrantScope", arg0) } // GrantScope indicates an expected call of GrantScope. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) GrantScope(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) GrantScope(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrantScope", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).GrantScope), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GrantScope", reflect.TypeOf((*MockDeviceUserRequester)(nil).GrantScope), arg0) } // Merge mocks base method. -func (m *MockDeviceAuthorizeRequester) Merge(arg0 fosite.Requester) { +func (m *MockDeviceUserRequester) Merge(arg0 fosite.Requester) { m.ctrl.T.Helper() m.ctrl.Call(m, "Merge", arg0) } // Merge indicates an expected call of Merge. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) Merge(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) Merge(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Merge", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).Merge), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Merge", reflect.TypeOf((*MockDeviceUserRequester)(nil).Merge), arg0) } // Sanitize mocks base method. -func (m *MockDeviceAuthorizeRequester) Sanitize(arg0 []string) fosite.Requester { +func (m *MockDeviceUserRequester) Sanitize(arg0 []string) fosite.Requester { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Sanitize", arg0) ret0, _ := ret[0].(fosite.Requester) @@ -236,67 +236,67 @@ func (m *MockDeviceAuthorizeRequester) Sanitize(arg0 []string) fosite.Requester } // Sanitize indicates an expected call of Sanitize. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) Sanitize(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) Sanitize(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sanitize", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).Sanitize), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sanitize", reflect.TypeOf((*MockDeviceUserRequester)(nil).Sanitize), arg0) } // SetDeviceCodeSignature mocks base method. -func (m *MockDeviceAuthorizeRequester) SetDeviceCodeSignature(arg0 string) { +func (m *MockDeviceUserRequester) SetDeviceCodeSignature(arg0 string) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetDeviceCodeSignature", arg0) } // SetDeviceCodeSignature indicates an expected call of SetDeviceCodeSignature. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) SetDeviceCodeSignature(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) SetDeviceCodeSignature(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeviceCodeSignature", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).SetDeviceCodeSignature), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeviceCodeSignature", reflect.TypeOf((*MockDeviceUserRequester)(nil).SetDeviceCodeSignature), arg0) } // SetID mocks base method. -func (m *MockDeviceAuthorizeRequester) SetID(arg0 string) { +func (m *MockDeviceUserRequester) SetID(arg0 string) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetID", arg0) } // SetID indicates an expected call of SetID. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) SetID(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) SetID(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetID", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).SetID), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetID", reflect.TypeOf((*MockDeviceUserRequester)(nil).SetID), arg0) } // SetRequestedAudience mocks base method. -func (m *MockDeviceAuthorizeRequester) SetRequestedAudience(arg0 fosite.Arguments) { +func (m *MockDeviceUserRequester) SetRequestedAudience(arg0 fosite.Arguments) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetRequestedAudience", arg0) } // SetRequestedAudience indicates an expected call of SetRequestedAudience. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) SetRequestedAudience(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) SetRequestedAudience(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetRequestedAudience", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).SetRequestedAudience), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetRequestedAudience", reflect.TypeOf((*MockDeviceUserRequester)(nil).SetRequestedAudience), arg0) } // SetRequestedScopes mocks base method. -func (m *MockDeviceAuthorizeRequester) SetRequestedScopes(arg0 fosite.Arguments) { +func (m *MockDeviceUserRequester) SetRequestedScopes(arg0 fosite.Arguments) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetRequestedScopes", arg0) } // SetRequestedScopes indicates an expected call of SetRequestedScopes. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) SetRequestedScopes(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) SetRequestedScopes(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetRequestedScopes", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).SetRequestedScopes), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetRequestedScopes", reflect.TypeOf((*MockDeviceUserRequester)(nil).SetRequestedScopes), arg0) } // SetSession mocks base method. -func (m *MockDeviceAuthorizeRequester) SetSession(arg0 fosite.Session) { +func (m *MockDeviceUserRequester) SetSession(arg0 fosite.Session) { m.ctrl.T.Helper() m.ctrl.Call(m, "SetSession", arg0) } // SetSession indicates an expected call of SetSession. -func (mr *MockDeviceAuthorizeRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call { +func (mr *MockDeviceUserRequesterMockRecorder) SetSession(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSession", reflect.TypeOf((*MockDeviceAuthorizeRequester)(nil).SetSession), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSession", reflect.TypeOf((*MockDeviceUserRequester)(nil).SetSession), arg0) } diff --git a/internal/device_authorize_response.go b/internal/device_authorize_response.go index 54aadbbc0..9a77bcdbb 100644 --- a/internal/device_authorize_response.go +++ b/internal/device_authorize_response.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ory/fosite (interfaces: DeviceAuthorizeResponder) +// Source: github.com/ory/fosite (interfaces: DeviceUserResponder) // Package internal is a generated GoMock package. package internal @@ -14,43 +14,43 @@ import ( gomock "github.com/golang/mock/gomock" ) -// MockDeviceAuthorizeResponder is a mock of DeviceAuthorizeResponder interface. -type MockDeviceAuthorizeResponder struct { +// MockDeviceUserResponder is a mock of DeviceUserResponder interface. +type MockDeviceUserResponder struct { ctrl *gomock.Controller - recorder *MockDeviceAuthorizeResponderMockRecorder + recorder *MockDeviceUserResponderMockRecorder } -// MockDeviceAuthorizeResponderMockRecorder is the mock recorder for MockDeviceAuthorizeResponder. -type MockDeviceAuthorizeResponderMockRecorder struct { - mock *MockDeviceAuthorizeResponder +// MockDeviceUserResponderMockRecorder is the mock recorder for MockDeviceUserResponder. +type MockDeviceUserResponderMockRecorder struct { + mock *MockDeviceUserResponder } -// NewMockDeviceAuthorizeResponder creates a new mock instance. -func NewMockDeviceAuthorizeResponder(ctrl *gomock.Controller) *MockDeviceAuthorizeResponder { - mock := &MockDeviceAuthorizeResponder{ctrl: ctrl} - mock.recorder = &MockDeviceAuthorizeResponderMockRecorder{mock} +// NewMockDeviceUserResponder creates a new mock instance. +func NewMockDeviceUserResponder(ctrl *gomock.Controller) *MockDeviceUserResponder { + mock := &MockDeviceUserResponder{ctrl: ctrl} + mock.recorder = &MockDeviceUserResponderMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockDeviceAuthorizeResponder) EXPECT() *MockDeviceAuthorizeResponderMockRecorder { +func (m *MockDeviceUserResponder) EXPECT() *MockDeviceUserResponderMockRecorder { return m.recorder } // AddHeader mocks base method. -func (m *MockDeviceAuthorizeResponder) AddHeader(arg0, arg1 string) { +func (m *MockDeviceUserResponder) AddHeader(arg0, arg1 string) { m.ctrl.T.Helper() m.ctrl.Call(m, "AddHeader", arg0, arg1) } // AddHeader indicates an expected call of AddHeader. -func (mr *MockDeviceAuthorizeResponderMockRecorder) AddHeader(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockDeviceUserResponderMockRecorder) AddHeader(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddHeader", reflect.TypeOf((*MockDeviceAuthorizeResponder)(nil).AddHeader), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddHeader", reflect.TypeOf((*MockDeviceUserResponder)(nil).AddHeader), arg0, arg1) } // GetHeader mocks base method. -func (m *MockDeviceAuthorizeResponder) GetHeader() http.Header { +func (m *MockDeviceUserResponder) GetHeader() http.Header { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetHeader") ret0, _ := ret[0].(http.Header) @@ -58,7 +58,7 @@ func (m *MockDeviceAuthorizeResponder) GetHeader() http.Header { } // GetHeader indicates an expected call of GetHeader. -func (mr *MockDeviceAuthorizeResponderMockRecorder) GetHeader() *gomock.Call { +func (mr *MockDeviceUserResponderMockRecorder) GetHeader() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHeader", reflect.TypeOf((*MockDeviceAuthorizeResponder)(nil).GetHeader)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHeader", reflect.TypeOf((*MockDeviceUserResponder)(nil).GetHeader)) } diff --git a/oauth2.go b/oauth2.go index 7fe198883..196177bfd 100644 --- a/oauth2.go +++ b/oauth2.go @@ -103,19 +103,19 @@ type OAuth2Provider interface { // * https://tools.ietf.org/html/rfc6749#section-3.1.2.2 (everything MUST be implemented) WriteAuthorizeResponse(ctx context.Context, rw http.ResponseWriter, requester AuthorizeRequester, responder AuthorizeResponder) - // NewDeviceAuthorizeRequest returns an DeviceAuthorizeRequest. + // NewDeviceUserRequest returns an DeviceUserRequest. // This endpoint is a loose implementation of the Authorize endpoint // but instead of a code, it's a user_code that is generated by the device endpoint - NewDeviceAuthorizeRequest(ctx context.Context, req *http.Request) (DeviceAuthorizeRequester, error) + NewDeviceUserRequest(ctx context.Context, req *http.Request) (DeviceUserRequester, error) - // NewDeviceAuthorizeResponse + // NewDeviceUserResponse // This endpoint is a loose implementation of the Authorize endpoint // but instead of a code, it's a user_code that is generated by the device endpoint - NewDeviceAuthorizeResponse(ctx context.Context, requester DeviceAuthorizeRequester, session Session) (DeviceAuthorizeResponder, error) + NewDeviceUserResponse(ctx context.Context, requester DeviceUserRequester, session Session) (DeviceUserResponder, error) - // WriteDeviceAuthorizeResponse + // WriteDeviceUserResponse // Once the user is authorized, it is being redirect to the login page; - WriteDeviceAuthorizeResponse(ctx context.Context, r *http.Request, rw http.ResponseWriter, requester DeviceAuthorizeRequester, responder DeviceAuthorizeResponder) + WriteDeviceUserResponse(ctx context.Context, r *http.Request, rw http.ResponseWriter, requester DeviceUserRequester, responder DeviceUserResponder) // NewDeviceRequest validate the OAuth 2.0 Device Authorization Flow Request // @@ -303,8 +303,8 @@ type DeviceRequester interface { Requester } -// DeviceAuthorizeRequester is an device authorize endpoint's request context. -type DeviceAuthorizeRequester interface { +// DeviceUserRequester is an device authorize endpoint's request context. +type DeviceUserRequester interface { // SetDeviceCodeSignature set the device code signature SetDeviceCodeSignature(signature string) @@ -427,7 +427,7 @@ type G11NContext interface { GetLang() language.Tag } -type DeviceAuthorizeResponder interface { +type DeviceUserResponder interface { Responder }