feat: 系统用户免登录认证,默认为admin操作所有接口

This commit is contained in:
TsMask committed 2024-11-25 20:00:50 +08:00
1 parent 75de667f7a
commit de9e557b2f
2 files changed
+1 -3

No files matched your search

-3
View File
@@ -26,9 +26,6 @@ func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
return func(c *gin.Context) {
// 登录认证,默认打开
enable := true
if v := config.Get("user.loginAuth"); v != nil {
enable = v.(bool)
}
if v := config.Get("user.cryptoApi"); v != nil && enable {
enable = v.(bool)
}
@@ -47,6 +47,7 @@ func PreAuthorize(options map[string][]string) gin.HandlerFunc {
loginUser.UserID = "2"
loginUser.User.UserID = "2"
loginUser.User.UserName = "admin"
loginUser.User.NickName = "admin"
c.Set(commonConstants.CTX_LOGIN_USER, loginUser)
c.Next()
return