From d6e19a19a819fd9476607dfba51967a47655a0ce Mon Sep 17 00:00:00 2001 From: James Elliott Date: Tue, 13 Dec 2022 09:48:59 +1100 Subject: [PATCH] refactor: remove unnecessary receiver --- access_request.go | 4 ---- handler/oauth2/flow_refresh.go | 12 ++++-------- oauth2.go | 4 ---- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/access_request.go b/access_request.go index 5e24970f2..6fc21680a 100644 --- a/access_request.go +++ b/access_request.go @@ -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 -} diff --git a/handler/oauth2/flow_refresh.go b/handler/oauth2/flow_refresh.go index be4d52429..c520863bc 100644 --- a/handler/oauth2/flow_refresh.go +++ b/handler/oauth2/flow_refresh.go @@ -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 diff --git a/oauth2.go b/oauth2.go index 57d60ccfa..65b6227d0 100644 --- a/oauth2.go +++ b/oauth2.go @@ -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 }