pub struct SaTokenLayer { /* private fields */ }Expand description
Optional PathAuthConfig: if set, should_reject → 401 without call_next.
可选 PathAuthConfig:命中拒绝条件时直接 401,不调用后续。
When path_config is None, successful login data is written to Depot (sa_token, sa_login_id).
path_config 为 None 时,将 token / login_id 写入 Depot(sa_token、sa_login_id)。
Implementations§
Source§impl SaTokenLayer
impl SaTokenLayer
Sourcepub fn new(state: SaTokenState) -> SaTokenLayer
pub fn new(state: SaTokenState) -> SaTokenLayer
No path rules; depot + context only after validation. | 无路径规则,仅校验后写 Depot + 上下文。
Sourcepub fn with_path_auth(
state: SaTokenState,
config: PathAuthConfig,
) -> SaTokenLayer
pub fn with_path_auth( state: SaTokenState, config: PathAuthConfig, ) -> SaTokenLayer
Enable Ant-style include/exclude + optional login-id validator (PathAuthConfig).
启用路径包含/排除与可选登录 id 校验(PathAuthConfig)。
Trait Implementations§
Source§impl Clone for SaTokenLayer
impl Clone for SaTokenLayer
Source§fn clone(&self) -> SaTokenLayer
fn clone(&self) -> SaTokenLayer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Handler for SaTokenLayer
impl Handler for SaTokenLayer
Source§fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
SaTokenLayer: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
req: &'life1 mut Request,
depot: &'life2 mut Depot,
res: &'life3 mut Response,
ctrl: &'life4 mut FlowCtrl,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
SaTokenLayer: 'async_trait,
Handle http request.
Source§fn arc(self) -> ArcHandlerwhere
Self: Sized,
fn arc(self) -> ArcHandlerwhere
Self: Sized,
Wrap to
ArcHandler.Source§fn hoop<H>(self, hoop: H) -> HoopedHandler
fn hoop<H>(self, hoop: H) -> HoopedHandler
Hoop this handler with middleware.
Auto Trait Implementations§
impl Freeze for SaTokenLayer
impl !RefUnwindSafe for SaTokenLayer
impl Send for SaTokenLayer
impl Sync for SaTokenLayer
impl Unpin for SaTokenLayer
impl UnsafeUnpin for SaTokenLayer
impl !UnwindSafe for SaTokenLayer
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