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

@ -50,4 +50,11 @@ impl AuthorizationCode {
pub async fn use_code(self, conn: impl SqliteExecutor<'_>) -> Result<Option<()>, Error> {
Ok(DatabaseAuthorizationCodes::use_code(conn, &self.code).await?)
}
pub async fn use_all_for_user(
&self,
conn: impl SqliteExecutor<'_>,
) -> Result<Option<()>, Error> {
Ok(DatabaseAuthorizationCodes::use_all_for_user(conn, self.user.as_ref()).await?)
}
}

View file

@ -26,4 +26,7 @@ impl AuthorizationCode {
pub fn has_expired(&self) -> bool {
self.expires_at < Utc::now()
}
pub fn user(&self) -> &UserID {
&self.user
}
}