feat: setup github provider with generic trait, proper routes, session & jwt handling, errors & user agent

This commit is contained in:
Ryan Walters
2025-09-17 03:32:32 -05:00
parent 264478bdaa
commit f3db44c48b
12 changed files with 604 additions and 20 deletions

View File

@@ -0,0 +1,25 @@
use std::collections::HashMap;
use async_trait::async_trait;
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>,
}
#[async_trait]
pub trait OAuthProvider: Send + Sync {
fn id(&self) -> &'static str;
fn label(&self) -> &'static str;
async fn authorize(&self) -> axum::response::Response;
async fn handle_callback(&self, query: &HashMap<String, String>) -> Result<AuthUser, ErrorResponse>;
}