Files
sso/rust/Cargo.toml
T

61 lines
3.0 KiB
TOML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# iPass SSO 网关 —— Cargo workspace
#
# 结构(参考 ipass/cache 的插件化拆分思路):
# 本仓库只持有「SSO 身份网关」自身:
# crates/plugin-sso —— 身份插件:OAuth2/OIDC 签发与校验、IAP 身份注入
# gateway —— 装配层:module 壳 + 插件注册表 → 产出单个 .so
#
# 通用框架(内核 ipass-core / 唯一 cdylib 装配 / vendored ngx-rust / 其它子系统)
# 全部来自主项目 ipass/ipass-core(兄弟仓库 ../ipass-core),
# 通过 path 依赖引入,不在此仓库重复维护(避免与上游内核 fork 漂移)。
#
# 为什么是「单 .so + crate 级插件」而不是「多 .so 运行时插件」:
# nginx 动态模块没有稳定 ABI,Rust 侧更是如此(每个 cdylib 各链一份 std)。
# 跨 .so 共享状态要自己造 C ABI 契约,且 zone tag / 同名变量都会冲突
# (详见 docs/plugin-architecture-analysis.md)。
[workspace]
members = ["gateway"]
exclude = ["target"]
[workspace.package]
version = "1.0.0"
edition = "2021"
publish = false
# ---------------------------------------------------------------------------
# ⚠️ 依赖必须用 vendored 源码(../ipass-core/rust/vendor/ngx-rust),不能走 crates.io,
# 也不能走 git:
#
# 1) `ngx = "0.5"`(crates.io 0.5.1)只发布了配置阶段接口(HttpModule),
# 请求阶段 API(add_phase_handler / HttpPhase / HttpRequestHandler)尚未发版,
# 实测直接编译失败:unresolved imports `ngx::http::HttpPhase`
#
# 2) git 依赖会永久挂起:ngx-rust 挂了一个指向完整 nginx 仓库的 submodule
# [submodule "nginx-src/nginx"] url = https://github.com/nginx/nginx.git
# cargo 解析 git 依赖时会 update_submodules,去克隆几十 MB 的 nginx 仓库,
# 国内网络下卡死(实测 cargo 5 分钟 0% CPU,调用栈停在
# GitSource::block_until_ready -> GitCheckout::update_submodules -> fetch -> wait4)。
#
# 因此 vendor 到 ../ipass-core/rust/vendor/ngx-rust/,用 path 依赖:
# 离线可编译、无子模块、版本锁定。
# ---------------------------------------------------------------------------
[workspace.dependencies]
ngx = { path = "../../ipass-core/rust/vendor/ngx-rust" }
nginx-sys = { path = "../../ipass-core/rust/vendor/ngx-rust/nginx-sys" }
ipass-core = { path = "../../ipass-core/rust/crates/ipass-core" }
ipass-plugin-sso = { path = "../../ipass-plugin-sso" }
# 业务层依赖:全部是纯 Rust 实现,不引入任何系统库或常驻依赖
serde = { version = "1", features = ["derive"] }
serde_json = "1" # 空 Vec / Vec<Map> 天然序列化为 [] / {},前后端契约简单
sha2 = "0.10" # 口令哈希 + JWT 的 HMAC-SHA256 + PKCE S256
getrandom = "0.2" # 会话 token / 授权码 / 客户端密钥;不可退化成可预测伪随机
libc = "0.2" # 仅用于 localtime_r / time / strftime
[profile.release]
opt-level = 3
lto = true
codegen-units = 1
# 模块被加载进 nginx 这个 C 进程,panic 绝不能跨 FFI 边界展开
panic = "abort"
strip = true