Skip to content

Commit

Permalink
Include UserId in leaf tokens (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrewster authored Mar 6, 2023
1 parent ad59d9d commit ea64d3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (a *SigningAuthority) Sign(audience string) (string, error) {
Slug: a.identity.Slug,
Aud: audience,
OriginReplid: a.identity.OriginReplid,
UserId: a.identity.UserId,
}

token, err := signIdentity(a.privateKey, a.signingAuthority, &replIdentity)
Expand Down
2 changes: 2 additions & 0 deletions sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ func TestAnyReplIDIdentity(t *testing.T) {
User: "user",
Slug: "slug",
Aud: "another-audience",
UserId: 1,
}

privkey, identity, err := identityTokenAnyRepl("repl", "user", "slug")
Expand Down Expand Up @@ -516,4 +517,5 @@ func TestAnyReplIDIdentity(t *testing.T) {
assert.Equal(t, "a-b-c-d", replIdentity.Replid)
assert.Equal(t, "user", replIdentity.User)
assert.Equal(t, "slug", replIdentity.Slug)
assert.Equal(t, int64(1), replIdentity.UserId)
}

0 comments on commit ea64d3b

Please sign in to comment.