mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-09 22:07:53 -06:00
29 lines
661 B
Rust
29 lines
661 B
Rust
use async_trait::async_trait;
|
|
use mockall::automock;
|
|
use serde::Serialize;
|
|
|
|
use crate::errors::ErrorResponse;
|
|
|
|
#[derive(Debug, Clone, Serialize)]
|
|
pub struct AuthUser {
|
|
pub id: String,
|
|
pub username: String,
|
|
pub name: Option<String>,
|
|
pub email: Option<String>,
|
|
pub avatar_url: Option<String>,
|
|
}
|
|
|
|
#[automock]
|
|
#[async_trait]
|
|
pub trait OAuthProvider: Send + Sync {
|
|
fn id(&self) -> &'static str;
|
|
fn label(&self) -> &'static str;
|
|
fn active(&self) -> bool {
|
|
true
|
|
}
|
|
|
|
async fn authorize(&self) -> axum::response::Response;
|
|
|
|
async fn handle_callback(&self, code: &str, state: &str) -> Result<AuthUser, ErrorResponse>;
|
|
}
|