Skip to content

Commit

Permalink
filters/auth: refactor OIDC tests (#1937)
Browse files Browse the repository at this point in the history
* Uses eskip to define filters in `TestOIDCSetup`
* Moves filter creation tests from `TestOIDCSetup` to `TestCreateFilterOIDC`

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Dec 17, 2021
1 parent b7e432a commit 8444aeb
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 215 deletions.
6 changes: 3 additions & 3 deletions filters/auth/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ type (
)

// NewOAuthOidcUserInfos creates filter spec which tests user info.
func NewOAuthOidcUserInfos(secretsFile string, secretsRegistry *secrets.Registry) filters.Spec {
func NewOAuthOidcUserInfos(secretsFile string, secretsRegistry secrets.EncrypterCreator) filters.Spec {
return &tokenOidcSpec{typ: checkOIDCUserInfo, SecretsFile: secretsFile, secretsRegistry: secretsRegistry}
}

// NewOAuthOidcAnyClaims creates a filter spec which verifies that the token
// has one of the claims specified
func NewOAuthOidcAnyClaims(secretsFile string, secretsRegistry *secrets.Registry) filters.Spec {
func NewOAuthOidcAnyClaims(secretsFile string, secretsRegistry secrets.EncrypterCreator) filters.Spec {
return &tokenOidcSpec{typ: checkOIDCAnyClaims, SecretsFile: secretsFile, secretsRegistry: secretsRegistry}
}

// NewOAuthOidcAllClaims creates a filter spec which verifies that the token
// has all the claims specified
func NewOAuthOidcAllClaims(secretsFile string, secretsRegistry *secrets.Registry) filters.Spec {
func NewOAuthOidcAllClaims(secretsFile string, secretsRegistry secrets.EncrypterCreator) filters.Spec {
return &tokenOidcSpec{typ: checkOIDCAllClaims, SecretsFile: secretsFile, secretsRegistry: secretsRegistry}
}

Expand Down
Loading

0 comments on commit 8444aeb

Please sign in to comment.