Remove unused request param from InitiateWithState
The r *http.Request parameter was not read inside InitiateWithState — all test call sites passed nil. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -117,7 +117,7 @@ func (c *OAuth2Connector) Initiate(
|
|||||||
stateData.ContinueURL = continueURL
|
stateData.ContinueURL = continueURL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c.InitiateWithState(ctx, stateData, opts, r)
|
return c.InitiateWithState(ctx, stateData, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitiateWithState generates an OAuth2 authorization URL with a custom state.
|
// InitiateWithState generates an OAuth2 authorization URL with a custom state.
|
||||||
@@ -126,7 +126,6 @@ func (c *OAuth2Connector) InitiateWithState(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
stateData OAuth2State,
|
stateData OAuth2State,
|
||||||
opts InitiateOptions,
|
opts InitiateOptions,
|
||||||
r *http.Request,
|
|
||||||
) (string, error) {
|
) (string, error) {
|
||||||
state, err := statelesstoken.NewToken(c.ClientSecret, OAuth2TokenType, OAuth2TokenTTL, stateData)
|
state, err := statelesstoken.NewToken(c.ClientSecret, OAuth2TokenType, OAuth2TokenTTL, stateData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
OAuth2State{OrganizationID: orgID.String(), Provider: "TEST"},
|
OAuth2State{OrganizationID: orgID.String(), Provider: "TEST"},
|
||||||
InitiateOptions{Scopes: []string{"read:user", "write:user"}},
|
InitiateOptions{Scopes: []string{"read:user", "write:user"}},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -303,7 +302,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
OAuth2State{OrganizationID: orgID.String(), Provider: "TEST"},
|
OAuth2State{OrganizationID: orgID.String(), Provider: "TEST"},
|
||||||
InitiateOptions{},
|
InitiateOptions{},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -332,7 +330,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
Scopes: []string{"read:user"},
|
Scopes: []string{"read:user"},
|
||||||
IncludeGrantedScopes: true,
|
IncludeGrantedScopes: true,
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -361,7 +358,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
Scopes: []string{"read:user"},
|
Scopes: []string{"read:user"},
|
||||||
IncludeGrantedScopes: true,
|
IncludeGrantedScopes: true,
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -387,7 +383,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
context.Background(),
|
context.Background(),
|
||||||
OAuth2State{OrganizationID: orgID.String(), Provider: "TEST"},
|
OAuth2State{OrganizationID: orgID.String(), Provider: "TEST"},
|
||||||
InitiateOptions{Scopes: []string{"read:user"}},
|
InitiateOptions{Scopes: []string{"read:user"}},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -420,7 +415,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
Scopes: []string{"read:user"},
|
Scopes: []string{"read:user"},
|
||||||
IncludeGrantedScopes: true,
|
IncludeGrantedScopes: true,
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -455,7 +449,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
Scopes: []string{"read:user"},
|
Scopes: []string{"read:user"},
|
||||||
IncludeGrantedScopes: false, // first install, no existing grant
|
IncludeGrantedScopes: false, // first install, no existing grant
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
@@ -489,7 +482,6 @@ func TestInitiateWithState_Scopes(t *testing.T) {
|
|||||||
Scopes: []string{"read:user"},
|
Scopes: []string{"read:user"},
|
||||||
IncludeGrantedScopes: true, // caller requested, but provider does not support
|
IncludeGrantedScopes: true, // caller requested, but provider does not support
|
||||||
},
|
},
|
||||||
nil,
|
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user