作者 tangxvhui

调整

... ... @@ -8,7 +8,7 @@ import (
)
type UserAuth struct {
jwt.StandardClaims `json:"-"`
jwt.StandardClaims
UserId int64 `json:"userId"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
... ...
... ... @@ -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)
... ...