pub struct DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>{ /* private fields */ }
Expand description

The request for an device access token from the authorization server.

See https://tools.ietf.org/html/rfc8628#section-3.4.

Implementations§

source§

impl<'a, 'b, TR, TT, EF> DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>

source

pub fn add_extra_param<N, V>(self, name: N, value: V) -> Self
where N: Into<Cow<'a, str>>, V: Into<Cow<'a, str>>,

Appends an extra param to the token request.

This method allows extensions to be used without direct support from this crate. If name conflicts with a parameter managed by this crate, the behavior is undefined. In particular, do not set parameters defined by RFC 6749 or RFC 7636.

Security Warning

Callers should follow the security recommendations for any OAuth2 extensions used with this function, which are beyond the scope of RFC 6749.

source

pub fn set_time_fn<T>(self, time_fn: T) -> Self
where T: Fn() -> DateTime<Utc> + 'b + Send + Sync,

Specifies a function for returning the current time.

This function is used while polling the authorization server.

source

pub fn set_max_backoff_interval(self, interval: Duration) -> Self

Sets the upper limit of the sleep interval to use for polling the token endpoint when the HTTP client returns an error (e.g., in case of connection timeout).

source

pub fn request<F, S, RE>( self, http_client: F, sleep_fn: S, timeout: Option<Duration> ) -> Result<TR, RequestTokenError<RE, DeviceCodeErrorResponse>>
where F: Fn(HttpRequest) -> Result<HttpResponse, RE>, S: Fn(Duration), RE: Error + 'static,

Synchronously polls the authorization server for a response, waiting using a user defined sleep function.

source

pub async fn request_async<C, F, S, SF, RE>( self, http_client: C, sleep_fn: S, timeout: Option<Duration> ) -> Result<TR, RequestTokenError<RE, DeviceCodeErrorResponse>>
where C: Fn(HttpRequest) -> F, F: Future<Output = Result<HttpResponse, RE>>, S: Fn(Duration) -> SF, SF: Future<Output = ()>, RE: Error + 'static,

Asynchronously sends the request to the authorization server and awaits a response.

Trait Implementations§

source§

impl<'a, 'b, TR, TT, EF> Clone for DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>

source§

fn clone(&self) -> DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a, 'b, TR, TT, EF> !RefUnwindSafe for DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>

§

impl<'a, 'b, TR, TT, EF> Send for DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>
where EF: Send + Sync, TR: Send, TT: Send,

§

impl<'a, 'b, TR, TT, EF> Sync for DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>
where EF: Sync, TR: Sync, TT: Sync,

§

impl<'a, 'b, TR, TT, EF> Unpin for DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>
where EF: Unpin, TR: Unpin, TT: Unpin,

§

impl<'a, 'b, TR, TT, EF> !UnwindSafe for DeviceAccessTokenRequest<'a, 'b, TR, TT, EF>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

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

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

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

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more