34 lines
1004 B
Rust
34 lines
1004 B
Rust
use super::super::models::oauth::*;
|
|
use std::future::Future;
|
|
|
|
pub trait OAuthRepository: Clone + Send + Sync + 'static {
|
|
fn find_client_by_id(
|
|
&self,
|
|
id: uuid::Uuid,
|
|
) -> impl Future<Output = Result<Option<Client>, anyhow::Error>> + Send;
|
|
|
|
fn create_authorization_code(
|
|
&self,
|
|
user_id: uuid::Uuid,
|
|
client_id: uuid::Uuid,
|
|
code_challenge: String,
|
|
code_challenge_method: CodeChallengeMethod,
|
|
) -> impl Future<Output = Result<AuthorizationCode, anyhow::Error>> + Send;
|
|
|
|
fn is_authorized_client(
|
|
&self,
|
|
user_id: uuid::Uuid,
|
|
client_id: uuid::Uuid,
|
|
) -> impl Future<Output = Result<bool, anyhow::Error>> + Send;
|
|
|
|
fn get_token_subject(
|
|
&self,
|
|
code: AuthorizationCode,
|
|
) -> impl Future<Output = Result<Option<TokenSubject>, anyhow::Error>> + Send;
|
|
|
|
fn delete_token(
|
|
&self,
|
|
code: AuthorizationCode,
|
|
) -> impl Future<Output = Result<(), anyhow::Error>> + Send;
|
|
}
|