-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Allow token to expire #9491
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
Allow token to expire #9491
Conversation
a9e1969 to
04f31ee
Compare
ChristophWurst
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.
Code looks good!
4ce8863 to
9c78929
Compare
Codecov Report
@@ Coverage Diff @@
## master #9491 +/- ##
============================================
- Coverage 51.69% 51.69% -0.01%
- Complexity 25725 25735 +10
============================================
Files 1641 1643 +2
Lines 96454 96482 +28
Branches 1393 1393
============================================
+ Hits 49866 49878 +12
- Misses 46588 46604 +16
|
| } | ||
|
|
||
| if ($token->getExpires() !== null && $token->getExpires() < $this->time->getTime()) { | ||
| throw new ExpiredTokenException($token); |
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.
Add this to the PHPDocs?
| } | ||
|
|
||
| if ($token->getExpires() !== null && $token->getExpires() < $this->time->getTime()) { | ||
| throw new ExpiredTokenException($token); |
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.
Same here.
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..
MorrisJobke
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.
Beside the little documentation nitpicks this looks fine 👍
However due to the nature of what we store in the token (encrypted passwords etc). We can't just delete the tokens because that would make the oauth refresh useless. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
9c78929 to
6b7cf46
Compare
Requires:
Allows for tokens to be expired (for OAuth).
To make sure auth doesn't happen with expired tokens we thrown an ExpiredTokenException (that does hold the token). This seemed easier than adding a check everywhere we use it.
The tokens need to stay in the DB else we can't refresh them later.