Skip to main content

Claims

Struct Claims 

Source
pub struct Claims {
    pub aud: String,
    pub sub: String,
    pub session_id: String,
    pub role: String,
    pub contexts: Vec<String>,
    pub exp: u64,
    pub iat: u64,
    pub tee_attested: bool,
    pub amr: Vec<String>,
    pub acr: String,
    pub jti: String,
}
Expand description

JWT claims for VTA/VTC access tokens.

Aligns with the OIDC Core §2 / RFC 8176 vocabulary so the same claim names other identity stacks emit work here unchanged:

  • amrAuthentication Methods References. Per [RFC 8176] the canonical short strings are pwd, hwk, swk, iris, face, sms, etc.; the VTI vocabulary in current use is "did" (challenge-response), "passkey" (WebAuthn), "vta" (verifiable-trust-agent attestation). Multi-factor sessions list every method that contributed.
  • acrAuthentication Context Class Reference. The recommended set is "aal1" (single-factor DID), "aal2" (a second possession-or-biometric factor confirmed), "aal3" (hardware-bound second factor).

Default derives so test fixtures and follow-up constructions can use Claims { aud: ..., ..Default::default() } without listing every field — production minters still set the values that matter, but the boilerplate at non-load-bearing call sites (default-empty in tests, mocks, examples) stays out of the way.

Fields§

§aud: String§sub: String§session_id: String§role: String§contexts: Vec<String>§exp: u64§iat: u64

Issued-at, Unix seconds. Mirrors OIDC Core §2 / RFC 7519 §4.1.6. The extractor doesn’t gate on it directly — exp is the only mandatory freshness check — but iat lets audit logs and downstream consumers distinguish a re-issued token from the original mint, and lets clock-skew analysis detect a stuck issuer.

#[serde(default)] so tokens minted before iat landed deserialise as iat=0 — never confused with a fresh mint because iat==0 is older than any real session.

§tee_attested: bool

Indicates the service is running inside a Trusted Execution Environment. Only present (and true) when TEE is active; omitted when false to reduce token size.

§amr: Vec<String>

Authentication Methods References per [RFC 8176]. Empty when the consumer’s authentication path did not categorise the factor (e.g. legacy tokens minted before AAL plumbing landed).

§acr: String

Authentication Context Class Reference per OIDC Core §2. Empty when not categorised.

§jti: String

JWT ID (RFC 7519 §4.1.7) — a per-issue nonce that pins this access token to the session’s current token_id. The extractor rejects a token whose jti does not match Session.token_id (when that field is set), so minting a fresh token immediately supersedes the prior one for the same session. Load-bearing once a session_id stops rotating on refresh; harmless before then (each session already has exactly one live token). #[serde(default)] so pre-jti tokens deserialise with an empty string and are treated as “no pin” by sessions that predate the field.

Implementations§

Source§

impl Claims

Source

pub fn with_jti(self, jti: impl Into<String>) -> Self

Builder-style setter for the amr + acr claims. Production minters that know how the session was authenticated call this after JwtKeys::new_claims to attach the AAL signal:

let claims = jwt_keys.new_claims(/* ... */)
    .with_aal(vec!["did".into()], "aal1");

Step-up flows append a factor and raise the acr:

claims = claims.with_aal(vec!["did".into(), "passkey".into()], "aal2");

Builder-style setter for the jti pin. Minters call this after JwtKeys::new_claims with the same value they persist as the session’s token_id, so the extractor’s pin check matches. Defaults to empty (no pin) when not called.

Source

pub fn with_aal(self, amr: Vec<String>, acr: impl Into<String>) -> Self

Trait Implementations§

Source§

impl Debug for Claims

Source§

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

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

impl Default for Claims

Source§

fn default() -> Claims

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Claims

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 Claims

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> At for T

Source§

fn at<M>(self, metadata: M) -> Meta<T, M>

Wraps self inside a Meta<Self, M> using the given metadata. 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> BorrowStripped for T

Source§

fn stripped(&self) -> &Stripped<T>

Source§

impl<T> BorrowUnordered for T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Clear for T

Source§

fn clear(&mut self)

Completely overwrites this value.
Source§

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

Source§

impl<'de, T, C> DeserializeTyped<'de, C> for T
where T: Deserialize<'de>,

Source§

fn deserialize_typed<S>( _: &C, deserializer: S, ) -> Result<T, <S as Deserializer<'de>>::Error>
where S: Deserializer<'de>,

Source§

impl<T, U> DeserializeTypedOwned<T> for U
where U: for<'de> DeserializeTyped<'de, T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, C> FromWithContext<T, C> for T

Source§

fn from_with(value: T, _context: &C) -> T

Source§

impl<T> InitializableFromZeroed for T
where T: Default,

Source§

unsafe fn initialize(place: *mut T)

Called to initialize a place to a valid value, after it is set to all-bits-zero. Read more
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, U, C> IntoWithContext<U, C> for T
where U: FromWithContext<T, C>,

Source§

fn into_with(self, context: &C) -> U

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ResourceProvider<()> for T

Source§

fn get_resource(&self) -> &()

Returns a reference to the resource of type T.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T

Source§

type Owned = T

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, C> TryFromWithContext<U, C> for T
where U: IntoWithContext<T, C>,

Source§

type Error = Infallible

Source§

fn try_from_with( value: U, context: &C, ) -> Result<T, <T as TryFromWithContext<U, C>>::Error>

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, U, C> TryIntoWithContext<U, C> for T
where U: TryFromWithContext<T, C>,

Source§

type Error = <U as TryFromWithContext<T, C>>::Error

Source§

fn try_into_with( self, context: &C, ) -> Result<U, <T as TryIntoWithContext<U, C>>::Error>

Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

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

Source§

fn vzip(self) -> V

Source§

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

Source§

fn with<C>(&self, context: C) -> Contextual<&T, C>

Source§

fn into_with<C>(self, context: C) -> Contextual<T, C>
where T: Sized,

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