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