Enum oauth2::revocation::StandardRevocableToken [−][src]
#[non_exhaustive] pub enum StandardRevocableToken { AccessToken(AccessToken), RefreshToken(RefreshToken), }
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)
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
impl Clone for StandardRevocableToken
[src]
fn clone(&self) -> StandardRevocableToken
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for StandardRevocableToken
[src]
impl<'de> Deserialize<'de> for StandardRevocableToken
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl From<&'_ AccessToken> for StandardRevocableToken
[src]
fn from(token: &AccessToken) -> Self
[src]
impl From<&'_ RefreshToken> for StandardRevocableToken
[src]
fn from(token: &RefreshToken) -> Self
[src]
impl From<AccessToken> for StandardRevocableToken
[src]
fn from(token: AccessToken) -> Self
[src]
impl From<RefreshToken> for StandardRevocableToken
[src]
fn from(token: RefreshToken) -> Self
[src]
impl RevocableToken for StandardRevocableToken
[src]
fn secret(&self) -> &str
[src]
fn type_hint(&self) -> Option<&str>
[src]
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
impl Serialize for StandardRevocableToken
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,