Struct mailpot_web::AuthLayer
source · pub struct AuthLayer<Store, UserId, User, Role = ()> {
state: AuthState<Store, UserId, User, Role>,
}
Expand description
Layer that provides session-based authentication via AuthContext
.
Fields§
§state: AuthState<Store, UserId, User, Role>
Implementations§
source§impl<Store, UserId, User, Role> AuthLayer<Store, UserId, User, Role>where
Store: UserStore<UserId, Role, User = User>,
User: AuthUser<UserId, Role>,
Role: PartialOrd<Role> + PartialEq<Role> + Clone + Send + Sync + 'static,
impl<Store, UserId, User, Role> AuthLayer<Store, UserId, User, Role>where Store: UserStore<UserId, Role, User = User>, User: AuthUser<UserId, Role>, Role: PartialOrd<Role> + PartialEq<Role> + Clone + Send + Sync + 'static,
sourcepub fn new(store: Store, secret: &[u8]) -> AuthLayer<Store, UserId, User, Role>
pub fn new(store: Store, secret: &[u8]) -> AuthLayer<Store, UserId, User, Role>
Creates a layer which will attach the AuthContext
and User
to
requests via extensions.
Note that the secret
is used to derive a key for HMAC signing. For
security reasons, this value must be securely generated.
Trait Implementations§
source§impl<Store, UserId, User, Role> Clone for AuthLayer<Store, UserId, User, Role>where
Store: Clone,
UserId: Clone,
User: Clone,
Role: Clone,
impl<Store, UserId, User, Role> Clone for AuthLayer<Store, UserId, User, Role>where Store: Clone, UserId: Clone, User: Clone, Role: Clone,
Auto Trait Implementations§
impl<Store, UserId, User, Role> RefUnwindSafe for AuthLayer<Store, UserId, User, Role>where Role: RefUnwindSafe, Store: RefUnwindSafe, User: RefUnwindSafe, UserId: RefUnwindSafe,
impl<Store, UserId, User, Role> Send for AuthLayer<Store, UserId, User, Role>where Role: Send, Store: Send, User: Send, UserId: Send,
impl<Store, UserId, User, Role> Sync for AuthLayer<Store, UserId, User, Role>where Role: Sync, Store: Sync, User: Sync, UserId: Sync,
impl<Store, UserId, User, Role> Unpin for AuthLayer<Store, UserId, User, Role>where Role: Unpin, Store: Unpin, User: Unpin, UserId: Unpin,
impl<Store, UserId, User, Role> UnwindSafe for AuthLayer<Store, UserId, User, Role>where Role: UnwindSafe, Store: UnwindSafe, User: UnwindSafe, UserId: UnwindSafe,
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