[][src]Struct oauth2_noserver_rs::Config

pub struct Config { /* fields omitted */ }

Stores the configuration for an OAuth2 client.

Methods

impl Config[src]

pub fn new<I, S, A, T>(
    client_id: I,
    client_secret: S,
    auth_url: A,
    token_url: T
) -> Config where
    A: AsRef<str>,
    I: Into<String>,
    S: Into<String>,
    T: AsRef<str>, 
[src]

Initializes the OAuth2 client with the client ID, client secret, the base authorization URL and the URL ment for requesting the access token.

pub fn add_scope<S>(self, scope: S) -> Config where
    S: Into<String>, 
[src]

Appends a new scope to the authorization URL.

pub fn set_response_type<R>(self, response_type: R) -> Config where
    R: Into<ResponseType>, 
[src]

Allows setting a particular response type. Both &str and ResponseType work here.

The default response type is code.

pub fn set_auth_type(self, auth_type: AuthType) -> Config[src]

Allows configuring whether basic auth is used to communicate with the authorization server.

The default auth type is to place the client_id and client_secret inside the request body.

pub fn set_redirect_url<R>(self, redirect_url: R) -> Config where
    R: Into<String>, 
[src]

Allows setting the redirect URL.

pub fn set_state<S>(self, state: S) -> Config where
    S: Into<String>, 
[src]

Allows setting a state parameter inside the authorization URL, which we'll be returned by the server after the authorization is over.

pub fn authorize_url(&self) -> Url[src]

Produces the full authorization URL.

pub fn exchange<C>(&self, code: C) -> Result<Token, TokenError> where
    C: Into<String>, 
[src]

Deprecated since 1.0.0:

please use exchange_code instead

Exchanges a code produced by a successful authorization process with an access token.

See https://tools.ietf.org/html/rfc6749#section-4.1.3

pub fn exchange_code<C>(&self, code: C) -> Result<Token, TokenError> where
    C: Into<String>, 
[src]

Exchanges a code produced by a successful authorization process with an access token.

See https://tools.ietf.org/html/rfc6749#section-4.1.3

pub fn exchange_client_credentials(&self) -> Result<Token, TokenError>[src]

Requests an access token for the client credentials grant type.

See https://tools.ietf.org/html/rfc6749#section-4.4.2

pub fn exchange_password<U, P>(
    &self,
    username: U,
    password: P
) -> Result<Token, TokenError> where
    P: Into<String>,
    U: Into<String>, 
[src]

Requests an access token for the password grant type.

See https://tools.ietf.org/html/rfc6749#section-4.3.2

pub fn exchange_refresh_token<T>(&self, token: T) -> Result<Token, TokenError> where
    T: Into<String>, 
[src]

Exchanges a refresh token for an access token

See https://tools.ietf.org/html/rfc6749#section-6

Trait Implementations

impl Clone for Config[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Config

impl Sync for Config

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.