-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'csghub-main' into csghub__refactor-get-current-user
- Loading branch information
Showing
4 changed files
with
27 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,16 @@ | ||
# 用户系统概述 | ||
|
||
我们的开源平台支持两种用户系统的接入方式: | ||
- 平台默认提供一个简单的用户登录授权系统,支持用户注册和登录,但不支持密码修改。 | ||
- 通过环境变量或系统配置,可以接入支持 OIDC 的用户登录授权系统。 | ||
|
||
## 如何切换两种用户登录系统 | ||
|
||
- 我们提供一个环境变量 `ON_PREMISE`,当其值为 `true` 时,系统将使用内置的用户系统进行用户登录授权验证。 | ||
- 当其值为 `false` 时,系统将通过接入外部的 OIDC 系统进行授权登录验证。 | ||
|
||
## OIDC 配置 | ||
|
||
所需的 OIDC 相关的配置项如下: | ||
|
||
1. 用于建立 OIDC 连接 | ||
- identifier: 客户端ID | ||
- secret: 客户端密钥 | ||
- authorization_endpoint: 授权接口 | ||
- token_endpoint: 获取 access token 接口 | ||
- userinfo_endpoint: 获取用户信息接口 | ||
- redirect_uri: callback URL | ||
|
||
2. 用于登录注册 | ||
- login_url: OIDC 登录入口 | ||
- signup_url: OIDC 注册入口 | ||
|
||
可以通过两种方式提供 OIDC 配置项: | ||
|
||
1. 通过环境变量 | ||
- OIDC_IDENTIFIER | ||
- OIDC_SECRET | ||
- OIDC_REDIRECT_URI | ||
- OIDC_AUTHORIZATION_ENDPOINT | ||
- OIDC_TOKEN_ENDPOINT | ||
- OIDC_USERINFO_ENDPOINT | ||
- LOGIN_URL | ||
- SIGNUP_URL | ||
|
||
2. 通过管理员后台进行系统设置 | ||
CSGHub 平台通过对接 Casdoor 实现了用户的登录授权,Casdoor 自身具备单点登录和第三方登录的能力,用户可以方便的进行配置和集成。 | ||
|
||
## 集成方式 | ||
在 csghub-server 的 user service 可以通过如下环境变量的配置进行 Casdoor 的接入: | ||
- STARHUB_SERVER_CASDOOR_CLIENT_ID: ${STARHUB_SERVER_CASDOOR_CLIENT_ID} | ||
- STARHUB_SERVER_CASDOOR_CLIENT_SECRET: ${STARHUB_SERVER_CASDOOR_CLIENT_SECRET} | ||
- STARHUB_SERVER_CASDOOR_ENDPOINT: ${STARHUB_SERVER_CASDOOR_ENDPOINT} | ||
- STARHUB_SERVER_CASDOOR_CERTIFICATE: <casdoor_stg_cert-token_jwt_key.pem> | ||
- STARHUB_SERVER_CASDOOR_ORGANIZATION_NAME: ${STARHUB_SERVER_CASDOOR_ORGANIZATION_NAME} | ||
- STARHUB_SERVER_CASDOOR_APPLICATION_NAME: ${STARHUB_SERVER_CASDOOR_APPLICATION_NAME} | ||
|
||
## 特别注意 | ||
1. 第三方登录的用户,因为各个集成的第三方系统的差异(可能会没有用户名,或者用户名为中文等情况),这些差异跟我们自身系统不兼容 | ||
所以对于第三方登录的用户,我们强制要求用户对用户名进行更新,且只能更新一次 | ||
2. 目前 csghub-server 还未完成 casdoor 密码回写的集成,所以系统暂不支持更新用户密码 |
This file contains 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
This file contains 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
This file contains 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