-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add jwt signing and verification logic #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
cbb12c6 to
51875d6
Compare
51875d6 to
0f71483
Compare
|
cb80
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package signing is very much specific to JWT token, so I'd call it jwtsigning.
fabenan-f
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just small test-related stuff
| tb.Helper() | ||
|
|
||
| key, err := rsa.GenerateKey(rand.Reader, bits) | ||
| if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are using an assertion package everywhere, I'd stick with it for consistency reasons
| assert.NoError(t, err) | ||
|
|
||
| body := []byte("message-body") | ||
| tokenStr, err := signer.Sign(context.Background(), body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: t.Context() (also at other places)
jithinkunjachan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work
| return nil, ErrMissingIssOrKid | ||
| } | ||
|
|
||
| if len(v.trustedIssuers) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return error early while initialization of the verifier itself cause if the trustedIssuers is empty or nil we might accept jwt token signed by any malicious entity.



No description provided.