Skip to content

Commit

Permalink
fix: field name
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Oct 24, 2024
1 parent 0dedd68 commit 13a231a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/tcl/testworkflowstcl/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func GetRunningContext(runContext, token string, interfaceType testkube.TestWork
if token != "" {
payload, err := getJWTPayload(token)
if err == nil {
if value, ok := payload["userame"]; ok {
if value, ok := payload["name"]; ok {
name = fmt.Sprint(value)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/tcl/testworkflowstcl/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func TestCmd_GetJWTPayload(t *testing.T) {
t.Parallel()

header := base64.RawURLEncoding.EncodeToString([]byte(`{"alg":"HS256","typ":"JWT"}`))
payload := base64.RawURLEncoding.EncodeToString([]byte(`{"sub":"1234567890","username":"John Doe","email":"[email protected]"}`))
payload := base64.RawURLEncoding.EncodeToString([]byte(`{"sub":"1234567890","name":"John Doe","email":"[email protected]"}`))
signature := "signature"

token := fmt.Sprintf("%s.%s.%s", header, payload, signature)

expectedPayload := map[string]interface{}{
"sub": "1234567890",
"username": "John Doe",
"email": "[email protected]",
"sub": "1234567890",
"name": "John Doe",
"email": "[email protected]",
}

result, err := getJWTPayload(token)
Expand Down

0 comments on commit 13a231a

Please sign in to comment.