pub struct StandardTokenResponse<EF, TT>
where EF: ExtraTokenFields, TT: TokenType,
{ /* private fields */ }
Expand description

Standard OAuth2 token response.

This struct includes the fields defined in Section 5.1 of RFC 6749, as well as extensions defined by the EF type parameter.

Implementations§

source§

impl<EF, TT> StandardTokenResponse<EF, TT>
where EF: ExtraTokenFields, TT: TokenType,

source

pub fn new( access_token: AccessToken, token_type: TT, extra_fields: EF ) -> StandardTokenResponse<EF, TT>

Instantiate a new OAuth2 token response.

source

pub fn set_access_token(&mut self, access_token: AccessToken)

Set the access_token field.

source

pub fn set_token_type(&mut self, token_type: TT)

Set the token_type field.

source

pub fn set_expires_in(&mut self, expires_in: Option<&Duration>)

Set the expires_in field.

source

pub fn set_refresh_token(&mut self, refresh_token: Option<RefreshToken>)

Set the refresh_token field.

source

pub fn set_scopes(&mut self, scopes: Option<Vec<Scope>>)

Set the scopes field.

source

pub fn extra_fields(&self) -> &EF

Extra fields defined by the client application.

source

pub fn set_extra_fields(&mut self, extra_fields: EF)

Set the extra fields defined by the client application.

Trait Implementations§

source§

impl<EF, TT> Clone for StandardTokenResponse<EF, TT>

source§

fn clone(&self) -> StandardTokenResponse<EF, TT>

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
source§

impl<EF, TT> Debug for StandardTokenResponse<EF, TT>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'de, EF, TT> Deserialize<'de> for StandardTokenResponse<EF, TT>
where EF: ExtraTokenFields, TT: TokenType,

source§

fn deserialize<__D>( __deserializer: __D ) -> Result<StandardTokenResponse<EF, TT>, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<EF, TT> Serialize for StandardTokenResponse<EF, TT>
where EF: ExtraTokenFields, TT: TokenType,

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<AC, EF, GC, JE, JS, JT, TT> TokenResponse<AC, GC, JE, JS, JT, TT> for StandardTokenResponse<IdTokenFields<AC, EF, GC, JE, JS, JT>, TT>

source§

fn id_token(&self) -> Option<&IdToken<AC, GC, JE, JS, JT>>

Returns the ID token provided by the token response. Read more
source§

impl<EF, TT> TokenResponse<TT> for StandardTokenResponse<EF, TT>
where EF: ExtraTokenFields, TT: TokenType,

source§

fn access_token(&self) -> &AccessToken

REQUIRED. The access token issued by the authorization server.

source§

fn token_type(&self) -> &TT

REQUIRED. The type of the token issued as described in Section 7.1. Value is case insensitive and deserialized to the generic TokenType parameter.

source§

fn expires_in(&self) -> Option<Duration>

RECOMMENDED. The lifetime in seconds of the access token. For example, the value 3600 denotes that the access token will expire in one hour from the time the response was generated. If omitted, the authorization server SHOULD provide the expiration time via other means or document the default value.

source§

fn refresh_token(&self) -> Option<&RefreshToken>

OPTIONAL. The refresh token, which can be used to obtain new access tokens using the same authorization grant as described in Section 6.

source§

fn scopes(&self) -> Option<&Vec<Scope>>

OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED. The scope of the access token as described by Section 3.3. If included in the response, this space-delimited field is parsed into a Vec of individual scopes. If omitted from the response, this field is None.

Auto Trait Implementations§

§

impl<EF, TT> RefUnwindSafe for StandardTokenResponse<EF, TT>

§

impl<EF, TT> Send for StandardTokenResponse<EF, TT>
where EF: Send, TT: Send,

§

impl<EF, TT> Sync for StandardTokenResponse<EF, TT>
where EF: Sync, TT: Sync,

§

impl<EF, TT> Unpin for StandardTokenResponse<EF, TT>
where EF: Unpin, TT: Unpin,

§

impl<EF, TT> UnwindSafe for StandardTokenResponse<EF, TT>
where EF: UnwindSafe, TT: UnwindSafe,

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> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,