修改登录逻辑

This commit is contained in:
2026-07-06 15:54:27 +08:00
parent fe66794168
commit 53b1842de8
12 changed files with 198 additions and 28 deletions

View File

@@ -74,8 +74,10 @@ https://你的域名/api/auth/callback
- `ZHINIAN_AUTH_REQUIRED=auto`:生产默认启用;本地可信开发可设为 `0`
- `ZHINIAN_AUTH_BASE_URL=https://<gateway-domain>/auth`
- `ZHINIAN_AUTH_CLIENT_ID=app`
- `ZHINIAN_AUTH_CLIENT_SECRET=app`
- `ZHINIAN_AUTH_CLIENT_ID=custom`
- `ZHINIAN_AUTH_CLIENT_SECRET=custom`
- `ZHINIAN_ADMIN_AUTH_CLIENT_ID=app`
- `ZHINIAN_ADMIN_AUTH_CLIENT_SECRET=app`
- `ZHINIAN_AUTH_SCOPE=server`
- `ZHINIAN_AUTH_ISSUER=https://pig4cloud.com`
- `ZHINIAN_AUTH_PASSWORD_ENC_KEY=thanks,pig4cloud`:按认证中心 `security.encode-key` 对 password grant 的密码做 AES-CFB 加密
@@ -85,7 +87,7 @@ https://你的域名/api/auth/callback
`/create``/assets``/settings``/logs``/accounts`、第一方生成/资产 API、以及本地上传和生成结果文件都会受登录态保护。`/logs``/settings``/accounts``/api/admin/*` 需要管理员权限。`/api/v1/*` 继续使用 `ZHINIAN_API_KEYS`,不走浏览器 SSO。
如果认证中心客户端未加入 `security.ignore-clients``/oauth2/token` 可能返回“验证码不能为空”。当前推荐使用运维分配的 `app/app` 客户端;如改用 `customPC` 登录平台用户,需要认证中心把该 clientId 加入 `security.ignore-clients`
如果认证中心客户端未加入 `security.ignore-clients``/oauth2/token` 可能返回“验证码不能为空”。普通账号登录默认使用 `custom/custom`登录页里的“管理员登录”入口使用 `app/app`。两组 client 都需要认证中心允许 password grant
## 组织账号管理
@@ -161,8 +163,10 @@ cp .env.example .env.local
- `ZHINIAN_AUTH_REQUIRED=auto`
- `ZHINIAN_AUTH_BASE_URL`
- `ZHINIAN_AUTH_CLIENT_ID=app`
- `ZHINIAN_AUTH_CLIENT_ID=custom`
- `ZHINIAN_AUTH_CLIENT_SECRET`
- `ZHINIAN_ADMIN_AUTH_CLIENT_ID=app`
- `ZHINIAN_ADMIN_AUTH_CLIENT_SECRET`
- `ZHINIAN_AUTH_SCOPE=server`
- `ZHINIAN_AUTH_ISSUER=https://pig4cloud.com`
- `ZHINIAN_AUTH_SESSION_SECRET`