Skip to content

fix(sso): converge Etech provisioning on trusted UID and native accounts - #39

Merged
opendev9 merged 4 commits into
devfrom
fix/etech-account-identity
Oct 20, 2026
Merged

opendev9 merged 4 commits into
devfrom
fix/etech-account-identity

Conversation

@opendev9

Copy link
Copy Markdown

Etech 的管理员预建和首次登录此前使用不同命名规则,缺失 UID 的 OAuth 登录还可能回到 CE 兼容路径。此分支让两种创建入口按可信 Directory 的 UID 复用原生用户;新用户统一使用小写 account@auth.local,账号冲突拒绝,历史账号不重命名。

  • 在精简 V2 中增加只使用原生 User、Profile、SocialAuthUser 的最小登录建号适配器,不依赖旧框架表;与管理员预建共享命名和 UID/账号锁。
  • /oidc/login/ 复用现有 OAuth 客户端及 /oauth/callback/,验证 ID Token;首次建号要求签名声明和 UserInfo 的 userId 一致,再由 Directory 核对 UID/在职状态。
  • Etech 严格模式由明确的 userId 映射决定,缺 UID 或 Directory 部署映射错误都拒绝,不按邮箱合并、不改写为工号。通用 CE 建号机制保持自身规则。
  • 已有 UID 用户不受新建账号格式限制,包括缺失、中文、邮箱形式及超长账号元数据;UID、启用状态、绑定一致性仍严格核对。显式缺失的 Etech account 不能触发 UUID 建号。

验证:本轮 59 项 Hub 定向测试通过,覆盖登录先于同步、同步先于登录、多认证绑定、历史名称复用、非法新建、UID/账号冲突、停用、OAuth/OIDC 校验与管理解析。原生 SQL/RPC 边界使用隔离测试替身,未连接真实数据库;不代表 DEV 真实登录或文件读写验收。

上线顺序:先审核持久配置,再换镜像并核对源码回执的 Hub SHA。关闭退役的 CF_SSO_EAP_PROFILE_IDENTITY;配置正确 OAUTH_OIDC_ISSUER 和 OAUTH_OIDC_JWKS_URI;LOGIN_URL 包含 SITE_ROOT 前缀(当前 DEV 为 /seafile/oidc/login/)。保持 userId -> login_id、客户端和已有回调不变。HTTP DEV 核对 OAUTH_ENABLE_INSECURE_TRANSPORT=True,HTTPS 生产不因此开启该设置。

本 PR 不改 Authentik、不改数据库结构或历史数据、不部署。会话恢复、失败清理 Cookie、文件历史调用方式单独处理;历史账号迁移不进入正常登录流程。

opendev9 and others added 4 commits October 20, 2026 16:29
seahub/oauth/views.py imports seahub.settings directly, so Django's
override_settings never reached CF_DIRECTORY_URL in these callback tests.
Patch views.settings like the existing Directory refresh test does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@opendev9
opendev9 marked this pull request as ready for review October 20, 2026 09:54
@opendev9
opendev9 merged commit 313953c into dev Oct 20, 2026
1 check passed
@opendev9
opendev9 deleted the fix/etech-account-identity branch October 21, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant