Skip to main content

AuthProvider

Trait AuthProvider 

Source
pub trait AuthProvider: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn authorize_url(&self, redirect_uri: &str) -> String;
    fn exchange_code<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        code: &'life1 str,
        redirect_uri: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<UserInfo, OAuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for pluggable authentication providers.

Implementations handle the OAuth/OIDC flow for a specific identity provider. The engine uses this to abstract over GitHub OAuth, generic OIDC (Okta, Auth0, Azure AD, Keycloak, etc.), and future providers.

Required Methods§

Source

fn name(&self) -> &str

Provider name (e.g., “github”, “oidc”)

Source

fn authorize_url(&self, redirect_uri: &str) -> String

Generate the authorization URL to redirect the user to.

Source

fn exchange_code<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, code: &'life1 str, redirect_uri: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<UserInfo, OAuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Exchange an authorization code for user info.

Implementors§