-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
do omit exp if ExpiresAt is zero value #334
do omit exp if ExpiresAt is zero value #334
Conversation
Signed-off-by: nerocrux <nerocrux@gmail.com>
Due to community feedback, I think it would make sense to have refresh tokens expire optionally. Basically you would be able to set a lifespan, but if none is set the refresh token expires after that time. I think the endpoint should still be able to omit the expiry if it's not set! |
@@ -202,6 +202,11 @@ func (f *Fosite) WriteIntrospectionResponse(rw http.ResponseWriter, r Introspect | |||
return | |||
} | |||
|
|||
expiresAt := int64(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.
Can you add a test (or modify an existing one) for this?
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.
Sure, will do later.
9a7fc1d
to
16d6d54
Compare
@aeneasr I have added some tests for this PR. Please take a look at it if you have time.
Got it. Have a nice weekend! |
fed290b
to
0b92ccb
Compare
0b92ccb
to
10f2864
Compare
Agreed, thank you for the changes! |
Signed-off-by: nerocrux <nerocrux@gmail.com>
Related issue
Proposed changes
exp
will be omitted ifGetExpiresAt(AccessToken)
is nil or zero value (no expiration)GetExpiresAt(AccessToken)
is zero value, Unix() will be called, andExpiresAt
will be set to-62135596800
because golang's zero time is0001-01-01T00:00:00Z
but not1970-01-01T00:00:00Z
Checklist
vulnerability, I confirm that I got green light (please contact hi@ory.sh) from the maintainers to push the changes.
by signing my commit(s). You can amend your signature to the most recent commit by using
git commit --amend -s
. If youamend the commit, you might need to force push using
git push --force HEAD:<branch>
. Please be very careful when usingforce push.
Further comments
exp
. Not sure if this is corrent. Maybe it's better to always omit exp field if we introspect RefreshToken, because there is no expiration time for RefreshToken.exp
for introspect RefreshToken is good, I will fire another PR.Thank you!