Skip to main content

OAuthProvider

Trait OAuthProvider 

Source
pub trait OAuthProvider: Send + Sync {
    // Required methods
    fn get_authorization_url(
        &self,
        state: &str,
        scopes: &[&str],
        code_challenge: Option<&str>,
    ) -> String;
    fn exchange_code_for_identity<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        code: &'life1 str,
        code_verifier: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<(Identity, OAuthToken), AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn refresh_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _refresh_token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<OAuthToken, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn revoke_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Trait for an OAuth2-compatible provider.

Required Methods§

Source

fn get_authorization_url( &self, state: &str, scopes: &[&str], code_challenge: Option<&str>, ) -> String

Helper to get the authorization URL.

Source

fn exchange_code_for_identity<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, code: &'life1 str, code_verifier: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<(Identity, OAuthToken), AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Exchange an authorization code for an Identity.

Provided Methods§

Source

fn refresh_token<'life0, 'life1, 'async_trait>( &'life0 self, _refresh_token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<OAuthToken, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Refresh an access token using a refresh token.

Source

fn revoke_token<'life0, 'life1, 'async_trait>( &'life0 self, _token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revoke an access token.

Implementors§