Filter inactive and private oidc auth methods from unauthenticated list requests (#1110)
This commit is contained in:
1 parent
ca57e50516
commit
072b950540
8 files changed
+155
-36
No files matched your search
@@ -114,20 +114,20 @@ func Test_Callback(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
setup func() // provide a simple way to do some prework before the test.
|
||||
oidcRepoFn OidcRepoFactory // returns a new oidc repo
|
||||
iamRepoFn IamRepoFactory // returns a new iam repo
|
||||
atRepoFn AuthTokenRepoFactory // returns a new auth token repo
|
||||
am *AuthMethod // the authmethod for the test
|
||||
state string // state parameter for test provider and Callback(...)
|
||||
code string // code parameter for test provider and Callback(...)
|
||||
wantSubject string // sub claim from id token
|
||||
wantInfoName string // name claim from userinfo
|
||||
wantInfoEmail string // email claim from userinfo
|
||||
wantFinalRedirect string // final redirect from Callback(...)
|
||||
wantErrMatch *errors.Template // error template to match
|
||||
wantErrContains string // error string should contain
|
||||
name string
|
||||
setup func() // provide a simple way to do some prework before the test.
|
||||
oidcRepoFn OidcRepoFactory // returns a new oidc repo
|
||||
iamRepoFn IamRepoFactory // returns a new iam repo
|
||||
atRepoFn AuthTokenRepoFactory // returns a new auth token repo
|
||||
am *AuthMethod // the authmethod for the test
|
||||
state string // state parameter for test provider and Callback(...)
|
||||
code string // code parameter for test provider and Callback(...)
|
||||
wantSubject string // sub claim from id token
|
||||
wantInfoName string // name claim from userinfo
|
||||
wantInfoEmail string // email claim from userinfo
|
||||
wantFinalRedirect string // final redirect from Callback(...)
|
||||
wantErrMatch *errors.Template // error template to match
|
||||
wantErrContains string // error string should contain
|
||||
}{
|
||||
{
|
||||
name: "simple", // must remain the first test
|
||||
@@ -234,15 +234,15 @@ func Test_Callback(t *testing.T) {
|
||||
wantErrContains: "missing auth method",
|
||||
},
|
||||
{
|
||||
name: "mismatch-auth-method",
|
||||
oidcRepoFn: repoFn,
|
||||
iamRepoFn: iamRepoFn,
|
||||
atRepoFn: atRepoFn,
|
||||
am: testAuthMethod,
|
||||
state: testState(t, testAuthMethod2, kmsCache, testTokenRequestId, 2000*time.Second, "https://testcontroler.com/hi-alice", testConfigHash, testNonce),
|
||||
code: "simple",
|
||||
wantErrMatch: errors.T(errors.InvalidParameter),
|
||||
wantErrContains: "auth method id does not match request wrapper auth method id",
|
||||
name: "mismatch-auth-method",
|
||||
oidcRepoFn: repoFn,
|
||||
iamRepoFn: iamRepoFn,
|
||||
atRepoFn: atRepoFn,
|
||||
am: testAuthMethod,
|
||||
state: testState(t, testAuthMethod2, kmsCache, testTokenRequestId, 2000*time.Second, "https://testcontroler.com/hi-alice", testConfigHash, testNonce),
|
||||
code: "simple",
|
||||
wantErrMatch: errors.T(errors.InvalidParameter),
|
||||
wantErrContains: "auth method id does not match request wrapper auth method id",
|
||||
},
|
||||
{
|
||||
name: "bad-state-encoding",
|
||||
|
||||
Reference in new issue
Block a user