之前的token验证借助了redis,如果用jwt就不需要了
中间件
cat middlewares/jwt.go
package middlewares
import (
"enterprise-api/app/models"
"enterprise-api/core"
"github.com/gin-gonic/gin"
)
func JWTAuth(role string) gin.HandlerFunc {
return func(c *gin.Context) {
signToken := c.Request.Header.Get("Authorization")
...