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
fn exchange_code<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 OAuthConfig,
token: TokenRequest
) -> Pin<Box<dyn Future<Output = Result<TokenResponse<()>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
fn exchange_code<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 OAuthConfig,
token: TokenRequest
) -> Pin<Box<dyn Future<Output = Result<TokenResponse<()>, Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]Perform the token exchange in accordance with RFC 6749 §4.1.3 given the authorization code provided by the service. Read more
Auto Trait Implementations
impl !RefUnwindSafe for HyperRustlsAdapter
impl Send for HyperRustlsAdapter
impl Sync for HyperRustlsAdapter
impl Unpin for HyperRustlsAdapter
impl !UnwindSafe for HyperRustlsAdapter
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
pub fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V