Skip to content

Commit

Permalink
fix: fix oauth2 core storage interface and device flow session type a…
Browse files Browse the repository at this point in the history
…ssertion
  • Loading branch information
wood-push-melon committed Mar 24, 2024
1 parent b5e1e1d commit 91d5a11
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion handler/oauth2/flow_authorize_code_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func TestAuthorizeCode_PopulateTokenEndpointResponse(t *testing.T) {
var h GenericCodeTokenEndpointHandler

testCases := []struct {
areq *fosite.AccessRequest
description string
areq *fosite.AccessRequest
setup func(t *testing.T, areq *fosite.AccessRequest, config *fosite.Config)
check func(t *testing.T, aresp *fosite.AccessResponse)
expectErr error
Expand Down
1 change: 1 addition & 0 deletions handler/oauth2/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type CoreStorage interface {
AuthorizeCodeStorage
AccessTokenStorage
RefreshTokenStorage
}
Expand Down
4 changes: 2 additions & 2 deletions handler/rfc8628/strategy_hmacsha.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

// DeviceFlowSession is a fosite.Session container specific for the device flow.
type DeviceFlowSession interface {
// BrowserFlowCompleted returns the flag indicating whether user has completed the browser flow or not.
BrowserFlowCompleted() bool
// GetBrowserFlowCompleted returns the flag indicating whether user has completed the browser flow or not.
GetBrowserFlowCompleted() bool

// SetBrowserFlowCompleted allows client to mark user has completed the browser flow.
SetBrowserFlowCompleted(flag bool)
Expand Down
2 changes: 1 addition & 1 deletion handler/rfc8628/token_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (s DeviceSessionHandler) Session(ctx context.Context, requester fosite.Acce
return nil, errorsx.WithStack(fosite.ErrServerError.WithWrap(err).WithDebug(err.Error()))
}

session, ok := req.GetSession().(*DefaultDeviceFlowSession)
session, ok := req.GetSession().(DeviceFlowSession)
if !ok {
return nil, fosite.ErrServerError.WithHint("Wrong authorization request session.")
}
Expand Down

0 comments on commit 91d5a11

Please sign in to comment.