IntrospectionResponse

Struct IntrospectionResponse 

Source
pub struct IntrospectionResponse {
    pub active: bool,
    pub scope: Option<String>,
    pub client_id: Option<String>,
    pub username: Option<String>,
    pub token_type: Option<String>,
    pub expiration: Option<i64>,
    pub issued_at: Option<i64>,
    pub not_before: Option<i64>,
    pub subject: Option<String>,
    pub audience: Option<Audience>,
    pub issuer: Option<String>,
    pub jwt_id: Option<String>,
}
Expand description

Represents an OAuth 2.0 Token Introspection response as per RFC 7662.

This struct captures the response from an OAuth 2.0 introspection endpoint, providing details about the validity and metadata of an access or refresh token. All fields are optional except active, as per the specification, to handle cases where the token is inactive or certain metadata is not provided.

§Example JSON

{
  "active": true,
  "scope": "read write",
  "client_id": "client123",
  "username": "john_doe",
  "token_type": "access_token",
  "exp": 1697054400,
  "iat": 1697050800,
  "nbf": 1697050800,
  "sub": "user123",
  "aud": ["resource_server_1", "resource_server_2"],
  "iss": "https://auth.example.com",
  "jti": "abc123"
}

Fields§

§active: bool

Indicates whether the token is active (valid, not expired, etc.). This field is required by the OAuth 2.0 introspection specification.

§scope: Option<String>

Space-separated list of scopes granted to the token. Optional, as the token may have no scopes or be inactive.

§client_id: Option<String>

Identifier of the client that requested the token. Optional, as it may not be provided for inactive tokens.

§username: Option<String>

Username of the resource owner associated with the token, if applicable. Optional, as it may not apply to all token types or be absent for inactive tokens.

§token_type: Option<String>

Type of the token, typically “access_token” or “refresh_token”. Optional, as it may not be provided for inactive tokens.

§expiration: Option<i64>

Expiration Time - Unix timestamp when the token expires (JWT: exp).

§issued_at: Option<i64>

Issued At - Unix timestamp when the token was issued (JWT: iat).

§not_before: Option<i64>

Not Before - Unix timestamp when the token becomes valid (JWT: nbf).

§subject: Option<String>

Subject identifier, often the user ID associated with the token. Optional, as it may not be provided for inactive tokens.

§audience: Option<Audience>

Audience(s) the token is intended for, which can be a single string or an array of strings. Optional, as it may not be provided for inactive tokens.

§issuer: Option<String>

Issuer identifier, typically the URI of the authorization server. Optional, as it may not be provided for inactive tokens.

§jwt_id: Option<String>

JWT ID - Unique identifier for the token to prevent reuse (JWT: jti).

Trait Implementations§

Source§

impl Clone for IntrospectionResponse

Source§

fn clone(&self) -> IntrospectionResponse

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IntrospectionResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for IntrospectionResponse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for IntrospectionResponse

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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