Files
sso/source/rust/vendor/ngx-rust/nginx-src
ssw c8a02b8c49 feat: 从网关项目剥离为独立 SSO 统一认证服务
定位:身份层(IdP + IAP),不含动态域名转发 / LLM 上游代理 / 用量计费。

代码(source/rust,nginx 动态模块 + Rust,单进程零外部依赖)
- IdP:authorization_code(含 PKCE)/ refresh_token / client_credentials / password
  四种 grant,含 discovery / introspect / userinfo / jwks 占位
- IAP:access 阶段门禁,注入 X-Auth-* 到后端,客户端伪造同名头被覆盖
- MaxKey 互通:/oauth/v20/* 与 /oauth2.0/* 别名 + context-path 归一化 + 扁平字段
- 管理接口:账号(含角色/部门/用户组)与 OAuth 接入方注册表,热写穿共享内存
- 模块改名 ngx_http_sso_module,指令 sso_state / sso_data_dir / sso_api / sso_iap,
  Cookie sso_sid(终端用户)与 sso_admin_session(管理员)两套身份两套会话

配置(source/conf)
- nginx.conf 生产模板(TLS、IAP 子域、含 auth_sub 的日志格式)
- nginx.test.conf 本机验证配置(明文 18095-18099)
- tls/README.md 证书约定与公钥比对校验

前端(source/www/admin.html)
- 三 tab:账号管理 / 接入方 / 接入指南;去掉审核队列、域名、LLM 上游、用量统计

测试与脚本
- tests/ 三套端到端:协议基线 14 项 · MaxKey 互通与接入 24 项 · 管理接口 31 项,全绿
- tests/demo-system 演示业务系统(Python 标准库),覆盖应用自建客户端与 IAP 零改造两种姿势
- scripts/run-local-e2e.sh 本机一键起停;scripts/seed-data.sh 物化运行时数据目录

文档
- README.md 概览与快速开始;CLAUDE.md 硬约定与排障速查
- docs/design.md 完整设计;docs/roadmap.md 待执行任务(v2 RS256+JWKS、用户管理界面)
2026-09-12 21:42:06 +08:00
..

nginx-src

The crate contains a vendored copy of the NGINX source and a logic to build it. It is intended to be consumed by the nginx-sys crate for CI builds, tests or rustdoc generation.

It is notably not intended for producing binaries suitable for production use. For such scenarios we recommend building the ngx-rust based module against the packages from https://nginx.org/ or your preferred distribution. See the nginx-sys documentation for building ngx-rust modules against an existing pre-configured NGINX source tree.

Versioning

This crate follows the latest stable branch of NGINX.

  • The major and minor fields are taken from the NGINX version.
  • The patch version is incremented on changes to the build logic or crate metadata.
  • The version metadata contains full version of NGINX.

Build Requirements

The crate can be built on common Unix-like operating systems and requires all the usual NGINX build dependencies (including development headers for the libraries) installed in system paths:

  • C compiler and toolchain
  • SSL library, OpenSSL or LibreSSL
  • PCRE or PCRE2
  • Zlib or zlib-ng witn Zlib compatible API enabled

We don't intend to support Windows at the moment, as NGINX does not support dynamic modules for this target.

Environment variables

Following variables can be set to customize the build.

  • NGX_CONFIGURE_ARGS — additional arguments to pass to the NGINX configure script.

    Example: export NGX_CONFIGURE_ARGS='--with-debug'; cargo build

  • NGX_CFLAGS, NGX_LDFLAGS — additional C compiler and linker flags to pass to the NGINX configure script. Internally, this is added to the --with-cc-opt=... and --with-ld-opt=... configure arguments.

    Example:

    export NGX_CFLAGS='-I/opt/boringssl/include'
    export NGX_LDFLAGS='-L/opt/boringssl/build -lstdc++'
    cargo build
    

Download NGINX and dependency sources during build

While we recommend using the system libraries, it is still possible to opt into downloading the NGINX itself and the dependency sources from the network with the help of the following variables:

  • NGX_VERSION — if specified, the version of NGINX to download and build instead of the one bundled with the crate.
  • OPENSSL_VERSION — if specified, the version of OpenSSL to download and use use instead of the system-provided library.
  • PCRE2_VERSION — if specified, the version of PCRE2 to download and use instead of the system-provided library.
  • ZLIB_VERSION — if specified, the version of Zlib to download and use instead of the system-provided library.

If the gpg executable is present in the path, the build script will verify the integrity of the downloaded files using GPG signatures and a known set of public keys. This behavior can be disabled by setting NGX_NO_SIGNATURE_CHECK.

License

The code in this crate is licensed under the Apache License 2.0. The crate also contains the source code of NGINX, distributed under the BSD 2-Clause License.