Struct tokkit::TokenInfo [−][src]
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
.
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]
impl TokenInfo
pub fn has_scope(&self, scope: &Scope) -> bool
[src]
pub fn has_scope(&self, scope: &Scope) -> bool
Use for authorization. Checks whether this TokenInfo
has the given
Scope
.
pub fn has_scopes(&self, scopes: &[Scope]) -> bool
[src]
pub fn has_scopes(&self, scopes: &[Scope]) -> bool
Use for authorization. Checks whether this TokenInfo
has all of the
given Scopes
.
pub fn must_have_scope(&self, scope: &Scope) -> Result<(), NotAuthorized>
[src]
pub fn must_have_scope(&self, scope: &Scope) -> Result<(), NotAuthorized>
If the TokenInfo
does not have the scope this method will fail.
Trait Implementations
impl Debug for TokenInfo
[src]
impl Debug for TokenInfo
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for TokenInfo
[src]
impl PartialEq for TokenInfo