pub trait Adapter: Send + Sync + 'static {
    // Required methods
    fn authorization_uri(
        &self,
        config: &OAuthConfig,
        state: &str,
        scopes: &[&str],
        extra_params: &[(&str, &str)]
    ) -> Result<Absolute<'static>, Error>;
    fn exchange_code<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 OAuthConfig,
        token: TokenRequest
    ) -> Pin<Box<dyn Future<Output = Result<TokenResponse<()>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

An OAuth2 Adapater can be implemented by any type that facilitates the Authorization Code Grant as described in RFC 6749 §4.1. The implementing type must be able to generate an authorization URI and perform the token exchange.

Required Methods§

source

fn authorization_uri( &self, config: &OAuthConfig, state: &str, scopes: &[&str], extra_params: &[(&str, &str)] ) -> Result<Absolute<'static>, Error>

Generate an authorization URI as described by RFC 6749 §4.1.1 given configuration, state, and scopes. Implementations should include extra_params in the URI as additional query parameters.

source

fn exchange_code<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 OAuthConfig, token: TokenRequest ) -> Pin<Box<dyn Future<Output = Result<TokenResponse<()>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Perform the token exchange in accordance with RFC 6749 §4.1.3 given the authorization code provided by the service.

Implementors§