pub struct AuthContext {Show 22 fields
pub subject: String,
pub issuer: String,
pub audience: String,
pub key_class: KeyClass,
pub metering_key: String,
pub deployment_id: Option<String>,
pub target_kind: Option<TargetKind>,
pub target_id: Option<String>,
pub program_id: Option<String>,
pub program_release_hash: Option<String>,
pub expires_at: u64,
pub scope: String,
pub limits: Limits,
pub plan: Option<String>,
pub origin: Option<String>,
pub client_ip: Option<String>,
pub jti: String,
pub actor_key: Option<String>,
pub account_key: Option<String>,
pub consumer_key: Option<String>,
pub policy_version: Option<u32>,
pub account_limits: Limits,
}Expand description
Auth context extracted from a verified token
Fields§
§subject: StringSubject identifier
issuer: StringIssuer
audience: StringVerified JWT audience
key_class: KeyClassKey class (secret vs publishable)
metering_key: StringMetering key for usage attribution
deployment_id: Option<String>Deployment ID binding
target_kind: Option<TargetKind>Typed resource target
target_id: Option<String>Public target identifier
program_id: Option<String>Program allowed by the token
program_release_hash: Option<String>Exact immutable program release allowed by the token
expires_at: u64Token expiration time
scope: StringGranted scope
limits: LimitsResource limits
plan: Option<String>Plan or access tier associated with the session
origin: Option<String>Origin binding
client_ip: Option<String>Client IP binding
jti: StringJWT ID
actor_key: Option<String>Raw signed actor identity; use AuthContext::actor_key to resolve
account_key: Option<String>Raw signed account identity; use AuthContext::account_key to resolve
consumer_key: Option<String>Raw signed consumer identity; use AuthContext::consumer_key to resolve
policy_version: Option<u32>Monotonic account policy version, absent on legacy tokens
account_limits: LimitsAggregate account limits, defaulted when the token carries none
Implementations§
Source§impl AuthContext
impl AuthContext
Sourcepub fn has_scope(&self, required: &str) -> bool
pub fn has_scope(&self, required: &str) -> bool
Test an exact whitespace-delimited scope. Scopes never imply one another.
Sourcepub fn consumer_key(&self) -> &str
pub fn consumer_key(&self) -> &str
Resolved consumer identity: consumer_key claim, falling back to sub.
Sourcepub fn account_key(&self) -> &str
pub fn account_key(&self) -> &str
Resolved account identity: account_key claim, falling back to
metering_key.
Sourcepub fn is_legacy_policy(&self) -> bool
pub fn is_legacy_policy(&self) -> bool
True when the token predates the v2 policy contract (all new identity/version fields are absent).
Sourcepub fn from_claims(claims: SessionClaims) -> AuthContext
pub fn from_claims(claims: SessionClaims) -> AuthContext
Create AuthContext from verified claims
Trait Implementations§
Source§impl Clone for AuthContext
impl Clone for AuthContext
Source§fn clone(&self) -> AuthContext
fn clone(&self) -> AuthContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more