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,
impl<EF, TT> StandardTokenResponse<EF, TT>where
EF: ExtraTokenFields,
TT: TokenType,
Sourcepub fn new(access_token: AccessToken, token_type: TT, extra_fields: EF) -> Self
pub fn new(access_token: AccessToken, token_type: TT, extra_fields: EF) -> Self
Instantiate a new OAuth2 token response.
Sourcepub fn set_access_token(&mut self, access_token: AccessToken)
pub fn set_access_token(&mut self, access_token: AccessToken)
Set the access_token
field.
Sourcepub fn set_token_type(&mut self, token_type: TT)
pub fn set_token_type(&mut self, token_type: TT)
Set the token_type
field.
Sourcepub fn set_expires_in(&mut self, expires_in: Option<&Duration>)
pub fn set_expires_in(&mut self, expires_in: Option<&Duration>)
Set the expires_in
field.
Sourcepub fn set_refresh_token(&mut self, refresh_token: Option<RefreshToken>)
pub fn set_refresh_token(&mut self, refresh_token: Option<RefreshToken>)
Set the refresh_token
field.
Sourcepub fn set_scopes(&mut self, scopes: Option<Vec<Scope>>)
pub fn set_scopes(&mut self, scopes: Option<Vec<Scope>>)
Set the scopes
field.
Sourcepub fn extra_fields(&self) -> &EF
pub fn extra_fields(&self) -> &EF
Extra fields defined by the client application.
Sourcepub fn set_extra_fields(&mut self, extra_fields: EF)
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>
impl<EF, TT> Clone for StandardTokenResponse<EF, TT>
Source§fn clone(&self) -> StandardTokenResponse<EF, TT>
fn clone(&self) -> StandardTokenResponse<EF, TT>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<EF, TT> Debug for StandardTokenResponse<EF, TT>
impl<EF, TT> Debug for StandardTokenResponse<EF, TT>
Source§impl<'de, EF, TT> Deserialize<'de> for StandardTokenResponse<EF, TT>where
EF: ExtraTokenFields,
TT: TokenType,
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>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<EF, TT> Serialize for StandardTokenResponse<EF, TT>where
EF: ExtraTokenFields,
TT: TokenType,
impl<EF, TT> Serialize for StandardTokenResponse<EF, TT>where
EF: ExtraTokenFields,
TT: TokenType,
Source§impl<EF, TT> TokenResponse<TT> for StandardTokenResponse<EF, TT>where
EF: ExtraTokenFields,
TT: TokenType,
impl<EF, TT> TokenResponse<TT> for StandardTokenResponse<EF, TT>where
EF: ExtraTokenFields,
TT: TokenType,
Source§fn access_token(&self) -> &AccessToken
fn access_token(&self) -> &AccessToken
REQUIRED. The access token issued by the authorization server.
Source§fn token_type(&self) -> &TT
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>
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>
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>>
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
.