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

Integrate JSON Web tokens #21

Closed
pdonorio opened this issue May 19, 2016 · 10 comments
Closed

Integrate JSON Web tokens #21

pdonorio opened this issue May 19, 2016 · 10 comments
Assignees

Comments

@pdonorio
Copy link
Owner

They will help us to remove any database on the Flask instance on the frontend side.

@pdonorio
Copy link
Owner Author

There are the functions to use:
https://pyjwt.readthedocs.io/en/latest/usage.html

@pdonorio
Copy link
Owner Author

We are not going to use Flask-JWT as it does what Flask-Login is already doing for us

@pdonorio
Copy link
Owner Author

We should check which info to add to the JWT to be sure that the token can be invalidated on user request (or admin operation)

@pdonorio
Copy link
Owner Author

A good tutorial to understand JWT content:
http://blog.apcelent.com/json-web-token-tutorial-example-python.html

pdonorio pushed a commit to EUDAT-B2STAGE/http-api-base that referenced this issue May 19, 2016
@pdonorio
Copy link
Owner Author

This issue raised another question, now that we are learning more about authentication:

it feels like Flask Login and Security gives too much bloatware and take too much control.
Since JWT is very great at keeping data in a secure way that can be passed, we could use it to avoid some database query and make some mechanism to authenticate with our own code, giving us some power.

I will think about this in the weekend.

pdonorio pushed a commit to EUDAT-B2STAGE/http-api-base that referenced this issue May 22, 2016
Let's start with some mega clean:

- remove Flask Security
- and so removing Flask Login
- and removing also Flask admin

JWT will help me saved my world. I hope.

See pdonorio/restangulask#21
pdonorio pushed a commit to EUDAT-B2STAGE/http-api-base that referenced this issue May 22, 2016
The scheme is complete,
if i use valid credentials i get a JWT token.
If i use this token on login_required endpoints,
i get the payload from the JWT token.

Very happy :)

See pdonorio/restangulask#21
@pdonorio
Copy link
Owner Author

Have been testing JWT all week.

They're so awesome they made us dump three Flask plugins and write our own authentication module!

@pdonorio
Copy link
Owner Author

Note: JWT created at each login with valid credentials is always valid.

We should save tokens created inside a global Graphdb node.
It should also save informations like: IP, hostname, timestamp_latest_activity, and so on.

@mdantonio
Copy link
Collaborator

Also note that such information can also be used to create a list of authenticated sessions to allow the user to force the logout of remote sessions

@pdonorio
Copy link
Owner Author

@mdantonio
Probably we may close here and create a separated issue for this "authenticated sessions" table.

@pdonorio
Copy link
Owner Author

JWT specifications will go on with #23

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

No branches or pull requests

2 participants