pub struct AuthFlowResult {
pub auth: AuthResult,
pub login_id: Option<String>,
pub token: Option<TokenValue>,
pub context: SaTokenContext,
}Expand description
Outcome of run_auth_flow; bindings copy token/login_id/context into framework-specific storage (extensions, depot, etc.).
run_auth_flow 的返回结果;各框架绑定把 token / login_id / context 写入自身存储(extensions、Depot 等)。
Fields§
§auth: AuthResultPath rules + validation summary. | 路径规则与校验摘要。
login_id: Option<String>Login id when token is valid. | 登录 id(token 有效时)。
token: Option<TokenValue>Parsed token value when present. | 解析后的 token(若有)。
context: SaTokenContextRequest-scoped context for StpUtil / handlers. | 请求级上下文,供 StpUtil / 处理器使用。
Implementations§
Source§impl AuthFlowResult
impl AuthFlowResult
Sourcepub fn should_reject(&self) -> bool
pub fn should_reject(&self) -> bool
true if the binding should respond 401 (path requires auth but token missing or invalid).
若路径要求鉴权但 token 缺失或无效,绑定层应返回 401,则返回 true。
Sourcepub async fn run<F, R>(self, fut: F) -> Rwhere
F: Future<Output = R>,
pub async fn run<F, R>(self, fut: F) -> Rwhere
F: Future<Output = R>,
Run fut with SaTokenContext::scope using this flow’s AuthFlowResult::context (await-safe).
用本流的 AuthFlowResult::context 调用 SaTokenContext::scope 执行 fut(可跨 await)。
Context 内部可变:scope 后 switch_to 可就地突变共享 Arc。
同时建立授权快照:B2 特性,请求级权限缓存。
Context is internally mutable: switch_to can mutate shared Arc in-place after scope.
Also establishes authz snapshot (B2 feature, request-level permission cache).