revoke all refresh tokens and use all authorization codes for user

This commit is contained in:
Philippe Loctaux 2023-03-18 22:03:03 +01:00
parent 5100aa1b4e
commit 009b8664fd
11 changed files with 94 additions and 8 deletions

View file

@ -54,4 +54,17 @@ impl AuthorizationCodes {
Ok((query.rows_affected() == 1).then_some(()))
}
pub async fn use_all_for_user(
conn: impl SqliteExecutor<'_>,
user: &str,
) -> Result<Option<()>, Error> {
let query: SqliteQueryResult =
sqlx::query_file!("queries/authorization_codes/use_all_for_user.sql", user)
.execute(conn)
.await
.map_err(handle_error)?;
Ok((query.rows_affected() >= 1).then_some(()))
}
}

View file

@ -58,4 +58,17 @@ impl RefreshTokens {
Ok((query.rows_affected() == 1).then_some(()))
}
pub async fn revoke_all_for_user(
conn: impl SqliteExecutor<'_>,
user: &str,
) -> Result<Option<()>, Error> {
let query: SqliteQueryResult =
sqlx::query_file!("queries/refresh_tokens/revoke_all_for_user.sql", user)
.execute(conn)
.await
.map_err(handle_error)?;
Ok((query.rows_affected() >= 1).then_some(()))
}
}