pub struct AuthState<DB: DatabaseAdapter> {
pub config: Arc<AuthConfig>,
pub database: Arc<DB>,
pub session_manager: SessionManager<DB>,
pub email_provider: Option<Arc<dyn EmailProvider>>,
}Expand description
Axum-friendly shared state type.
All fields are behind Arc so AuthState is cheap to clone and can
be used directly as axum State.
Fields§
§config: Arc<AuthConfig>§database: Arc<DB>§session_manager: SessionManager<DB>§email_provider: Option<Arc<dyn EmailProvider>>Implementations§
Source§impl<DB: DatabaseAdapter> AuthState<DB>
impl<DB: DatabaseAdapter> AuthState<DB>
Sourcepub fn new(ctx: &AuthContext<DB>, session_manager: SessionManager<DB>) -> Self
pub fn new(ctx: &AuthContext<DB>, session_manager: SessionManager<DB>) -> Self
Create a new AuthState from an AuthContext and SessionManager.
Sourcepub fn to_context(&self) -> AuthContext<DB>
pub fn to_context(&self) -> AuthContext<DB>
Create an AuthContext for use with existing plugin handler methods.
Build a Set-Cookie header value for a session token.
Build a Set-Cookie header value that clears the session cookie.
Trait Implementations§
Auto Trait Implementations§
impl<DB> Freeze for AuthState<DB>
impl<DB> !RefUnwindSafe for AuthState<DB>
impl<DB> Send for AuthState<DB>
impl<DB> Sync for AuthState<DB>
impl<DB> Unpin for AuthState<DB>
impl<DB> UnsafeUnpin for AuthState<DB>
impl<DB> !UnwindSafe for AuthState<DB>
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