作者 tangxvhui

调整

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