Enum oauth2::revocation::StandardRevocableToken [−][src]
#[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)
Tuple Fields
0: AccessToken
A representation of an AccessToken
suitable for use with revoke_token()
.
RefreshToken(RefreshToken)
Tuple Fields
0: RefreshToken
A representation of an RefreshToken
suitable for use with revoke_token()
.
Trait Implementations
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>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
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
Auto Trait Implementations
impl RefUnwindSafe for StandardRevocableToken
impl Send for StandardRevocableToken
impl Sync for StandardRevocableToken
impl Unpin for StandardRevocableToken
impl UnwindSafe for StandardRevocableToken
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more