(c *gin.Context)
| 76 | } |
| 77 | |
| 78 | func checkSession(c *gin.Context) bool { |
| 79 | psession, err := global.SESSION.Get(c) |
| 80 | if err != nil { |
| 81 | return false |
| 82 | } |
| 83 | c.Set(psessionUtils.GinContextSessionUserKey, psession) |
| 84 | sessionTimeout, err := baseRepo.NewISettingRepo().GetValueByKey("SessionTimeout") |
| 85 | if err != nil { |
| 86 | global.LOG.Errorf("get session timeout failed, err: %v", err) |
| 87 | return false |
| 88 | } |
| 89 | lifeTime, _ := strconv.Atoi(sessionTimeout) |
| 90 | if _, err := global.SESSION.RefreshIfNeeded(c, psession, global.CONF.Conn.SSL == constant.StatusEnable, lifeTime); err != nil { |
| 91 | global.LOG.Warnf("proxy refresh session failed, path=%s, err=%v", c.Request.URL.Path, err) |
| 92 | return false |
| 93 | } |
| 94 | return true |
| 95 | } |
| 96 | |
| 97 | func isLocalAPI(urlPath string) bool { |
| 98 | return urlPath == "/api/v2/core/xpack/sync/ssl" || urlPath == "/api/v2/core/xpack/settings/search" |
no test coverage detected