Skip to content

Commit

Permalink
fix(jwt): exp field
Browse files Browse the repository at this point in the history
修复没有exp字段时插件的报错

Fix #15
  • Loading branch information
swpfY committed Nov 24, 2023
1 parent d7ff969 commit eef1c3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (p *Preprocess) parseJWT(req *http.Request) {
}
// 3. 验证jwt凭证是否过期
var v map[string]interface{}
if err = json.Unmarshal(payload, &v); err != nil {
if err = json.Unmarshal(payload, &v); err != nil || v["exp"] == nil {
return
}
exp := int64(math.Floor(v["exp"].(float64)))
Expand Down

0 comments on commit eef1c3f

Please sign in to comment.