Skip to content
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

bottle-jwt isn't stateless #14

Open
oz123 opened this issue Nov 16, 2017 · 0 comments
Open

bottle-jwt isn't stateless #14

oz123 opened this issue Nov 16, 2017 · 0 comments

Comments

@oz123
Copy link

oz123 commented Nov 16, 2017

First, thanks for putting bottle-jwt in the open! It really helped me.
However, there is one thing which I think might be improved.

JWTs are a great authentication mechanism. They give you a structured and stateless way to declare a user and what they can access. They can be cryptographically signed and encrypted to prevent tampering on the client side.

From https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage.

In this plugin's code it is not the case. Suppose I want to store my user info in some kind of persistent storage, then I implement a custom backend which saves the info to let's say MongoDB.

Every time the plugin validates the token it calls:

user = self.backend.get_user(...)

Which calls the database. This isn't stateless, and further. It retrieves information which should already found in the token itself.

IMHO user = self.backend.get_user(...) should only be called in create_token
and validate should only validate with jwt.decode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant