-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Suggestion] Authentication Flow #2
Comments
For less experiencied readers: |
I agree with the general idea, but depending on what we're using this could automatically be done. We should decide wether we want to have full control here before deciding manual/automatic |
I sugest using a diagram (can be a simple drawing) illustrating the flow ( i get it, but others might not) |
If we decide to use this flow: If we kicked a person, and the refresh token is not expired, would the person be able to access the application? |
Fenix authentication: Should be doable inside the application, having to go to a console is kinda garbage |
No, if we delete the refresh token from the database, the user would lose access within 10 minutes (until the JWT expires).
Yes, Fenix authentication would be done in the UI. It shouldn't be hard to login.
I'll work on that for the meeting :) |
My bad, i was reffering to
|
@Hugo-Marques-work Ah, yeah. I was referring to the admin dashboard as 'admin console'. It is supposed to be a UI. |
Hugo Mark Of Approval: 👍
This is my idea for the Authentication Flow for HS Inventory. This need to be discussed in the first HS Inventory meeting.
Fenix Authentication 👍
Obviously, we're going to require everyone to login through Fenix. This ensures that only members of the HS Community can login. A list of authorized users can be managed through the admin console by an admin, by adding/removing their IST ID.
Json Web Tokens (JWT) - Short-lived
JWT tokens can be used as short-lived tokens for faster authorization. They don't need to be checked against a database, which means they're extremely efficient. They work by signing the token with a secret, so their content can't be changed without the signature failing.
We can use these tokens as a short-lived authentication method, that only lasts around 10 to 20 minutes.
These tokens have the downside that they can't be revoked remotely, in case they're compromised. That's why it's important to keep their lifespan as short as possible.
Access Tokens - Long-lived refresh tokens
Along with JWT, a refresh token is sent to the client on login. This can have a longer lifespan (let's say, a month), which would allow the client to ask for a JWT when theirs expires. In contrary to a JWT, this refresh token is stored in the database, which means it's slower to authenticate, but it can be remotely disabled if it's compromised.
Using JWT and refresh tokens together
For a very secure application, we can take advantage of both types of tokens. The authentication/authorization flow would be as follows:
The server verifies the signature of the JWT, authorizing the request.
A cron job should be created to periodically delete expired refresh tokens from the database.
Flowchart:
The text was updated successfully, but these errors were encountered: