feat(oidc): 支持自定义 OIDC 登录显示名称 - #6012
Conversation
Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughOIDC settings now support a configurable display name with trimming and a default fallback. The resolved value is used by the OIDC provider name and included in the status response, with tests covering both integrations. ChangesOIDC Custom Display Name
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
docs/superpowers/specs/2026-07-08-oidc-custom-display-name-design.md (1)
47-54: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDesign doc code snippet is stale vs. actual implementation.
GetEffectiveDisplayName trims the configured DisplayName and defaults to the literal "OIDC" when empty. The doc's snippet omits
strings.TrimSpace, which per the commit summary was added later ("fixing whitespace trimming so blank values fall back correctly"). Consider updating the doc snippet to match the final implementation for future readers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/superpowers/specs/2026-07-08-oidc-custom-display-name-design.md` around lines 47 - 54, The design doc snippet for OIDCSettings.GetEffectiveDisplayName is stale and should match the actual implementation. Update the example to reflect that GetEffectiveDisplayName trims whitespace from DisplayName before checking emptiness, and only falls back to the literal "OIDC" when the trimmed value is empty. Keep the reference anchored to OIDCSettings and GetEffectiveDisplayName so readers can find the correct behavior even if the implementation changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/classic/src/i18n/locales/ru.json`:
- Around line 3514-3515: The Russian translation for the hint tied to the OIDC
display-name field is awkward and should be rewritten in `ru.json` so it clearly
says the value falls back to OIDC when left blank. Update the string for the
hint associated with the `"留空则默认显示为 OIDC,例如:公司 SSO"` entry to a more natural
Russian phrasing, keeping the same meaning and matching the OIDC display-name
context.
---
Nitpick comments:
In `@docs/superpowers/specs/2026-07-08-oidc-custom-display-name-design.md`:
- Around line 47-54: The design doc snippet for
OIDCSettings.GetEffectiveDisplayName is stale and should match the actual
implementation. Update the example to reflect that GetEffectiveDisplayName trims
whitespace from DisplayName before checking emptiness, and only falls back to
the literal "OIDC" when the trimmed value is empty. Keep the reference anchored
to OIDCSettings and GetEffectiveDisplayName so readers can find the correct
behavior even if the implementation changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 41bd6999-da04-42ba-9b77-a67cc0ddd43e
📒 Files selected for processing (29)
controller/misc.godocs/superpowers/specs/2026-07-08-oidc-custom-display-name-design.mdoauth/oidc.gooauth/oidc_test.gosetting/system_setting/oidc.gosetting/system_setting/oidc_test.goweb/classic/src/components/auth/LoginForm.jsxweb/classic/src/components/settings/SystemSetting.jsxweb/classic/src/i18n/locales/en.jsonweb/classic/src/i18n/locales/fr.jsonweb/classic/src/i18n/locales/ja.jsonweb/classic/src/i18n/locales/ru.jsonweb/classic/src/i18n/locales/vi.jsonweb/classic/src/i18n/locales/zh-CN.jsonweb/classic/src/i18n/locales/zh-TW.jsonweb/classic/src/i18n/locales/zh.jsonweb/default/src/features/auth/components/oauth-providers.tsxweb/default/src/features/auth/types.tsweb/default/src/features/system-settings/auth/index.tsxweb/default/src/features/system-settings/auth/oauth-section.tsxweb/default/src/features/system-settings/auth/section-registry.tsxweb/default/src/features/system-settings/types.tsweb/default/src/i18n/locales/en.jsonweb/default/src/i18n/locales/fr.jsonweb/default/src/i18n/locales/ja.jsonweb/default/src/i18n/locales/ru.jsonweb/default/src/i18n/locales/vi.jsonweb/default/src/i18n/locales/zh-TW.jsonweb/default/src/i18n/locales/zh.json
Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project.
Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors.
|
Sorry for accidentally submitting part of the design document. It has been fixed. |
…ranslation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback.
|
@Calcium-Ion Is there any hope that this PR will be merged? If so, I'll resolve the conflicts; if not, let's just close it :) |
…m-display-name # Conflicts: # web/classic/src/components/auth/LoginForm.jsx # web/classic/src/components/settings/SystemSetting.jsx # web/classic/src/i18n/locales/en.json # web/classic/src/i18n/locales/fr.json # web/classic/src/i18n/locales/ja.json # web/classic/src/i18n/locales/ru.json # web/classic/src/i18n/locales/vi.json # web/classic/src/i18n/locales/zh-CN.json # web/classic/src/i18n/locales/zh-TW.json # web/classic/src/i18n/locales/zh.json
* docs: add design spec for OIDC custom display name Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy. * feat(oidc): add configurable display name with OIDC fallback * feat(oidc): use configured display name in provider name and status API * feat(oidc): add display name field to default-theme OIDC settings Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5 * feat(oidc): show configured display name on default-theme login button * feat(oidc): add display name field to classic-theme OIDC settings * feat(oidc): show configured display name on classic-theme login button * fix(oidc): trim whitespace before applying display name fallback * chore: remove internal design doc from PR Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project. * fix(oidc): lead with example in classic-theme display name placeholder Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors. * fix(i18n): improve Russian grammar in OIDC display-name placeholder translation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback. * test(web): remove redundant OIDC harness tests
* docs: add design spec for OIDC custom display name Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy. * feat(oidc): add configurable display name with OIDC fallback * feat(oidc): use configured display name in provider name and status API * feat(oidc): add display name field to default-theme OIDC settings Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5 * feat(oidc): show configured display name on default-theme login button * feat(oidc): add display name field to classic-theme OIDC settings * feat(oidc): show configured display name on classic-theme login button * fix(oidc): trim whitespace before applying display name fallback * chore: remove internal design doc from PR Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project. * fix(oidc): lead with example in classic-theme display name placeholder Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors. * fix(i18n): improve Russian grammar in OIDC display-name placeholder translation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback. * test(web): remove redundant OIDC harness tests
* docs: add design spec for OIDC custom display name Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy. * feat(oidc): add configurable display name with OIDC fallback * feat(oidc): use configured display name in provider name and status API * feat(oidc): add display name field to default-theme OIDC settings Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5 * feat(oidc): show configured display name on default-theme login button * feat(oidc): add display name field to classic-theme OIDC settings * feat(oidc): show configured display name on classic-theme login button * fix(oidc): trim whitespace before applying display name fallback * chore: remove internal design doc from PR Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project. * fix(oidc): lead with example in classic-theme display name placeholder Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors. * fix(i18n): improve Russian grammar in OIDC display-name placeholder translation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback. * test(web): remove redundant OIDC harness tests
* docs: add design spec for OIDC custom display name Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy. * feat(oidc): add configurable display name with OIDC fallback * feat(oidc): use configured display name in provider name and status API * feat(oidc): add display name field to default-theme OIDC settings Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5 * feat(oidc): show configured display name on default-theme login button * feat(oidc): add display name field to classic-theme OIDC settings * feat(oidc): show configured display name on classic-theme login button * fix(oidc): trim whitespace before applying display name fallback * chore: remove internal design doc from PR Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project. * fix(oidc): lead with example in classic-theme display name placeholder Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors. * fix(i18n): improve Russian grammar in OIDC display-name placeholder translation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback. * test(web): remove redundant OIDC harness tests
合并上游 16 个提交,主要是 token Auto 分组 (QuantumNous#6590)、deepseek responses API (QuantumNous#6562)、Bedrock 客户端断开取消 (QuantumNous#6589)、分层重试计费加固 (QuantumNous#6518/QuantumNous#6570)、 zstd 请求解压 (QuantumNous#6545)、OIDC 自定义显示名 (QuantumNous#6012)、日志暴露 stream_status (QuantumNous#6558)。 33 处冲突的处理: - 11 个 legacy channel adaptor:上游删除 panic 之后的死代码以配合新增的 go vet CI,本仓早已把整段 panic 换成返回 ErrLegacyAdaptorNotImplemented, 已达成同一目的且不会让中继链路 panic,保留本仓实现。 - relay-aws.go 流式循环:两侧改动正交,合并保留 —— 上游的 ctx.Done() 取消 分支(客户端断开时不再空转上游),加本仓的 finalizeClaudeOnError(提前 返回时补发流终止符,否则 Claude 格式调用方会一直挂着)。 - 7 个 locale:两侧各自插入相邻 key,按字母序归并;上游 24 个新 key 与本仓 1278 个 fork key 全部保留,逐一核对无丢失。 - keys / oauth / profile 前端:上游 Auto 分组为主体,叠加本仓改动; account-bindings-tab 与 oauth/$provider 保留本仓实现,理由见下。 测试取舍: - 不引入 model/token_auto_groups_cache_test.go:它依赖上游的 truncateTables, 该助手全局清表,与本仓行级清理原则冲突(共享库里有开发数据)。 - 不携带上游 controller/token_test.go:其迁移兼容测试会替换 model.DB 并在 cleanup 里关闭,后续用 harness 连接的测试会拿到已关闭的句柄。按既有约定, token_auto_groups_test.go 需要的四个助手放进 zz_upstream_test_shims_test.go, 其中 openTokenControllerTestDB 增加了 model.DB/LOG_DB 的成对保存还原。 本仓原 token_test.go 的 controller 行为测试迁到 gen_ctrl_token_handlers_test.go,与上游文件名脱钩以免再冲突。 - 三处断言随上游行为更新:stream_status 现对日志所有者可见;deepseek 的 ConvertOpenAIResponsesRequest 已实现不再返回错误;计费路径判定收紧为 「标记之外还需带对应 usage payload」,并补了三个反向用例锁住该语义。 遗留:oauth 绑定回调仍用 window.opener 判定 bind/login,上游 QuantumNous#6425 已改为 sessionStorage 标记 + state 比对。该修复要求 popup 先以 about:blank 打开再打 标记,本仓四个内置 provider 走 window.open(url) 直开,直接套用会让绑定永远 判成 login,故本次未采纳,需单独改造。
* v1.0.0-rc.24: (117 commits) CI: enhance release synchronization workflow with optional file syncing fix: 修复兑换码额度精度损失 (QuantumNous#6685) feat(rate-limit): add user critical rate limit middleware for access token and aff transfer routes fix: test Claude/Gemini endpoints with native request format (QuantumNous#6698) feat(channels): refine fetched model categorization (QuantumNous#6632) Merge commit from fork refactor(relay): move replay metadata onto request bodies fix(relay): set Request.GetBody so the HTTP/2 transport can transparently retry after an upstream stream reset (QuantumNous#6249) Feat/auto group (QuantumNous#6590) fix(aws): cancel Bedrock requests on client disconnect (QuantumNous#6589) fix(billing): harden tiered retry group-switch billing (QuantumNous#6570) fix(billing): settle tiered retries with final group (QuantumNous#6518) feat: deepseek responses api (QuantumNous#6562) style: use text-sm for public header nav links to match other nav components (QuantumNous#6557) fix(oauth): stop treating a foreign window.opener as a bind flow (QuantumNous#6425) fix(relay): preserve multipart image edits for New API channels (QuantumNous#6559) feat(logs): expose stream status to log owners (QuantumNous#6558) feat: support zstd request decompression (QuantumNous#6545) fix: preserve Qwen thinking_budget passthrough (QuantumNous#5836) feat(oidc): 支持自定义 OIDC 登录显示名称 (QuantumNous#6012) ... # Conflicts: # service/text_quota.go # web/src/features/models/components/drawers/model-mutate-drawer.tsx # web/src/features/pricing/components/model-details.tsx # web/src/features/pricing/lib/price.ts
* docs: add design spec for OIDC custom display name Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy. * feat(oidc): add configurable display name with OIDC fallback * feat(oidc): use configured display name in provider name and status API * feat(oidc): add display name field to default-theme OIDC settings Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5 * feat(oidc): show configured display name on default-theme login button * feat(oidc): add display name field to classic-theme OIDC settings * feat(oidc): show configured display name on classic-theme login button * fix(oidc): trim whitespace before applying display name fallback * chore: remove internal design doc from PR Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project. * fix(oidc): lead with example in classic-theme display name placeholder Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors. * fix(i18n): improve Russian grammar in OIDC display-name placeholder translation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback. * test(web): remove redundant OIDC harness tests
* docs: add design spec for OIDC custom display name Mirrors the existing Custom OAuth Provider name pattern so admins can show a meaningful label instead of the hardcoded "OIDC" on the login page and in related copy. * feat(oidc): add configurable display name with OIDC fallback * feat(oidc): use configured display name in provider name and status API * feat(oidc): add display name field to default-theme OIDC settings Claude-Session: https://claude.ai/code/session_01FDkWJqigJi9yE3HG5pjZP5 * feat(oidc): show configured display name on default-theme login button * feat(oidc): add display name field to classic-theme OIDC settings * feat(oidc): show configured display name on classic-theme login button * fix(oidc): trim whitespace before applying display name fallback * chore: remove internal design doc from PR Design/planning docs are working artifacts for this session and shouldn't be submitted to the upstream project. * fix(oidc): lead with example in classic-theme display name placeholder Reorders the combined placeholder to show the example first, then the fallback note, matching the Custom OAuth Provider Name field's placeholder convention (example-only) that this feature mirrors. * fix(i18n): improve Russian grammar in OIDC display-name placeholder translation Leads each clause with its condition/subject and adds the missing verb, per PR review feedback. * test(web): remove redundant OIDC harness tests
Note
本 PR 的代码由 AI 辅助生成(Claude Code),提交者非本项目历史核心贡献者。设计文档、实施计划与逐任务代码评审记录见下方描述与提交历史。
📝 变更描述 / Description
OIDC 登录相关的按钮文案、OAuth 错误提示、以及新用户首次登录时自动生成的 DisplayName,此前都硬编码为字面量 "OIDC"。本 PR 参考项目里已有的「自定义 OAuth 渠道」(Custom OAuth Provider)功能中可配置
Name字段的模式,为内置 OIDC 渠道增加一个可选的「显示名称」设置项:OIDCSettings新增DisplayName字段(复用现有的通用options键值持久化机制,无需迁移),新增GetEffectiveDisplayName()方法,留空时回退为字面量"OIDC"。该方法被oauth/oidc.go的GetName()和controller/misc.go的公开/api/status接口复用,因此错误提示文案、自动生成的用户 DisplayName、登录页按钮文案都会联动。web/default(新版主题)与web/classic(旧版主题):设置页 OIDC 分区新增「显示名称」输入框,登录页按钮文案改为读取该配置(复用已有的Continue with {{name}}/使用 {{name}} 继续国际化 key,未新增 key),并为设置页新增的字段标签补充了全部语言包翻译。🚀 变更类型 / Type of change
✅ 提交前检查项 / Checklist
📸 运行证明 / Proof of Work
go test ./...:全仓库测试套件全部通过。setting/system_setting/oidc_test.go(GetEffectiveDisplayName的空值回退 / 空白字符 trim / 自定义值场景)、oauth/oidc_test.go(OIDCProvider.GetName()联动验证)。web/default:bun run build与bun run typecheck均通过;bun run i18n:sync确认 7 个语言包新增 key 均无缺失。web/classic:新增 JSON 语言包已通过JSON.parse校验;bun run build因仓库既有的、与本次改动无关的依赖冲突(bun workspace 提升后的date-fns@4.4.0与 Semi UI 依赖的date-fns-tz@1.3.8版本不兼容)暂时无法运行——已在全新 worktree 上用改动前的代码复现同样的失败,确认是预先存在的问题,本 PR 未触碰相关依赖。/api/setup→ 登录 →PUT /api/option/设置oidc.display_name=Acme SSO并启用 OIDC,确认GET /api/status返回"oidc_display_name":"Acme SSO";清空该配置后确认回退为"oidc_display_name":"OIDC",验证了两套前端登录按钮实际读取的字段契约。Summary by CodeRabbit
New Features
Tests