作者 tangxvhui

调整

... ... @@ -8,14 +8,14 @@ import (
)
type UserAuth struct {
jwt.StandardClaims `json:"-"`
UserId int64 `json:"userId"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
Phone string `json:"phone"`
PlatformId int `json:"platformId"`
Name string `json:"name"`
AdminType int `json:"adminType"`
jwt.StandardClaims
UserId int64 `json:"userId"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
Phone string `json:"phone"`
PlatformId int `json:"platformId"`
Name string `json:"name"`
AdminType int `json:"adminType"`
}
var issuer = "performance"
... ...
... ... @@ -7,7 +7,6 @@ import (
)
func TestGenerateToken(t *testing.T) {
JWTExpiresSecond = 2
ut := UserAuth{
CompanyId: 8,
UserId: 3422185340122624,
... ... @@ -21,7 +20,7 @@ func TestGenerateToken(t *testing.T) {
func TestParsetToken1(t *testing.T) {
ut := UserAuth{}
str := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODM2OTY4NjIsImlzcyI6InBlcmZvcm1hbmNlIiwidXNlcklkIjozNDIyMTg1MzQwMTIyNjI0LCJjb21wYW55SWQiOjgsImNvbXBhbnlOYW1lIjoiIiwicGhvbmUiOiIxMzA2NjY2NzcxMCIsInBsYXRmb3JtSWQiOjI5LCJuYW1lIjoiIiwiYWRtaW5UeXBlIjoxfQ.M_0HuXFGfZWdVFivDMsnuEaVtzHA6TOYeR3XAjr4lWo`
str := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODM3ODMzNTIsImlzcyI6InBlcmZvcm1hbmNlIiwidXNlcklkIjozNDIyMTg1MzQwMTIyNjI0LCJjb21wYW55SWQiOjgsImNvbXBhbnlOYW1lIjoiIiwicGhvbmUiOiIxMzA2NjY2NzcxMCIsInBsYXRmb3JtSWQiOjI5LCJuYW1lIjoiIiwiYWRtaW5UeXBlIjoxfQ.aeIeCSZ3xARmz0NBPqYATFQPhnEHfQyC_Ny219urFGk`
tk, err := ut.ParseAccessToken(str)
t.Logf("err:%s", err)
t.Logf("%+v", tk)
... ...