[][src]Struct rocket_oauth2::OAuth2

pub struct OAuth2<C> { /* fields omitted */ }

The OAuth2 structure implements OAuth in a Rocket application by setting up OAuth-related route handlers.

Redirect handler

OAuth2 handles the redirect URI. It verifies the state token to prevent CSRF attacks, then instructs the Adapter to perform the token exchange. The resulting token is passed to the Callback.

Login handler

OAuth2 optionally handles a login route, which simply redirects to the authorization URI generated by the Adapter. Whether or not OAuth2 is handling a login URI, get_redirect can be used to get a Redirect to the OAuth login flow manually.

Methods

impl<C: Callback> OAuth2<C>[src]

pub fn fairing<A: Adapter>(
    adapter: A,
    callback: C,
    config_name: &str,
    callback_uri: &str,
    login: Option<(&str, Vec<String>)>
) -> impl Fairing
[src]

Returns an OAuth2 fairing. The fairing will place an instance of OAuth2<C> in managed state and mount a redirect handler. It will also mount a login handler if login is Some.

pub fn custom<A: Adapter>(
    adapter: A,
    callback: C,
    config: OAuthConfig,
    callback_uri: &str,
    login: Option<(&str, Vec<String>)>
) -> impl Fairing
[src]

Returns an OAuth2 fairing with custom configuration. The fairing will place an instance of OAuth2<C> in managed state and mount a redirect handler. It will also mount a login handler if login is Some.

pub fn get_redirect(
    &self,
    cookies: &mut Cookies,
    scopes: &[&str]
) -> Result<Redirect, Error>
[src]

Prepare an authentication redirect. This sets a state cookie and returns a Redirect to the provider's authorization page.

pub fn refresh(&self, refresh_token: &str) -> Result<TokenResponse, Error>[src]

Request a new access token given a refresh token. The refresh token must have been returned by the provider in a previous TokenResponse.

Trait Implementations

impl<C: Debug> Debug for OAuth2<C>[src]

Auto Trait Implementations

impl<C> !RefUnwindSafe for OAuth2<C>

impl<C> Send for OAuth2<C> where
    C: Send

impl<C> Sync for OAuth2<C> where
    C: Sync

impl<C> Unpin for OAuth2<C> where
    C: Unpin

impl<C> !UnwindSafe for OAuth2<C>

Blanket Implementations

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

impl<T, I> AsResult<T, I> for T where
    I: Input, 

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

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

impl<T> From<T> for T[src]

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

impl<T> IntoCollection<T> for T

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any