feat: 系统用户免登录认证,默认为admin操作所有接口
This commit is contained in:
@@ -26,9 +26,6 @@ func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
|||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
// 登录认证,默认打开
|
// 登录认证,默认打开
|
||||||
enable := true
|
enable := true
|
||||||
if v := config.Get("user.loginAuth"); v != nil {
|
|
||||||
enable = v.(bool)
|
|
||||||
}
|
|
||||||
if v := config.Get("user.cryptoApi"); v != nil && enable {
|
if v := config.Get("user.cryptoApi"); v != nil && enable {
|
||||||
enable = v.(bool)
|
enable = v.(bool)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ func PreAuthorize(options map[string][]string) gin.HandlerFunc {
|
|||||||
loginUser.UserID = "2"
|
loginUser.UserID = "2"
|
||||||
loginUser.User.UserID = "2"
|
loginUser.User.UserID = "2"
|
||||||
loginUser.User.UserName = "admin"
|
loginUser.User.UserName = "admin"
|
||||||
|
loginUser.User.NickName = "admin"
|
||||||
c.Set(commonConstants.CTX_LOGIN_USER, loginUser)
|
c.Set(commonConstants.CTX_LOGIN_USER, loginUser)
|
||||||
c.Next()
|
c.Next()
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user