[][src]Struct rocket_oauth2::HyperSyncRustlsAdapter

pub struct HyperSyncRustlsAdapter { /* fields omitted */ }

The default Adapter implementation. Uses hyper and rustls to perform the token exchange.

By defualt, this adapter will use HTTP Basic Authentication. If this is not supported by your authorization server, the basic_auth method can be used to change this behavior.

Implementations

impl HyperSyncRustlsAdapter[src]

pub fn basic_auth(self, use_basic_auth: bool) -> Self[src]

Sets whether or not this adapter will use HTTP Basic Authentication. Although servers are required to support it (RFC 6749 §2.3.1), not all do.

If this is set to false, the client_id and client_secret will be sent as part of the request body instead of an Authorization header.

Example

use rocket::fairing::AdHoc;
use rocket_oauth2::{HyperSyncRustlsAdapter, OAuth2, OAuthConfig, StaticProvider};

struct MyProvider;

fn main() {
    rocket::ignite()
        .attach(AdHoc::on_attach("OAuth Config", |rocket| {
            let config = OAuthConfig::from_config(rocket.config(), "my_provider").unwrap();
            Ok(rocket.attach(OAuth2::<MyProvider>::custom(
                HyperSyncRustlsAdapter::default().basic_auth(false), config)
            ))
        }))
        .launch();
}

Trait Implementations

impl Adapter for HyperSyncRustlsAdapter[src]

impl Clone for HyperSyncRustlsAdapter[src]

impl Debug for HyperSyncRustlsAdapter[src]

impl Default for HyperSyncRustlsAdapter[src]

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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

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