Added expiration time for revoked tokens
This commit is contained in:
@@ -110,10 +110,12 @@ async fn logout(req: HttpRequest, app_state: Data<AppState>) -> impl Responder {
|
||||
);
|
||||
match token {
|
||||
Ok(token) => {
|
||||
let exp = token.claims.exp as i64;
|
||||
if query!(
|
||||
"INSERT INTO revoked ( token_id, user_id ) VALUES ( $1, $2 )",
|
||||
"INSERT INTO revoked ( token_id, user_id, expires ) VALUES ( $1, $2, $3 )",
|
||||
token.claims.kid,
|
||||
token.claims.uid
|
||||
token.claims.uid,
|
||||
exp
|
||||
)
|
||||
.execute(&app_state.database)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user