avam-client and oauth2
This commit is contained in:
33
src/lib/domain/api/ports/oauth_repository.rs
Normal file
33
src/lib/domain/api/ports/oauth_repository.rs
Normal file
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
Reference in New Issue
Block a user