定位:身份层(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、用户管理界面)
93 lines
2.7 KiB
Makefile
93 lines
2.7 KiB
Makefile
.DEFAULT_GOAL := help
|
|
MAKE_MAJOR_VER := $(shell echo $(MAKE_VERSION) | cut -d'.' -f1)
|
|
|
|
ifneq ($(shell test $(MAKE_MAJOR_VER) -gt 3; echo $$?),0)
|
|
$(error Make version $(MAKE_VERSION) is not supported, please install GNU Make 4.x)
|
|
endif
|
|
|
|
CACHE_DIR ?= $(abspath $(CURDIR)/.cache)
|
|
GREP ?= $(shell command -v ggrep 2> /dev/null || command -v grep 2> /dev/null)
|
|
SED ?= $(shell command -v gsed 2> /dev/null || command -v sed 2> /dev/null)
|
|
AWK ?= $(shell command -v gawk 2> /dev/null || command -v awk 2> /dev/null)
|
|
VERSION ?= $(shell $(GREP) -Po '^version\s+=\s+"\K.*?(?=")' $(CURDIR)/Cargo.toml)
|
|
CARGO ?= cargo
|
|
DOCKER ?= docker
|
|
DOCKER_BUILD_FLAGS ?= --load
|
|
COMMITSAR_DOCKER := $(DOCKER) run --tty --rm --workdir /src -v "$(CURDIR):/src" aevea/commitsar
|
|
COMMITSAR ?= $(shell command -v commitsar 2> /dev/null)
|
|
PROJECT_NAME ?= ngx-rust
|
|
GITHUB_REPOSITORY ?= nginx/$(PROJECT_NAME)
|
|
SRC_REPO := https://github.com/$(GITHUB_REPOSITORY)
|
|
|
|
RELEASE_BUILD_FLAGS ?= --quiet --release
|
|
|
|
Q = $(if $(filter 1,$V),,@)
|
|
M = $(shell printf "\033[34;1m▶\033[0m")
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
ifeq ($(UNAME_S),Linux)
|
|
FEATURES += --features=linux
|
|
endif
|
|
|
|
# Use docker based commitsar if it isn't in the path
|
|
ifeq ($(COMMITSAR),)
|
|
COMMITSAR = $(COMMITSAR_DOCKER)
|
|
endif
|
|
|
|
.PHONY: help
|
|
help:
|
|
@$(GREP) --no-filename -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
$(AWK) 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-28s\033[0m %s\n", $$1, $$2}' | sort
|
|
|
|
.PHONY: clean
|
|
clean: clean-cache; $(info $(M) cleaning...) @ ## Cleanup everything
|
|
$Q rm -rf $(CURDIR)/target
|
|
$Q $(CARGO) clean
|
|
|
|
.PHONY: clean-cache
|
|
clean-cache: ## Remove all cached dependencies and build artifacts
|
|
$(Q) rm -rf $(CACHE_DIR)
|
|
|
|
.PHONY: commitsar
|
|
commitsar: ## Run git commit linter
|
|
$Q $(info $(M) running commitsar...)
|
|
$(COMMITSAR)
|
|
|
|
target:
|
|
$Q mkdir -p $@
|
|
|
|
.PHONY: debug
|
|
debug: target/debug ## Build current platform target in debug mode
|
|
|
|
target/debug:
|
|
$Q echo "$(M) building in debug mode for the current platform"
|
|
$Q $(CARGO) build --quiet
|
|
|
|
.PHONY: release
|
|
release: target/release ## Build current platform target in release mode
|
|
|
|
target/release:
|
|
$Q echo "$(M) building in release mode for the current platform"
|
|
$Q $(CARGO) build $(RELEASE_BUILD_FLAGS)
|
|
|
|
.PHONY: test
|
|
test: ## Run tests
|
|
$Q $(CARGO) test
|
|
|
|
.PHONY: format
|
|
format: ## Run rustfmt
|
|
$Q $(CARGO) fmt
|
|
|
|
.PHONY: lint
|
|
lint: ## Run clippy
|
|
$Q $(CARGO) clippy
|
|
|
|
.PHONY: examples-debug
|
|
examples-debug:
|
|
$Q echo "$(M) building all examples as debug"
|
|
$Q $(CARGO) build --quiet --package=examples --examples $(FEATURES)
|
|
|
|
include $(CURDIR)/build/container.mk
|
|
include $(CURDIR)/build/release.mk
|
|
include $(CURDIR)/build/github.mk
|