From d48644468032e4ee5c16a824e819ef6e36a28c5f Mon Sep 17 00:00:00 2001 From: lejianwen <84855512@qq.com> Date: Fri, 7 Feb 2025 17:51:42 +0800 Subject: [PATCH] feat: Web sso env (#125) --- conf/config.yaml | 1 + config/config.go | 1 + http/controller/api/login.go | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/config.yaml b/conf/config.yaml index 15a4771..c8bc2cc 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -4,6 +4,7 @@ app: register: false #是否开启注册 show-swagger: 0 # 1:启用 0:禁用 token-expire: 360000 + web-sso: true #web auth sso admin: title: "RustDesk Api Admin" hello-file: "./conf/admin/hello.html" #优先使用file diff --git a/config/config.go b/config/config.go index 40abff8..666119b 100644 --- a/config/config.go +++ b/config/config.go @@ -17,6 +17,7 @@ type App struct { Register bool `mapstructure:"register"` ShowSwagger int `mapstructure:"show-swagger"` TokenExpire int `mapstructure:"token-expire"` + WebSso bool `mapstructure:"web-sso"` } type Admin struct { Title string `mapstructure:"title"` diff --git a/http/controller/api/login.go b/http/controller/api/login.go index 1d093b5..4fbb46c 100644 --- a/http/controller/api/login.go +++ b/http/controller/api/login.go @@ -85,7 +85,9 @@ func (l *Login) Login(c *gin.Context) { // @Router /login-options [get] func (l *Login) LoginOptions(c *gin.Context) { ops := service.AllService.OauthService.GetOauthProviders() - ops = append(ops, model.OauthTypeWebauth) + if global.Config.App.WebSso { + ops = append(ops, model.OauthTypeWebauth) + } var oidcItems []map[string]string for _, v := range ops { oidcItems = append(oidcItems, map[string]string{"name": v})