pub struct JwtConfig {
pub key_material: JwtKeyMaterial,
pub issuer: String,
pub audience: Vec<String>,
pub ttl: Duration,
pub leeway: Duration,
}Expand description
JWT validation policy.
Fields§
§key_material: JwtKeyMaterialSigning and verification key material.
issuer: StringExpected issuer claim.
audience: Vec<String>Accepted audience claims.
ttl: DurationToken time-to-live. Generation helpers may use this value.
leeway: DurationClock-skew tolerance. Defaults to 30 seconds and must not exceed 60 seconds.
Implementations§
Source§impl JwtConfig
impl JwtConfig
Sourcepub fn asymmetric(
algorithm: AsymmetricAlgorithm,
private_key_pem: impl Into<String>,
public_key_pem: impl Into<String>,
issuer: impl Into<String>,
audience: Vec<String>,
) -> Self
pub fn asymmetric( algorithm: AsymmetricAlgorithm, private_key_pem: impl Into<String>, public_key_pem: impl Into<String>, issuer: impl Into<String>, audience: Vec<String>, ) -> Self
Create an asymmetric key configuration.
Sourcepub fn hs256_internal(
secret: impl Into<String>,
issuer: impl Into<String>,
audience: Vec<String>,
) -> Self
pub fn hs256_internal( secret: impl Into<String>, issuer: impl Into<String>, audience: Vec<String>, ) -> Self
Create an explicit internal-only HS256 configuration.
Sourcepub fn rs256(
private_key_pem: impl Into<String>,
public_key_pem: impl Into<String>,
issuer: impl Into<String>,
audience: Vec<String>,
) -> Self
pub fn rs256( private_key_pem: impl Into<String>, public_key_pem: impl Into<String>, issuer: impl Into<String>, audience: Vec<String>, ) -> Self
Create an RS256 configuration from PEM-encoded keys.
Sourcepub fn es256(
private_key_pem: impl Into<String>,
public_key_pem: impl Into<String>,
issuer: impl Into<String>,
audience: Vec<String>,
) -> Self
pub fn es256( private_key_pem: impl Into<String>, public_key_pem: impl Into<String>, issuer: impl Into<String>, audience: Vec<String>, ) -> Self
Create an ES256 configuration from PEM-encoded keys.
Sourcepub fn eddsa(
private_key_pem: impl Into<String>,
public_key_pem: impl Into<String>,
issuer: impl Into<String>,
audience: Vec<String>,
) -> Self
pub fn eddsa( private_key_pem: impl Into<String>, public_key_pem: impl Into<String>, issuer: impl Into<String>, audience: Vec<String>, ) -> Self
Create an EdDSA configuration from PEM-encoded keys.
Sourcepub const fn with_leeway(self, leeway: Duration) -> Self
pub const fn with_leeway(self, leeway: Duration) -> Self
Override clock skew tolerance.
Sourcepub const fn algorithm(&self) -> JwtAlgorithm
pub const fn algorithm(&self) -> JwtAlgorithm
Return the effective JWT algorithm.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for JwtConfig
impl<'de> Deserialize<'de> for JwtConfig
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 JwtConfig
impl RefUnwindSafe for JwtConfig
impl Send for JwtConfig
impl Sync for JwtConfig
impl Unpin for JwtConfig
impl UnsafeUnpin 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