Skip to content

Commit

Permalink
update keyname
Browse files Browse the repository at this point in the history
  • Loading branch information
pawanpinjarkar committed Nov 5, 2024
1 parent 92f3583 commit 98721f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/asset/agent/gencrypto/authconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func keyPairPEM() (string, string, error) {
func generateToken(userPersona string, privateKeyPem string, expiry *time.Time) (string, error) {
// Create the JWT claims
claims := jwt.MapClaims{
"sub": userPersona,
"auth_scheme": userPersona,
}
// Set the expiry time if provided
if expiry != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/agent/gencrypto/authconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ func TestAuthConfig_Generate(t *testing.T) {
// verify each token is signed with correct persona
claims, err := ParseToken(authConfigAsset.AgentAuthToken)
assert.NoError(t, err)
persona, ok := claims["sub"].(string)
persona, ok := claims["auth_scheme"].(string)
assert.Equal(t, persona, agentPersona)
assert.Equal(t, ok, true)

claims, err = ParseToken(authConfigAsset.UserAuthToken)
assert.NoError(t, err)
persona, ok = claims["sub"].(string)
persona, ok = claims["auth_scheme"].(string)
assert.Equal(t, persona, userPersona)
assert.Equal(t, ok, true)

claims, err = ParseToken(authConfigAsset.WatcherAuthToken)
assert.NoError(t, err)
persona, ok = claims["sub"].(string)
persona, ok = claims["auth_scheme"].(string)
assert.Equal(t, persona, watcherPersona)
assert.Equal(t, ok, true)
})
Expand Down

0 comments on commit 98721f8

Please sign in to comment.