Skip to content

Commit

Permalink
fix: error messages for public keys settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlakis committed Jan 6, 2025
1 parent a3ba619 commit d86a7e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/providers/oidc/provider_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func (p ProviderVerifierOptions) validate() error {
}

if p.SkipDiscovery && p.JWKsURL == "" && len(p.PublicKeyFiles) == 0 {
errs = append(errs, errors.New("missing required setting: jwks-url or public-keys"))
errs = append(errs, errors.New("missing required setting: jwks-url or public-key-files"))
}

if p.JWKsURL != "" && len(p.PublicKeyFiles) > 0 {
errs = append(errs, errors.New("mutually exclusive settings: jwks-url and public-keys"))
errs = append(errs, errors.New("mutually exclusive settings: jwks-url and public-key-files"))
}

if len(errs) > 0 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/providers/oidc/provider_verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ var _ = Describe("ProviderVerifier", func() {
p.SkipDiscovery = true
p.JWKsURL = ""
},
expectedError: "invalid provider verifier options: missing required setting: jwks-url or public-keys",
expectedError: "invalid provider verifier options: missing required setting: jwks-url or public-key-files",
}),
Entry("with skip discovery, the JWKs URL not empty and len(PublicKeyFiles) is greater than 0", &newProviderVerifierTableInput{
modifyOpts: func(p *ProviderVerifierOptions) {
p.SkipDiscovery = true
p.JWKsURL = "notEmpty"
p.PublicKeyFiles = []string{"notEmpty"}
},
expectedError: "invalid provider verifier options: mutually exclusive settings: jwks-url and public-keys",
expectedError: "invalid provider verifier options: mutually exclusive settings: jwks-url and public-key-files",
}),
Entry("should be successful when skipping discovery with the JWKs URL specified", &newProviderVerifierTableInput{
modifyOpts: func(p *ProviderVerifierOptions) {
Expand Down

0 comments on commit d86a7e5

Please sign in to comment.