pub struct JwtConfig { /* private fields */ }Expand description
Implementations§
Source§impl JwtConfig
impl JwtConfig
Sourcepub fn new(secret: &str) -> Self
pub fn new(secret: &str) -> Self
Create a new JWT configuration with HMAC secret.
§Arguments
secret- Secret key for signing/verifying tokens (min 32 chars recommended)
Sourcepub fn expiration_secs(self, secs: u64) -> Self
pub fn expiration_secs(self, secs: u64) -> Self
Set expiration time in seconds.
Sourcepub fn expiration_hours(self, hours: u64) -> Self
pub fn expiration_hours(self, hours: u64) -> Self
Set expiration time in hours.
Sourcepub fn expiration_days(self, days: u64) -> Self
pub fn expiration_days(self, days: u64) -> Self
Set expiration time in days.
Sourcepub fn leeway_secs(self, secs: u64) -> Self
pub fn leeway_secs(self, secs: u64) -> Self
Set leeway for expiration validation.
Sourcepub fn header_prefix(self, prefix: &str) -> Self
pub fn header_prefix(self, prefix: &str) -> Self
Set the header prefix (default: “Bearer “).
Sourcepub fn header_name(self, name: &str) -> Self
pub fn header_name(self, name: &str) -> Self
Set the header name (default: “Authorization”).
Sourcepub fn disable_exp_validation(self) -> Self
pub fn disable_exp_validation(self) -> Self
Disable expiration validation (not recommended for production).
Sourcepub fn expiration_duration(&self) -> Duration
pub fn expiration_duration(&self) -> Duration
Get expiration duration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JwtConfig
impl RefUnwindSafe for JwtConfig
impl Send for JwtConfig
impl Sync for JwtConfig
impl Unpin for JwtConfig
impl UnwindSafe for JwtConfig
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
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>
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