Skip to content

Commit

Permalink
refactor: remove unnecessary receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-elliott authored and aeneasr committed Feb 25, 2023
1 parent b0a67df commit d6e19a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 0 additions & 4 deletions access_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,3 @@ func (a *AccessRequest) GetRefreshTokenGrantedScopes() (scopes Arguments) {
func (a *AccessRequest) SetRefreshTokenGrantedScopes(scopes Arguments) {
a.RefreshTokenGrantedScope = scopes
}

func (a *AccessRequest) SetGrantedScopes(scopes Arguments) {
a.GrantedScope = scopes
}
12 changes: 4 additions & 8 deletions handler/oauth2/flow_refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,11 @@ func (c *RefreshTokenGrantHandler) PopulateTokenEndpointResponse(ctx context.Con
}

if rtRequest, ok := requester.(fosite.RefreshTokenAccessRequester); ok {
r := requester.Sanitize([]string{}).(*fosite.Request)
r.SetID(ts.GetID())
rtStoreReq := requester.Sanitize([]string{}).(*fosite.Request)
rtStoreReq.SetID(ts.GetID())

rtStoreReq := &fosite.AccessRequest{
Request: *r,
}

rtStoreReq.SetRequestedScopes(rtRequest.GetRefreshTokenRequestedScopes())
rtStoreReq.SetGrantedScopes(rtRequest.GetRefreshTokenGrantedScopes())
rtStoreReq.RequestedScope = rtRequest.GetRefreshTokenRequestedScopes()
rtStoreReq.GrantedScope = rtRequest.GetRefreshTokenGrantedScopes()

if err = c.TokenRevocationStorage.CreateRefreshTokenSession(ctx, refreshSignature, rtStoreReq); err != nil {
return err
Expand Down
4 changes: 0 additions & 4 deletions oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ type RefreshTokenAccessRequester interface {
// SetRefreshTokenGrantedScopes sets all granted scopes specifically for the refresh token.
SetRefreshTokenGrantedScopes(scopes Arguments)

// SetGrantedScopes sets all granted scopes. This is specifically used in the refresh flow to restore the originally
// granted scopes to the session.
SetGrantedScopes(scopes Arguments)

AccessRequester
}

Expand Down

0 comments on commit d6e19a1

Please sign in to comment.