[][src]Struct tokkit::TokenInfo

pub struct TokenInfo {
    pub active: bool,
    pub user_id: Option<UserId>,
    pub scope: Vec<Scope>,
    pub expires_in_seconds: Option<u64>,
}

Information on an AccessToken returned by a TokenInfoService.

See OAuth 2.0 Token Introspection

Fields

active: bool

REQUIRED. Boolean indicator of whether or not the presented token is currently active. The specifics of a token's "active" state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a "true" value return for the "active" property will generally indicate that a given token has been issued by this authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g., after its issuance time and before its expiration time). See Section 4 for information on implementation of such checks.

user_id: Option<UserId>

OPTIONAL. Human-readable identifier for the resource owner who authorized this token.

Remark: This is usually not a human readable id but a custom field since we are in the realm of S2S authorization.

scope: Vec<Scope>

OPTIONAL. A JSON string containing a space-separated list of scopes associated with this token, in the format described in Section 3.3 of OAuth 2.0 RFC6749.

expires_in_seconds: Option<u64>

OPTIONAL. Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token will expire, as defined in JWT RFC7519.

Remark: Contains the number of seconds until the token expires. This seems to be used by most introspection services.

Methods

impl TokenInfo[src]

pub fn has_scope(&self, scope: &Scope) -> bool[src]

Use for authorization. Checks whether this TokenInfo has the given Scope.

pub fn has_scopes(&self, scopes: &[Scope]) -> bool[src]

Use for authorization. Checks whether this TokenInfo has all of the given Scopes.

pub fn must_have_scope(&self, scope: &Scope) -> Result<(), NotAuthorized>[src]

If the TokenInfo does not have the scope this method will fail.

Trait Implementations

impl PartialEq<TokenInfo> for TokenInfo[src]

impl Debug for TokenInfo[src]

impl StructuralPartialEq for TokenInfo[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

type Error = !

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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