Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
wood-push-melon committed Apr 11, 2024
1 parent d737e9d commit 01bfb6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions handler/openid/flow_device_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package openid

import (
"context"
"fmt"

"github.com/ory/fosite/handler/rfc8628"

Expand All @@ -26,11 +27,12 @@ type OpenIDConnectDeviceHandler struct {

func (c *OpenIDConnectDeviceHandler) HandleDeviceEndpointRequest(ctx context.Context, dar fosite.DeviceRequester, resp fosite.DeviceResponder) error {
if !(dar.GetGrantedScopes().Has("openid")) {
return nil
return errorsx.WithStack(fosite.ErrInvalidScope.WithDebug("invalid openid scopes"))
}

fmt.Printf("in openid auth handler")
if !dar.GetClient().GetGrantTypes().Has(string(fosite.GrantTypeDeviceCode)) {
return nil
return errorsx.WithStack(fosite.ErrInvalidGrant.WithDebug("invalid device flow grant type"))
}

if resp.GetDeviceCode() == "" {
Expand All @@ -48,3 +50,5 @@ func (c *OpenIDConnectDeviceHandler) HandleDeviceEndpointRequest(ctx context.Con

return nil
}

var _ fosite.DeviceEndpointHandler = (*OpenIDConnectDeviceHandler)(nil)
2 changes: 2 additions & 0 deletions handler/openid/flow_device_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ func (c *OpenIDConnectDeviceHandler) CanSkipClientAuth(ctx context.Context, requ
func (c *OpenIDConnectDeviceHandler) CanHandleTokenEndpointRequest(ctx context.Context, requester fosite.AccessRequester) bool {
return requester.GetGrantTypes().ExactOne(string(fosite.GrantTypeDeviceCode))
}

var _ fosite.TokenEndpointHandler = (*OpenIDConnectDeviceHandler)(nil)

0 comments on commit 01bfb6d

Please sign in to comment.