-
Notifications
You must be signed in to change notification settings - Fork 43
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
Implement token revocation #95
Conversation
args: Json<TokenArgs>, | ||
db: Data<Db>, | ||
req: HttpRequest, | ||
) -> impl Future<Item = HttpResponse, Error = ApiError> { |
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.
Any reason to not use the async
keyword? It does more than just being eye candy.
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.
We are using a very old version of Actix that uses futures 0.1, so the extra functions convert from std futures to the old ones with .compat()
.
token_ids: Vec<String>, | ||
} | ||
|
||
pub fn get_tokens( |
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.
As Jamie pointed out, this is just as async as the other function, why have two?
I would appreciate if we could land #92 so we don't have to keep adding more "old" way of doing things from diesel side. |
002ab9f
to
5d2d299
Compare
This will allow us to check the database for revocations.
Check the database to see if a token ID has been revoked. Also, record the timestamp of the last time a token is used, to help debugging. Also added a "tokenmanagement" scope and endpoints to list tokens and revoke them.
5d2d299
to
6b308f1
Compare
For tokens with a "jti" field, query the database to see if the token has been revoked. Also, log the time it was last used, to help debug and/or recognize suspicious activity.
There are two new endpoints, to list tokens (so the backend can show the last used time and whether a token is revoked) and to revoke tokens. The idea is for the backend to keep its own record of which tokens belong to which users, and invoke these endpoints on their behalf with its own token.
I've also added a config option to allow tokens to be prefixed. This makes it easier to recognize tokens that have been accidentally published.