Struct rocket_oauth2::HyperRustlsAdapter[][src]

pub struct HyperRustlsAdapter { /* fields omitted */ }
Expand description

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

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::{HyperRustlsAdapter, OAuth2, OAuthConfig, StaticProvider};

struct MyProvider;

#[rocket::launch]
fn rocket() -> _ {
    rocket::build()
        .attach(AdHoc::on_ignite("OAuth Config", |mut rocket| async {
            let config = OAuthConfig::from_figment(rocket.figment(), "my_provider").unwrap();
            rocket.attach(OAuth2::<MyProvider>::custom(
                HyperRustlsAdapter::default().basic_auth(false), config)
            )
        }))
}

Trait Implementations

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. Read more

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Converts self into a collection.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.