Skip to main content

GuardedRevocationStore

Struct GuardedRevocationStore 

Source
pub struct GuardedRevocationStore { /* private fields */ }
Expand description

Fail-closed protection for distributed revocation storage. Only confirmed revocations and locally requested revocations are cached. A successful “not revoked” answer is never cached, so replicas see later revocations on the next request. Failed writes still return errors to their callers.

Reads are limited to 32 concurrent dependency calls. After three consecutive errors, reads fail immediately for one second; then one caller probes recovery. Writes always reach the backing store, even while the circuit is open. Positive JTI and instance entries share a strict 100,000-entry bound.

Implementations§

Source§

impl GuardedRevocationStore

Source

pub fn new( inner: Arc<dyn RevocationStore>, metrics: &Registry, namespace: &'static str, ) -> Self

Wrap a Redis-backed store. Namespace is nhi or exchanged; any other caller-supplied name shares the fixed other metric label.

Trait Implementations§

Source§

impl RevocationStore for GuardedRevocationStore

Source§

fn health(&self) -> Option<RevocationHealth>

Read local health without contacting storage. None means the backend does not expose a fallible dependency or availability guard.
Source§

fn sweep_expired(&self, now_s: u64)

Reclaim entries past their retention period when the backend needs an explicit sweep. Distributed stores normally use their native TTL.
Source§

fn revoke(&self, jti: &str, expires_at: u64) -> Result<(), String>

Mark a JTI as revoked across issuers for an authorized operator. Holder requests must use try_revoke_token. expires_at is the epoch second at which the entry is last required (the token’s exp plus verifier leeway). An error means the caller cannot confirm that the write succeeded.
Source§

fn try_revoke( &self, jti: &str, expires_at: u64, ) -> Result<RevokeOutcome, String>

Atomically record a revocation and report whether it is new. Backends overriding this method can deduplicate audit records.
Source§

fn try_revoke_token( &self, issuer: &str, jti: &str, expiry: u64, ) -> Result<RevokeOutcome, String>

Revoke a holder-authenticated token only within its verified issuer. This must use a separate key domain from operator-wide JTI rules. Backends without scoped storage fail closed instead of widening the holder’s authority to every issuer.
Source§

fn check_token( &self, issuer: &str, jti: &str, uid: &str, iat: u64, ) -> Result<Option<RevokedBy>, String>

Check an issuer-scoped holder rule and the explicit operator-wide rules. The default preserves global checks for older implementations, which cannot accept scoped writes until they override both methods.
Source§

fn is_revoked(&self, jti: &str) -> Result<bool, String>

Ok(true) if an operator-wide JTI rule is present. Identity validation must use check_token to include issuer-scoped rules. An error means the store could not answer; the validator then refuses the token.
Source§

fn revoke_instance( &self, uid: &str, cutoff: u64, expires_at: u64, ) -> Result<(), String>

Revoke tokens of an instance issued at or before issued_at_or_before. Repeated writes must never lower either the cutoff or retention time.
Source§

fn check( &self, jti: &str, uid: &str, iat: u64, ) -> Result<Option<RevokedBy>, String>

Check both the operator-wide token identifier and instance cutoff.

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
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

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

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

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

§

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
§

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> 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 = 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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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

§

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

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,