-
Notifications
You must be signed in to change notification settings - Fork 132
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
Replace JWT library for signing tokens #1308
Conversation
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.
Have some questions, but overall looks ok.
@@ -22,6 +22,7 @@ package auth | |||
|
|||
import ( | |||
"context" | |||
"github.com/golang-jwt/jwt/v5" |
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.
separate std imports from others.
Unrelated @Groxx Should we onboard client to gci too?
if err != nil { | ||
return nil, err | ||
|
||
ttl := int64(60 * 10) |
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.
why it is hardcoded? Should it be configurable?
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.
No sure why this was hard-coded during the initial implementation but my take is this: this ttl is for internal/self-signed tokens. There are no external calls to acquire a token, there's no caching involved, they are issued for every request, in other words, they are cheap and should be short lived.
internal/jwt_authorization_test.go
Outdated
@@ -21,60 +21,41 @@ | |||
package internal | |||
|
|||
import ( | |||
"encoding/json" | |||
"io/ioutil" | |||
"github.com/stretchr/testify/assert" |
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.
goimports
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.
done
c138c81
to
d94b61c
Compare
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.
LGTM
What changed?
Claims
with "Registered claims" from https://www.rfc-editor.org/rfc/rfc7519#section-4.1ExpiresAt
but also keeping TTL for backwards compatibilityWhy?
To align with upcoming server changes
How did you test it?
Unit tests
Potential risks