pub trait TokenIntrospectionResponse<TT>: Debug + DeserializeOwned + Serialize
where TT: TokenType,
{ // Required methods fn active(&self) -> bool; fn scopes(&self) -> Option<&Vec<Scope>>; fn client_id(&self) -> Option<&ClientId>; fn username(&self) -> Option<&str>; fn token_type(&self) -> Option<&TT>; fn exp(&self) -> Option<DateTime<Utc>>; fn iat(&self) -> Option<DateTime<Utc>>; fn nbf(&self) -> Option<DateTime<Utc>>; fn sub(&self) -> Option<&str>; fn aud(&self) -> Option<&Vec<String>>; fn iss(&self) -> Option<&str>; fn jti(&self) -> Option<&str>; }
Expand description

Common methods shared by all OAuth2 token introspection implementations.

The methods in this trait are defined in Section 2.2 of RFC 7662. This trait exists separately from the StandardTokenIntrospectionResponse struct to support customization by clients, such as supporting interoperability with non-standards-complaint OAuth2 providers.

Required Methods§

source

fn active(&self) -> 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).

source

fn scopes(&self) -> Option<&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 RFC 7662. If included in the response, this space-delimited field is parsed into a Vec of individual scopes. If omitted from the response, this field is None.

source

fn client_id(&self) -> Option<&ClientId>

OPTIONAL. Client identifier for the OAuth 2.0 client that requested this token.

source

fn username(&self) -> Option<&str>

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

source

fn token_type(&self) -> Option<&TT>

OPTIONAL. Type of the token as defined in Section 5.1 of RFC 7662. Value is case insensitive and deserialized to the generic TokenType parameter.

source

fn exp(&self) -> Option<DateTime<Utc>>

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.

source

fn iat(&self) -> Option<DateTime<Utc>>

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

source

fn nbf(&self) -> Option<DateTime<Utc>>

OPTIONAL. Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token is not to be used before, as defined in JWT RFC7519.

source

fn sub(&self) -> Option<&str>

OPTIONAL. Subject of the token, as defined in JWT RFC7519. Usually a machine-readable identifier of the resource owner who authorized this token.

source

fn aud(&self) -> Option<&Vec<String>>

OPTIONAL. Service-specific string identifier or list of string identifiers representing the intended audience for this token, as defined in JWT RFC7519.

source

fn iss(&self) -> Option<&str>

OPTIONAL. String representing the issuer of this token, as defined in JWT RFC7519.

source

fn jti(&self) -> Option<&str>

OPTIONAL. String identifier for the token, as defined in JWT RFC7519.

Object Safety§

This trait is not object safe.

Implementors§