#[non_exhaustive]pub struct JwtConfig {
pub signing_secret: String,
pub issuer: Option<String>,
pub access_ttl_secs: u64,
pub refresh_ttl_secs: u64,
pub max_per_user: usize,
pub touch_interval_secs: u64,
pub stateful_validation: bool,
pub access_source: TokenSourceConfig,
pub refresh_source: TokenSourceConfig,
}Expand description
Back-compat alias — prefer JwtSessionsConfig.
YAML configuration for JWT session services.
§Example
jwt:
signing_secret: "${JWT_SECRET}"
issuer: "my-app"
access_ttl_secs: 900
refresh_ttl_secs: 2592000
max_per_user: 20
touch_interval_secs: 300
stateful_validation: true
access_source:
kind: bearer
refresh_source:
kind: body
field: refresh_tokenFields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.signing_secret: StringHMAC secret used for signing and verifying tokens.
issuer: Option<String>Required issuer (iss). When set, the decoder rejects tokens whose iss does not match.
access_ttl_secs: u64Access token lifetime in seconds (default: 900 = 15 minutes).
refresh_ttl_secs: u64Refresh token lifetime in seconds (default: 2592000 = 30 days).
max_per_user: usizeMaximum concurrent sessions per user (default: 20).
touch_interval_secs: u64Minimum interval between session touch updates in seconds (default: 300).
stateful_validation: boolWhen true, tokens are validated against the session store on every request.
access_source: TokenSourceConfigWhere to extract access tokens from incoming requests.
refresh_source: TokenSourceConfigWhere to extract refresh tokens from incoming requests.
Implementations§
Trait Implementations§
Source§impl Clone for JwtSessionsConfig
impl Clone for JwtSessionsConfig
Source§fn clone(&self) -> JwtSessionsConfig
fn clone(&self) -> JwtSessionsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JwtSessionsConfig
impl Debug for JwtSessionsConfig
Source§impl Default for JwtSessionsConfig
impl Default for JwtSessionsConfig
Source§impl<'de> Deserialize<'de> for JwtSessionsConfigwhere
JwtSessionsConfig: Default,
impl<'de> Deserialize<'de> for JwtSessionsConfigwhere
JwtSessionsConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for JwtSessionsConfig
impl RefUnwindSafe for JwtSessionsConfig
impl Send for JwtSessionsConfig
impl Sync for JwtSessionsConfig
impl Unpin for JwtSessionsConfig
impl UnsafeUnpin for JwtSessionsConfig
impl UnwindSafe for JwtSessionsConfig
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