#[non_exhaustive]pub enum StandardRevocableToken {
AccessToken(AccessToken),
RefreshToken(RefreshToken),
}
Expand description
A token representation usable with authorization servers that support RFC 7009 token revocation.
For use with revoke_token()
.
Automatically reports the correct RFC 7009 token_type_hint
value corresponding to the token type variant used, i.e.
access_token
for AccessToken
and secret_token
for RefreshToken
.
§Example
Per RFC 7009, Section 2 prefer revocation by refresh token which, if issued to the client, must be supported by the server, otherwise fallback to access token (which may or may not be supported by the server).
let token_to_revoke: StandardRevocableToken = match token_response.refresh_token() {
Some(token) => token.into(),
None => token_response.access_token().into(),
};
client
.revoke_token(token_to_revoke)
.request(http_client)
.unwrap();
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AccessToken(AccessToken)
A representation of an AccessToken
suitable for use with revoke_token()
.
RefreshToken(RefreshToken)
A representation of an RefreshToken
suitable for use with revoke_token()
.
Trait Implementations§
Source§impl Clone for StandardRevocableToken
impl Clone for StandardRevocableToken
Source§fn clone(&self) -> StandardRevocableToken
fn clone(&self) -> StandardRevocableToken
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for StandardRevocableToken
impl Debug for StandardRevocableToken
Source§impl<'de> Deserialize<'de> for StandardRevocableToken
impl<'de> Deserialize<'de> for StandardRevocableToken
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 From<&AccessToken> for StandardRevocableToken
impl From<&AccessToken> for StandardRevocableToken
Source§fn from(token: &AccessToken) -> Self
fn from(token: &AccessToken) -> Self
Source§impl From<&RefreshToken> for StandardRevocableToken
impl From<&RefreshToken> for StandardRevocableToken
Source§fn from(token: &RefreshToken) -> Self
fn from(token: &RefreshToken) -> Self
Source§impl From<AccessToken> for StandardRevocableToken
impl From<AccessToken> for StandardRevocableToken
Source§fn from(token: AccessToken) -> Self
fn from(token: AccessToken) -> Self
Source§impl From<RefreshToken> for StandardRevocableToken
impl From<RefreshToken> for StandardRevocableToken
Source§fn from(token: RefreshToken) -> Self
fn from(token: RefreshToken) -> Self
Source§impl RevocableToken for StandardRevocableToken
impl RevocableToken for StandardRevocableToken
Source§fn type_hint(&self) -> Option<&str>
fn type_hint(&self) -> Option<&str>
Indicates the type of the token to be revoked, as defined by RFC 7009, Section 2.1, i.e.:
-
access_token
: An access token as defined in RFC 6749, Section 1.4 -
refresh_token
: A refresh token as defined in RFC 6749, Section 1.5