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)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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]

impl Debug for StandardRevocableToken[src]

impl<'de> Deserialize<'de> for StandardRevocableToken[src]

impl From<&'_ AccessToken> for StandardRevocableToken[src]

impl From<&'_ RefreshToken> for StandardRevocableToken[src]

impl From<AccessToken> for StandardRevocableToken[src]

impl From<RefreshToken> for StandardRevocableToken[src]

impl RevocableToken for StandardRevocableToken[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.:

impl Serialize for StandardRevocableToken[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,