Forráskód Böngészése

feat:bitoken增加有效期

wangchuanjin 1 éve
szülő
commit
34a4afd616
1 módosított fájl, 7 hozzáadás és 4 törlés
  1. 7 4
      core/proxy/broker/outServer/SussBi.go

+ 7 - 4
core/proxy/broker/outServer/SussBi.go

@@ -10,6 +10,7 @@ import (
 	"net/url"
 	"regexp"
 	"strings"
+	"time"
 
 	"app.yhyue.com/moapp/jybase/common"
 	"bp.jydev.jianyu360.cn/BaseService/gateway/core/router"
@@ -174,10 +175,12 @@ func (s *sussBi) CheckLoginOut(r *ghttp.Request) bool {
 func (s *sussBi) Filter(r *ghttp.Request) error {
 	ctx := router.GetGContext(r.GetCtx())
 	http.SetCookie(r.Response.ResponseWriter, &http.Cookie{
-		Name:   "BITOKEN",
-		Value:  common.GetMd5String(fmt.Sprintf("%s_%s_%d_%d_%d_%d_%d_%d_%s_%d_%s_%d", ctx.Sess.NickName, ctx.Sess.YyName, ctx.Sess.EntRole, ctx.Sess.EntNicheDis, ctx.Sess.PositionId, ctx.Sess.AccountId, ctx.Sess.EntAccountId, ctx.Sess.EntId, ctx.Sess.EntName, ctx.Sess.EntDeptId, ctx.Sess.EntUserName, ctx.Sess.EntUserId)),
-		Path:   "/",
-		Domain: ".jydev.jianyu360.com",
+		Name:     "BITOKEN",
+		Value:    common.GetMd5String(fmt.Sprintf("%s_%s_%d_%d_%d_%d_%d_%d_%s_%d_%s_%d", ctx.Sess.NickName, ctx.Sess.YyName, ctx.Sess.EntRole, ctx.Sess.EntNicheDis, ctx.Sess.PositionId, ctx.Sess.AccountId, ctx.Sess.EntAccountId, ctx.Sess.EntId, ctx.Sess.EntName, ctx.Sess.EntDeptId, ctx.Sess.EntUserName, ctx.Sess.EntUserId)),
+		Path:     "/",
+		HttpOnly: false,
+		MaxAge:   604800,
+		Expires:  time.Now().AddDate(0, 0, 7),
 	})
 	if ctx.Sess.NewUid != 0 {
 		replaceMap := map[string]interface{}{