Repository navigation
Conversation
Integrate configurable OIDC sign-in with PKCE, discovery, verified ID tokens, local user provisioning, and Keycloak/Dex docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能概述
本 PR 为 CyberStrikeAI 新增基于 OpenID Connect(OIDC) 的单点登录(SSO)功能,使其能够与 Keycloak、Dex 及其他符合 OIDC 标准的身份认证服务集成。
该功能采用可选配置,默认关闭,并保留现有的用户名、密码登录方式及 RBAC 权限体系。
本次实现以最小侵入为原则,不新增数据库表、不进行数据库迁移,尽可能复用项目原有的用户管理、Session 和权限控制机制。
主要功能
1. 标准 OIDC 登录
<issuer>/.well-known/openid-configuration获取服务端元数据。discovery_url自定义发现地址,以适配部分非标准部署。github.com/coreos/go-oidc/v3完成 ID Token 验证和 JWKS 公钥验证,目前支持 RS256。2. 用户自动创建与账号绑定
viewer角色,避免自动获得高权限。issuer和sub生成身份指纹,用于后续登录校验。3. 登录页面集成
login_label自定义登录按钮文字。4. 配置与文档
CYBERSTRIKE_OIDC_CLIENT_SECRET环境变量提供客户端密钥。配置示例
以 Keycloak 为例:
Client Secret 建议通过
CYBERSTRIKE_OIDC_CLIENT_SECRET环境变量注入。Dex 及其他标准 OIDC Provider 可以采用类似方式接入,具体配置请参考新增文档
docs/zh-CN/oidc-login.md。测试验证
已完成以下检查:
Self-update跨平台测试通过(Ubuntu / macOS / Windows)。Process isolation跨平台测试通过(Ubuntu / macOS / Windows)。兼容性及安全边界
兼容性:
当前实现边界:
password_hash字段保存 OIDC 身份绑定标识,以避免数据库结构变更。欢迎维护者就此设计提出建议。