fix
This commit is contained in:
parent
efd0f28d51
commit
f7a20f3670
|
@ -3,7 +3,7 @@ package auth
|
|||
import (
|
||||
"encoding/json"
|
||||
"github.com/golang-jwt/jwt"
|
||||
"log"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
@ -58,13 +58,13 @@ func CheckAuth(r *http.Request) UserInfo {
|
|||
token = r.Header.Get("Auth-Key")
|
||||
}
|
||||
if token == "" {
|
||||
log.Println("token is empty")
|
||||
logx.Debug("token is empty")
|
||||
return UserInfo{}
|
||||
}
|
||||
//解析token
|
||||
userInfo, err := ParseJwtToken(token)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
logx.Debug(err)
|
||||
return UserInfo{}
|
||||
}
|
||||
return userInfo
|
||||
|
|
Loading…
Reference in New Issue
Block a user