gin-jwt 又更新了 renew again
1、Authenticator
old:Authenticator: func(userId string, password string, c *gin.Context)
New:
============================
``
type login struct {
Username string `form:"username" json:"username" binding:"required"`
Password string `form:"password" json:"password" binding:"required"`
}
Authenticator: func(c *gin.Context) (interface{}, error) {
var loginVals login
if err := c.ShouldBind(&loginVals); err != nil {
return "", jwt.ErrMissingLoginValues
}
userID := loginVals.Username
password := loginVals.Password
``
2、authMiddleware
old:
authMiddleware := jwt.GinJWTMiddleware{
New:
authMiddleware, err := jwt.New(&jwt.GinJWTMiddleware{