pub struct SecureJwtConfig {Show 13 fields
pub allowed_algorithms: Vec<Algorithm>,
pub required_issuers: HashSet<String>,
pub required_audiences: HashSet<String>,
pub max_token_lifetime: Duration,
pub clock_skew: Duration,
pub require_jti: bool,
pub validate_nbf: bool,
pub allowed_token_types: HashSet<String>,
pub require_secure_transport: bool,
pub jwt_secret: String,
pub rsa_public_key_pem: Option<String>,
pub ec_public_key_pem: Option<String>,
pub ed_public_key_pem: Option<String>,
}Fields§
§allowed_algorithms: Vec<Algorithm>§required_issuers: HashSet<String>§required_audiences: HashSet<String>§max_token_lifetime: Duration§clock_skew: Duration§require_jti: bool§validate_nbf: bool§allowed_token_types: HashSet<String>§require_secure_transport: bool§jwt_secret: StringHMAC secret for HS256/HS384/HS512
rsa_public_key_pem: Option<String>PEM-encoded RSA public key for RS256/RS384/RS512/PS256/PS384/PS512
ec_public_key_pem: Option<String>PEM-encoded EC public key for ES256/ES384
ed_public_key_pem: Option<String>PEM-encoded Ed25519 public key for EdDSA
Implementations§
Source§impl SecureJwtConfig
Validates JWT tokens with configurable algorithm support and in-memory revocation.
impl SecureJwtConfig
Validates JWT tokens with configurable algorithm support and in-memory revocation.
§Revocation Architecture
SecureJwtValidator maintains an in-memory revocation list (HashMap<JTI, SystemTime>)
protected by a Mutex. This list is lost on process restart and is intended as a
supplementary fast-path cache — not as a durable revocation store.
For production deployments, durable revocation should be handled by the storage-backed
layer in the API module (see src/api/auth.rs), which persists revoked JTIs in the
configured KV / database backend.
To bridge both layers, callers can register an optional on_revoke callback via
SecureJwtValidator::set_on_revoke. When set, every call to [revoke_token] will
first insert into the in-memory map and then invoke the callback with the JTI string,
allowing the caller to persist the revocation to external storage without changing the
existing API surface.
§Size Limits
[cleanup_revoked_tokens] enforces a hard cap of 10 000 entries and time-based eviction
to prevent unbounded memory growth.
Sourcepub fn builder() -> SecureJwtConfigBuilder
pub fn builder() -> SecureJwtConfigBuilder
Create a new builder with secure default configurations.
Trait Implementations§
Source§impl Clone for SecureJwtConfig
impl Clone for SecureJwtConfig
Source§fn clone(&self) -> SecureJwtConfig
fn clone(&self) -> SecureJwtConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecureJwtConfig
impl Debug for SecureJwtConfig
Auto Trait Implementations§
impl Freeze for SecureJwtConfig
impl RefUnwindSafe for SecureJwtConfig
impl Send for SecureJwtConfig
impl Sync for SecureJwtConfig
impl Unpin for SecureJwtConfig
impl UnsafeUnpin for SecureJwtConfig
impl UnwindSafe for SecureJwtConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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