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)。
Auto Trait Implementations§
impl Freeze for AuthFlowResult
impl RefUnwindSafe for AuthFlowResult
impl Send for AuthFlowResult
impl Sync for AuthFlowResult
impl Unpin for AuthFlowResult
impl UnsafeUnpin for AuthFlowResult
impl UnwindSafe for AuthFlowResult
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