-
Notifications
You must be signed in to change notification settings - Fork 24
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 creation of multiple access tokens per client id #65
Conversation
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
============================================
+ Coverage 83.93% 83.96% +0.02%
Complexity 180 180
============================================
Files 20 20
Lines 635 636 +1
============================================
+ Hits 533 534 +1
Misses 102 102
Continue to review full report at Codecov.
|
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.
@DeepDiver1975 Please also have a look at the OAuthApiController
. I think it is not enough to just remove the three lines.
One has to think of the following:
- I think it is no problem to issue multiple authorization codes. If a client doesn't use one it will expire after 10 minutes and will be deleted by the background job.
- With a valid authorization code an access token can be requested. Again, there is no problem in having multiple access tokens per client. Together with these access tokens there are refresh tokens issued.
- With a valid refresh token an access token can be requested, too. And I think we have to be careful here. We have to delete the old access token that is refreshed using the refresh token. In the current implementation it is simply done by deleting all access tokens and refresh tokens and issuing a completely new pair. But when allowing multiple access tokens we need to change the model to remember the connection between an access token and its refresh token. If this access token gets refreshed we can delete both and issue a new pair. We also have to remember that an access token could already be deleted when getting refreshed with a refresh token.
Does that make sense?
Absolutly! Thanks a lot for pointing this out. Lets add a relationship between refresh token and access token - similar to https://github.com/thephpleague/oauth2-server/blob/master/src/Entities/RefreshTokenEntityInterface.php#L42-L54 |
309a0b8
to
e3397db
Compare
I tested the use case of the client with several time the same account (which should not really be supported use case), and it works fine 👍 . The surprising thing is that even restarting the client works fine despite the fact that, as I mention in owncloud/client#5830 (comment) , the client only store one |
the refresh token is deleted after use - see https://github.com/owncloud/oauth2/pull/65/files#diff-db452df3926cad18dfda329e7e3fddf4R176 something not working properly here? |
I'd say no, they have to maintain a 1-1 rel. with the The |
The client does two POST to the |
can you test this with consecutive calls? |
I run the scenario quite some times now and I saw that reproduced a few of them. So the race is to be considered, yes.
And those times the requests don't reach the server that simultaneously, the first POST succeeds; second is replied:
... and the client pops-up a new browser to Authorize the app again. So after all, we might need to adapt client-side for the edge-case in owncloud/client#5830 😕 (i.e. one of the logged-in accounts is left unauthorized upon client restart). Also, if we space in time the POST requests to That will never happen in the scenario of 2 independent clients sharing the same |
let me rebase 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.
Concurrency issues moved to #70 - apart from that, rest of the PR is 👍
fixes #64