mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-13 10:12:19 -06:00
feat: discord oauth provider, setup provider list route, add 'active' method, common type alias
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use axum::{response::IntoResponse, response::Redirect};
|
||||
use dashmap::DashMap;
|
||||
use oauth2::{basic::BasicClient, AuthorizationCode, CsrfToken, PkceCodeChallenge, PkceCodeVerifier, Scope, TokenResponse};
|
||||
use oauth2::{AuthorizationCode, CsrfToken, PkceCodeChallenge, PkceCodeVerifier, Scope, TokenResponse};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use std::sync::atomic::{AtomicU32, Ordering};
|
||||
@@ -13,10 +13,6 @@ use crate::{
|
||||
errors::ErrorResponse,
|
||||
};
|
||||
|
||||
// Private type alias for the OAuth2 BasicClient specialized type
|
||||
type OAuthClient =
|
||||
BasicClient<oauth2::EndpointSet, oauth2::EndpointNotSet, oauth2::EndpointNotSet, oauth2::EndpointNotSet, oauth2::EndpointSet>;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct GitHubUser {
|
||||
pub id: u64,
|
||||
@@ -58,7 +54,7 @@ pub async fn fetch_github_user(
|
||||
}
|
||||
|
||||
pub struct GitHubProvider {
|
||||
pub client: OAuthClient,
|
||||
pub client: super::OAuthClient,
|
||||
pub http: reqwest::Client,
|
||||
pkce: DashMap<String, PkceRecord>,
|
||||
last_purge_at_secs: AtomicU32,
|
||||
@@ -72,7 +68,7 @@ struct PkceRecord {
|
||||
}
|
||||
|
||||
impl GitHubProvider {
|
||||
pub fn new(client: OAuthClient, http: reqwest::Client) -> Arc<Self> {
|
||||
pub fn new(client: super::OAuthClient, http: reqwest::Client) -> Arc<Self> {
|
||||
Arc::new(Self {
|
||||
client,
|
||||
http,
|
||||
|
||||
Reference in New Issue
Block a user