Skip to content

Commit

Permalink
Update MD5 签名验证
Browse files Browse the repository at this point in the history
  • Loading branch information
xinliangnote committed Oct 8, 2019
1 parent 81355d4 commit 9eec003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions app/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ const (
AppName = "go-gin-api"

// MD5 密钥
AppSignSecret = "4OhYXtDYNYxQsGetqASVOTP37jGt5gGY"

// MD5 签名超时时间 120s
AppSignExpiry = "120"
AppMD5SignSecret = "4OhYXtDYNYxQsGetqASVOTP37jGt5gGY"

// MD5 超时时间
AppMD5SignExpiry = "120"

// 超时时间
AppReadTimeout = 120
Expand All @@ -34,7 +33,7 @@ const (
ErrorNotifyOpen = -1

// Jaeger 配置信息
JaegerHostPort = "127.0.0.1:6831"
JaegerHostPort = "127.0.0.1:6831"

// Jaeger 配置开关 1=开通 -1=关闭
JaegerOpen = 1
Expand Down
4 changes: 2 additions & 2 deletions app/route/middleware/sign/md5/md5.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func createMD5Sign(params url.Values) string {
}

// 自定义签名算法
sign := util.MD5(config.AppSignSecret + str + config.AppSignSecret)
sign := util.MD5(config.AppMD5SignSecret + str + config.AppMD5SignSecret)
return sign
}

Expand Down Expand Up @@ -92,7 +92,7 @@ func verifyMD5Sign(c *gin.Context) (map[string]string, error) {
return res, nil
}

exp, _ := strconv.ParseInt(config.AppSignExpiry, 10, 64)
exp, _ := strconv.ParseInt(config.AppMD5SignExpiry, 10, 64)

// 验证过期时间
timestamp := time.Now().Unix()
Expand Down

0 comments on commit 9eec003

Please sign in to comment.