Skip to content

Commit

Permalink
feat: add system key not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Nov 30, 2023
1 parent ee732c8 commit 8b306a4
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions internal/authenticator/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,40 @@ func TestBuilderInternalAuthenticator(t *testing.T) {
require.Len(vendors, 1)
require.Contains(vendors, "internal")
}

func TestBuilderInternalAuthenticatorWithInvalidKey(t *testing.T) {
t.Parallel()

require := require.New(t)

b := authenticator.Builder{
Vendors: []config.Vendor{
{
Company: "internal",
Jwt: config.Jwt{
IssName: "iss",
SubName: "sub",
SigningMethod: "HS512",
},
IsInternal: true,
UseValidator: false,
AllowedAccessTypes: nil,
Topics: nil,
HashIDMap: nil,
IssEntityMap: nil,
IssPeerMap: nil,
Keys: map[string]string{
"not-system": "c2VjcmV0",
},
},
},
Logger: zap.NewNop(),
ValidatorConfig: config.Validator{
URL: "",
Timeout: 0,
},
}

_, err := b.Authenticators()
require.ErrorIs(err, authenticator.ErrAdminAuthenticatorSystemKey)
}

0 comments on commit 8b306a4

Please sign in to comment.