Skip to content

feat (auth): 添加第三方登录认证(OIDC)#592

Merged
xerrors merged 8 commits intoxerrors:mainfrom
DSYZayn:main
Apr 4, 2026
Merged

feat (auth): 添加第三方登录认证(OIDC)#592
xerrors merged 8 commits intoxerrors:mainfrom
DSYZayn:main

Conversation

@DSYZayn
Copy link
Copy Markdown
Contributor

@DSYZayn DSYZayn commented Mar 31, 2026

变更描述

#550
增加了以OIDC方式接入第三方登录认证的流程

  • 新增 OIDC 认证配置项到 third-party-auth.md 文件
  • 实现 OIDC 认证路由和处理逻辑,包括登录、回调和配置获取接口
  • 创建 OIDC 配置模型和服务工具类,支持从环境变量加载配置
  • 在前端登录页面添加 OIDC 登录选项,支持配置按钮文字标识显示
  • 添加 OIDC 认证相关配置文档说明
  • 支持自动创建 OIDC 用户和部门管理功能

变更类型

  • [✅] 新功能
  • Bug 修复
  • [✅] 文档更新
  • 其他

测试

  • [✅] 已在 Docker 环境测试
  • [✅] 相关功能正常工作

相关日志或者截图

image

说明

(可选)有什么需要特别说明的吗?

默认关闭此功能,需在环境变量中配置OIDC信息后重启Yuxi生效。


💡 提示: 提交前可以运行 make lintmake format 检查代码规范

已经尽量与原有代码风格和命名保持一致,但我使用windows+docker desktop开发测试,无法make lint & make format

DSYZayn and others added 2 commits April 1, 2026 00:42
- 新增 OIDC 认证配置项到 .env.template 文件
- 实现 OIDC 认证路由和处理逻辑,包括登录、回调和配置获取接口
- 创建 OIDC 配置模型和服务工具类,支持从环境变量加载配置
- 在前端登录页面添加 OIDC 登录选项,支持动态配置显示
- 添加 OIDC 认证相关配置文档说明
- 支持自动创建 OIDC 用户和部门管理功能
@DSYZayn DSYZayn marked this pull request as ready for review March 31, 2026 16:59
Copilot AI review requested due to automatic review settings March 31, 2026 16:59

This comment was marked as outdated.

@DSYZayn
Copy link
Copy Markdown
Contributor Author

DSYZayn commented Mar 31, 2026 via email

DSYZayn and others added 2 commits April 1, 2026 22:10
- 实现OIDC用户自动创建和部门管理逻辑,支持并发场景下的用户去重处理
- 重构OIDC回调流程,采用一次性code机制提升安全性,避免敏感信息通过URL传递
- 增加对已注销OIDC用户的恢复支持,兼容历史后缀用户ID格式
- 优化用户软删除逻辑,使用user_id和id组合生成哈希避免重名冲突
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xerrors
Copy link
Copy Markdown
Owner

xerrors commented Apr 2, 2026

这 copilot 不说我都不知道有这么多潜在风险🥹

有些可能是误报,那个你评判一下就可以

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@xerrors
Copy link
Copy Markdown
Owner

xerrors commented Apr 2, 2026

后面会 merge 到 0.6.1 的 release 里

Copy link
Copy Markdown
Owner

@xerrors xerrors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再次感谢 PR,最近才考虑merge 的事情。

这里我仅从代码结构上提几个建议,关于具体的功能我也不是很了解。

这里看到两个文件(两个 router)都涉及到了auth相关的内容,我觉得也不要将 oidc 相关的内容去拆分到两个router里面,也包含了config 和u tils , 是不是可以使用单独的一个 service 就可以包含这些内容放在server下面的service里面,接口依然是定义在 auth_router 里面,但是主要业务都在 service 里面。

另外关于环境变量的配置就不要放在点template的,因为在markdown文件里面都提到了,env.template 会变得有点冗杂

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xerrors xerrors merged commit 76b5156 into xerrors:main Apr 4, 2026
3 of 4 checks passed
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.

3 participants