feat: Standardize terminology, add well-known configuration

- Change the AppId and AppSecret on the Server End to the standard usage: ClientId, ClientSecret.
- add Well-Known configuration to store in database, no actual use in server end but store and display in web ui only
This commit is contained in:
OnEvent 2024-08-13 15:26:05 +08:00
parent e66b73faf5
commit af8be721c5
No known key found for this signature in database
GPG Key ID: 3CDB9068A32B4927
4 changed files with 13 additions and 9 deletions

View File

@ -71,8 +71,9 @@ var GitHubClientSecret = ""
var LarkClientId = ""
var LarkClientSecret = ""
var OidcAppId = ""
var OidcAppSecret = ""
var OidcClientId = ""
var OidcClientSecret = ""
var OidcWellKnown = ""
var OidcAuthorizationEndpoint = ""
var OidcTokenEndpoint = ""
var OidcUserinfoEndpoint = ""

View File

@ -38,8 +38,8 @@ func getOidcUserInfoByCode(code string) (*OidcUser, error) {
return nil, errors.New("无效的参数")
}
values := map[string]string{
"client_id": config.OidcAppId,
"client_secret": config.OidcAppSecret,
"client_id": config.OidcClientId,
"client_secret": config.OidcClientSecret,
"code": code,
"grant_type": "authorization_code",
"redirect_uri": fmt.Sprintf("%s/oauth/oidc", config.ServerAddress),

View File

@ -37,7 +37,8 @@ func GetStatus(c *gin.Context) {
"quota_per_unit": config.QuotaPerUnit,
"display_in_currency": config.DisplayInCurrencyEnabled,
"oidc": config.OidcEnabled,
"oidc_app_id": config.OidcAppId,
"oidc_client_id": config.OidcClientId,
"oidc_well_known": config.OidcWellKnown,
"oidc_authorization_endpoint": config.OidcAuthorizationEndpoint,
"oidc_token_endpoint": config.OidcTokenEndpoint,
"oidc_userinfo_endpoint": config.OidcUserinfoEndpoint,

View File

@ -179,10 +179,12 @@ func updateOptionMap(key string, value string) (err error) {
config.LarkClientId = value
case "LarkClientSecret":
config.LarkClientSecret = value
case "OidcAppId":
config.OidcAppId = value
case "OidcAppSecret":
config.OidcAppSecret = value
case "OidcClientId":
config.OidcClientId = value
case "OidcClientSecret":
config.OidcClientSecret = value
case "OidcWellKnown":
config.OidcWellKnown = value
case "OidcAuthorizationEndpoint":
config.OidcAuthorizationEndpoint = value
case "OidcTokenEndpoint":