Skip to main content

Validator

Struct Validator 

Source
pub struct Validator<'a> { /* private fields */ }
Expand description

Prepared validator with mandatory audience/purpose and optional exact capabilities.

Implementations§

Source§

impl Validator<'_>

Source

pub fn into_owned(self) -> OwnedValidator

Take ownership of the realm/issuer labels and move the prepared policy and derived keys unchanged. No key derivation or cache namespace change occurs. The result may outlive the Authority and be stored in a long-lived service. Like any prepared validator, it retains its trust snapshot until replaced.

Source

pub fn validate( &self, token: &str, now: u64, hook: &dyn ValidationHook, ) -> Result<Arc<Principal>>

Source

pub fn validate_lapsed( &self, token: &str, now: u64, hook: &dyn ValidationHook, ) -> Result<Arc<Principal>>

A credential past its own expiry whose session may still be live: the envelope is authenticated and every check but the credential’s expiry runs, then the hook decides from the shared state (a revoked or expired session still refuses). For reissuing a carrier whose session outlived it, never for admitting work on the lapsed credential itself. Not cached: a lapsed credential is answered once, with a new one.

Source

pub fn validate_cached( &self, token: &str, now: u64, cache: &dyn PrincipalCache, ttl: Duration, hook: &dyn ValidationHook, ) -> Result<Arc<Principal>>

No token decryption, base64 or claims decoding on a warm cache hit. Hooks still consult current policy; FleetAuth checks its authenticated shared state.

TTL is caller-owned and never exceeds token expiry. Zero/subsecond TTL disables caching. Static checks and the hook run every time. Callers supply current Unix seconds from a trusted clock, never from client input.

Source

pub fn cache_key(&self, token: &str) -> Result<CacheKey>

Fingerprint calculation does not authenticate the token or expose its claims.

Auto Trait Implementations§

§

impl<'a> Freeze for Validator<'a>

§

impl<'a> RefUnwindSafe for Validator<'a>

§

impl<'a> Send for Validator<'a>

§

impl<'a> Sync for Validator<'a>

§

impl<'a> Unpin for Validator<'a>

§

impl<'a> UnsafeUnpin for Validator<'a>

§

impl<'a> UnwindSafe for Validator<'a>

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.