[][src]Struct rocket_oauth2::OAuth2

pub struct OAuth2<A, 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<A: Adapter, C: Callback> OAuth2<A, C>[src]

pub fn fairing(
    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<A, C> in managed state and mount a redirect handler. It will also mount a login handler if login is Some.

pub fn custom(
    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<A, 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, A::Error>
[src]

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

Trait Implementations

impl<A: Clone, C: Clone> Clone for OAuth2<A, C>[src]

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

Auto Trait Implementations

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

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

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

impl<A, C> UnwindSafe for OAuth2<A, C> where
    A: UnwindSafe,
    C: UnwindSafe

impl<A, C> RefUnwindSafe for OAuth2<A, C> where
    A: RefUnwindSafe,
    C: RefUnwindSafe

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Typeable for T where
    T: Any

impl<T> IntoCollection<T> for T

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,