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) -> Self

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>where EF: ExtraTokenFields + Clone, TT: TokenType + Clone,

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>where EF: ExtraTokenFields + Debug, TT: TokenType + Debug,

source§

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

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<Self, __D::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::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. 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>where EF: RefUnwindSafe, TT: RefUnwindSafe,

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

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