-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Is there a way to store Doorkeeper::AccessToken data inside Doorkeeper::JWT (and not use db-backed tokens)? #1600
Comments
Currently there is now way to use just raw JWT tokens without database (and it's not possible for Doorkeeper by design as we can't revoke such tokens and do some other things which is a core of the gem) |
If anybody interested in this feature - I can suggest to create some |
@nbulaj We are also highly interested in it, but to me it seems like the perfect place for this would be the What is your take on that? |
Hey @mschoenlaub . I'm not sure how exactly you plan to extend You can try to if you want, I'll be happy to review it 🙇 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Steps to reproduce
Not a bug report, but a feature request for relying on token data storage inside issued JWT
I think this is either an undocumented existing feature (in which case I would appreciate a "how to" link), or more likely something that Doorkeeper 5.5 does not support.
Expected behavior
There should be a way to inform Doorkeeper / Doorkeeper::JWT to not use the
Doorkeeper::AccessToken
database model, and that instead the details such as client id, approved scopes etc should be stored and read direct from the JWT. This is a common use-case for JWTs as an authentication mechanism, that they embed data for access control.Specifically it would be
doorkeeper_authorize!
anddoorkeeper_token
helper methods that I would like to run without database backing on the read side. This primarily will require changes todoorkeeper
gem, and notdoorkeeper-jwt
although it may be possible to make changes to the latter for cleaner configuration.Actual behavior
As far as I can tell from a quick browse of the code and local testing, Doorkeeper always uses database-backed access tokens, and JWTs are not exceptions - the whole serialised JWT is used as an index string to lookup server-side credentials. That means for busy API services, we cannot explore the possibility of skipping the db I/O for granting and reading access tokens.
System configuration
Doorkeeper initializer:
Doorkeeper JWT initializer:
User and Doorkeeper::Application data could be similarly embedded on granting the token. This will make the token longer, but allow clients to skip more database reads on auth checks. Usually this would be combined with shorter token expiry times, and matches patterns of use for client apps that repeatedly make "one shot" requests and don't store access tokens.
The text was updated successfully, but these errors were encountered: