mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat: add external url for casdoor #603
This commit is contained in:
parent
6f9046485b
commit
835349c33f
5 changed files with 27 additions and 10 deletions
|
@ -87,11 +87,16 @@ func CasdoorCallback(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetCasdoorUri(c *gin.Context) {
|
func GetCasdoorUri(c *gin.Context) {
|
||||||
endpoint := settings.CasdoorSettings.Endpoint
|
|
||||||
clientId := settings.CasdoorSettings.ClientId
|
clientId := settings.CasdoorSettings.ClientId
|
||||||
redirectUri := settings.CasdoorSettings.RedirectUri
|
redirectUri := settings.CasdoorSettings.RedirectUri
|
||||||
state := settings.CasdoorSettings.Application
|
state := settings.CasdoorSettings.Application
|
||||||
|
|
||||||
|
endpoint := settings.CasdoorSettings.Endpoint
|
||||||
|
// feature request #603
|
||||||
|
if settings.CasdoorSettings.ExternalUrl != "" {
|
||||||
|
endpoint = settings.CasdoorSettings.ExternalUrl
|
||||||
|
}
|
||||||
|
|
||||||
if endpoint == "" || clientId == "" || redirectUri == "" || state == "" {
|
if endpoint == "" || clientId == "" || redirectUri == "" || state == "" {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"uri": "",
|
"uri": "",
|
||||||
|
|
|
@ -9,6 +9,13 @@ By integrating Casdoor, Nginx UI can leverage these features to improve security
|
||||||
|
|
||||||
This is the Endpoint of the Casdoor server. You need to make sure that Nginx UI can access this URL.
|
This is the Endpoint of the Casdoor server. You need to make sure that Nginx UI can access this URL.
|
||||||
|
|
||||||
|
## ExternalUrl
|
||||||
|
- Type: `string`
|
||||||
|
- Version: `>= v2.0.0-beta.42`
|
||||||
|
|
||||||
|
This is the external URL of the Casdoor server. It is used to generate the redirect URI.
|
||||||
|
If this option is not configured, the Endpoint will be used as the base URL for the redirect URI.
|
||||||
|
|
||||||
## ClientId
|
## ClientId
|
||||||
- Type: `string`
|
- Type: `string`
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,12 @@ Casdoor 是一个强大的、全面的身份认证解决方案,支持 OAuth 2.
|
||||||
|
|
||||||
这是 Casdoor 服务器的 URL。您需要确保 Nginx UI 可以访问此 URL。
|
这是 Casdoor 服务器的 URL。您需要确保 Nginx UI 可以访问此 URL。
|
||||||
|
|
||||||
|
## ExternalUrl
|
||||||
|
- 类型:`string`
|
||||||
|
- 版本: `>= v2.0.0-beta.42`
|
||||||
|
|
||||||
|
这是 Casdoor 服务器的外部 URL。它用于生成重定向 URI,在不配置次选项的情况下,将使用 Endpoint 作为重定向 URI 的基本 URL。
|
||||||
|
|
||||||
## ClientId
|
## ClientId
|
||||||
- 类型:`string`
|
- 类型:`string`
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,12 @@ Casdoor 是一個強大的、全面的身份認證解決方案,支持 OAuth 2.
|
||||||
|
|
||||||
這是 Casdoor 服務器的 URL。您需要確保 Nginx UI 可以訪問此 URL。
|
這是 Casdoor 服務器的 URL。您需要確保 Nginx UI 可以訪問此 URL。
|
||||||
|
|
||||||
|
## ExternalUrl
|
||||||
|
- 種類:`string`
|
||||||
|
- 版本: `>= v2.0.0-beta.42`
|
||||||
|
|
||||||
|
這是 Casdoor 伺服器的外部 URL。它用於生成重定向 URI,在未配置此選項的情況下,將使用 Endpoint 作為重定向 URI 的基本 URL。
|
||||||
|
|
||||||
## ClientId
|
## ClientId
|
||||||
- 類型:`string`
|
- 類型:`string`
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package settings
|
||||||
|
|
||||||
type Casdoor struct {
|
type Casdoor struct {
|
||||||
Endpoint string `json:"endpoint" protected:"true"`
|
Endpoint string `json:"endpoint" protected:"true"`
|
||||||
|
ExternalUrl string `json:"external_url" protected:"true"`
|
||||||
ClientId string `json:"client_id" protected:"true"`
|
ClientId string `json:"client_id" protected:"true"`
|
||||||
ClientSecret string `json:"client_secret" protected:"true"`
|
ClientSecret string `json:"client_secret" protected:"true"`
|
||||||
CertificatePath string `json:"certificate_path" protected:"true"`
|
CertificatePath string `json:"certificate_path" protected:"true"`
|
||||||
|
@ -10,12 +11,4 @@ type Casdoor struct {
|
||||||
RedirectUri string `json:"redirect_uri" protected:"true"`
|
RedirectUri string `json:"redirect_uri" protected:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var CasdoorSettings = &Casdoor{
|
var CasdoorSettings = &Casdoor{}
|
||||||
Endpoint: "",
|
|
||||||
ClientId: "",
|
|
||||||
ClientSecret: "",
|
|
||||||
CertificatePath: "",
|
|
||||||
Organization: "",
|
|
||||||
Application: "",
|
|
||||||
RedirectUri: "",
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue