1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2026 Kirky.X🌠
// SPDX-License-Identifier: Apache-2.0
//! 路由模块:`GarrisonInterceptor` 预处理 hook(按 annotation 调用 `GarrisonUtil`),
//! `DefaultGarrisonInterceptor` 默认实现,`GarrisonRouter` 包装 `axum::Router`(cfg `web-axum`),
//! `GarrisonLayer` middleware 自动从 header/cookie 提取 token 并设置 task_local。
use crateAnnotation;
use crateGarrisonResult;
use async_trait;
/// 拦截器 trait:实现方在 `pre_handle` 中按 annotation 调用
/// `GarrisonUtil` 鉴权方法,middleware 在执行 handler 前调用,返回 `Err` 时短路返回错误响应。
// DefaultGarrisonInterceptor(always compiled)
/// 默认拦截器:按 annotation 变体分派 `GarrisonUtil` 鉴权方法。
///
/// CheckLogin / CheckRole / CheckPermission / CheckSafe / CheckDisable / CheckApiKey 直接调用对应方法;
/// CheckBasicAuth / CheckDigestAuth / CheckSign 依赖 HTTP 请求上下文(`pre_handle` 仅有 path + annotation)
/// 无法校验,Fail Loud 返回 `GarrisonError::NotImplemented`,引导改用 axum extractor 或 secure 模块;
/// Ignore / CheckOr / CheckAnd / CheckNot / Mode 为 no-op(组合逻辑由注解处理器或路由配置层处理)。
;
// GarrisonRouter(cfg feature = "web-axum")
pub use GarrisonRouter;
/// 无 `web-axum` feature 时的占位类型(维持 prelude 重导出可用)。
;
/// 租户解析 middleware 的 re-export。
///
/// 仅在 `web-axum` + `tenant-isolation` 双 feature 启用时可用。
pub use tenant_resolution_middleware;