pub struct JwtPolicy { /* private fields */ }Expand description
Issuance lifetimes and strict namespace. Namespace/session checks cannot be disabled. Old JWT formats require reauthentication rather than an implicit fallback parser.
Implementations§
Source§impl JwtPolicy
impl JwtPolicy
Sourcepub fn new(
issuer: impl Into<String>,
audience: impl Into<String>,
access_ttl_secs: u64,
refresh_ttl_secs: u64,
) -> Result<Self>
pub fn new( issuer: impl Into<String>, audience: impl Into<String>, access_ttl_secs: u64, refresh_ttl_secs: u64, ) -> Result<Self>
Creates a strict HS256 policy with no skew and a 16 KiB token budget.
§Errors
Returns InvalidPolicy for invalid namespaces or zero/unrepresentable lifetimes.
Sourcepub const fn with_algorithm(self, algorithm: JwtAlgorithm) -> Self
pub const fn with_algorithm(self, algorithm: JwtAlgorithm) -> Self
Selects the sole accepted algorithm with its corresponding minimum key size.
Sourcepub fn with_leeway(self, seconds: u64) -> Result<Self>
pub fn with_leeway(self, seconds: u64) -> Result<Self>
Sourcepub fn with_max_token_bytes(self, bytes: usize) -> Result<Self>
pub fn with_max_token_bytes(self, bytes: usize) -> Result<Self>
Sets a parser/issuance budget checked before header parsing.
§Errors
Returns InvalidPolicy for a zero budget.
Sourcepub const fn access_ttl_secs(&self) -> u64
pub const fn access_ttl_secs(&self) -> u64
Returns access lifetime in seconds.
Sourcepub const fn refresh_ttl_secs(&self) -> u64
pub const fn refresh_ttl_secs(&self) -> u64
Returns refresh lifetime in seconds.
Sourcepub const fn leeway_secs(&self) -> u64
pub const fn leeway_secs(&self) -> u64
Returns skew in seconds.
Sourcepub const fn max_token_bytes(&self) -> usize
pub const fn max_token_bytes(&self) -> usize
Returns parser budget in bytes.
Trait Implementations§
impl Eq for JwtPolicy
impl StructuralPartialEq for JwtPolicy
Auto Trait Implementations§
impl Freeze for JwtPolicy
impl RefUnwindSafe for JwtPolicy
impl Send for JwtPolicy
impl Sync for JwtPolicy
impl Unpin for JwtPolicy
impl UnsafeUnpin for JwtPolicy
impl UnwindSafe for JwtPolicy
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