pub struct StateRevocationStore { /* private fields */ }Expand description
Revocation list backed by a StateStore. Each revoked JTI is one
counter; the Redis backend expires it 24 h after the write, far past the
15-minute NHI lifetime, so the list cleans itself up.
Implementations§
Source§impl StateRevocationStore
impl StateRevocationStore
Sourcepub fn new(store: Arc<dyn StateStore>) -> Self
pub fn new(store: Arc<dyn StateStore>) -> Self
Wrap the harness state store.
Sourcepub fn with_namespace(store: Arc<dyn StateStore>, namespace: &str) -> Self
pub fn with_namespace(store: Arc<dyn StateStore>, namespace: &str) -> Self
Isolate a harness-issued token namespace from upstream token IDs. Namespace names are supplied by the application, never by token claims.
Trait Implementations§
Source§impl RevocationStore for StateRevocationStore
impl RevocationStore for StateRevocationStore
Source§fn revoke(&self, jti: &str, expires_at: u64) -> Result<(), String>
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>
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,
_expires_at: u64,
) -> Result<RevokeOutcome, String>
fn try_revoke_token( &self, issuer: &str, jti: &str, _expires_at: 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>
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>
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,
instance_uid: &str,
cutoff: u64,
_expires_at: u64,
) -> Result<(), String>
fn revoke_instance( &self, instance_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,
instance_uid: &str,
iat: u64,
) -> Result<Option<RevokedBy>, String>
fn check( &self, jti: &str, instance_uid: &str, iat: u64, ) -> Result<Option<RevokedBy>, String>
Check both the operator-wide token identifier and instance cutoff.
Source§fn health(&self) -> Option<RevocationHealth>
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)
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.
Auto Trait Implementations§
impl Freeze for StateRevocationStore
impl !RefUnwindSafe for StateRevocationStore
impl Send for StateRevocationStore
impl Sync for StateRevocationStore
impl Unpin for StateRevocationStore
impl UnsafeUnpin for StateRevocationStore
impl !UnwindSafe for StateRevocationStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn 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>
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)
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)
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
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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