pub struct AuthConfig {
pub secret: Vec<u8>,
pub issuer: Option<String>,
pub audience: Option<String>,
pub bearer_token: bool,
pub session_cookie_name: Option<String>,
}Expand description
How super::AuthLayer obtains and validates tokens.
Fields§
§secret: Vec<u8>HMAC secret for HS256.
issuer: Option<String>If set, iss must match.
audience: Option<String>If set, aud must match (single audience string).
bearer_token: boolAccept Authorization: Bearer <jwt>.
If set, also read a JWT from this cookie name (session-style).
Implementations§
Source§impl AuthConfig
impl AuthConfig
Also accept JWT stored in a browser cookie (common for session UX).
pub fn with_issuer(self, issuer: impl Into<String>) -> Self
pub fn with_audience(self, audience: impl Into<String>) -> Self
Sourcepub fn enable_bearer(self, yes: bool) -> Self
pub fn enable_bearer(self, yes: bool) -> Self
Enable or disable the Authorization: Bearer scheme (cookie-only when false).
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
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 moreAuto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnsafeUnpin for AuthConfig
impl UnwindSafe for AuthConfig
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