fix(casdoor): use certificate path instead to address env issue #584

This commit is contained in:
Jacky 2024-10-06 22:46:57 +08:00
parent 4d1adac8c4
commit 20e55e715d
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
9 changed files with 62 additions and 52 deletions

View file

@ -1,21 +1,21 @@
package settings
type Casdoor struct {
Endpoint string `json:"endpoint" protected:"true"`
ClientId string `json:"client_id" protected:"true"`
ClientSecret string `json:"client_secret" protected:"true"`
Certificate string `json:"certificate" protected:"true"`
Organization string `json:"organization" protected:"true"`
Application string `json:"application" protected:"true"`
RedirectUri string `json:"redirect_uri" protected:"true"`
Endpoint string `json:"endpoint" protected:"true"`
ClientId string `json:"client_id" protected:"true"`
ClientSecret string `json:"client_secret" protected:"true"`
CertificatePath string `json:"certificate_path" protected:"true"`
Organization string `json:"organization" protected:"true"`
Application string `json:"application" protected:"true"`
RedirectUri string `json:"redirect_uri" protected:"true"`
}
var CasdoorSettings = Casdoor{
Endpoint: "",
ClientId: "",
ClientSecret: "",
Certificate: "",
Organization: "",
Application: "",
RedirectUri: "",
Endpoint: "",
ClientId: "",
ClientSecret: "",
CertificatePath: "",
Organization: "",
Application: "",
RedirectUri: "",
}

View file

@ -44,7 +44,7 @@ func TestSetup(t *testing.T) {
_ = os.Setenv("NGINX_UI_CASDOOR_ENDPOINT", "https://casdoor.example.com")
_ = os.Setenv("NGINX_UI_CASDOOR_CLIENT_ID", "clientId")
_ = os.Setenv("NGINX_UI_CASDOOR_CLIENT_SECRET", "clientSecret")
_ = os.Setenv("NGINX_UI_CASDOOR_CERTIFICATE", "cert.pem")
_ = os.Setenv("NGINX_UI_CASDOOR_CERTIFICATE_PATH", "cert.pem")
_ = os.Setenv("NGINX_UI_CASDOOR_ORGANIZATION", "org1")
_ = os.Setenv("NGINX_UI_CASDOOR_APPLICATION", "app1")
_ = os.Setenv("NGINX_UI_CASDOOR_REDIRECT_URI", "https://redirect.example.com")
@ -93,7 +93,7 @@ func TestSetup(t *testing.T) {
assert.Equal(t, "https://casdoor.example.com", CasdoorSettings.Endpoint)
assert.Equal(t, "clientId", CasdoorSettings.ClientId)
assert.Equal(t, "clientSecret", CasdoorSettings.ClientSecret)
assert.Equal(t, "cert.pem", CasdoorSettings.Certificate)
assert.Equal(t, "cert.pem", CasdoorSettings.CertificatePath)
assert.Equal(t, "org1", CasdoorSettings.Organization)
assert.Equal(t, "app1", CasdoorSettings.Application)
assert.Equal(t, "https://redirect.example.com", CasdoorSettings.RedirectUri)