#[non_exhaustive]pub enum CoreRevocableToken {
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§const fn clone_from(&mut self, source: &Self)
const 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<StandardRevocableToken, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardRevocableToken, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<&AccessToken> for StandardRevocableToken
impl From<&AccessToken> for StandardRevocableToken
Source§fn from(token: &AccessToken) -> StandardRevocableToken
fn from(token: &AccessToken) -> StandardRevocableToken
Source§impl From<&RefreshToken> for StandardRevocableToken
impl From<&RefreshToken> for StandardRevocableToken
Source§fn from(token: &RefreshToken) -> StandardRevocableToken
fn from(token: &RefreshToken) -> StandardRevocableToken
Source§impl From<AccessToken> for StandardRevocableToken
impl From<AccessToken> for StandardRevocableToken
Source§fn from(token: AccessToken) -> StandardRevocableToken
fn from(token: AccessToken) -> StandardRevocableToken
Source§impl From<RefreshToken> for StandardRevocableToken
impl From<RefreshToken> for StandardRevocableToken
Source§fn from(token: RefreshToken) -> StandardRevocableToken
fn from(token: RefreshToken) -> StandardRevocableToken
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
Source§impl Serialize for StandardRevocableToken
impl Serialize for StandardRevocableToken
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for StandardRevocableToken
impl RefUnwindSafe for StandardRevocableToken
impl Send for StandardRevocableToken
impl Sync for StandardRevocableToken
impl Unpin for StandardRevocableToken
impl UnwindSafe for StandardRevocableToken
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more