Blame view

src/components/jwt/jwt_test.go 304 Bytes
1b1ad555   zhangqijia   tls测试代码
1
  package jwt
ee23102d   zhangqijia   支持mongo, grpc接服务器
2
3
4
5
6
7
8
9
  
  import (
  	"fmt"
  	"pro2d/protos/pb"
  	"testing"
  )
  
  func TestCreateToken(t *testing.T) {
563acaf7   zhangqijia   在拦截器中认证jwt
10
  	account := &pb.Account{
ee23102d   zhangqijia   支持mongo, grpc接服务器
11
12
  		Phone:    "17683852936",
  		Password: "123456",
563acaf7   zhangqijia   在拦截器中认证jwt
13
  		Uid:      "12312",
ee23102d   zhangqijia   支持mongo, grpc接服务器
14
  	}
1b1ad555   zhangqijia   tls测试代码
15
  	token := CreateToken(account.Uid)
ee23102d   zhangqijia   支持mongo, grpc接服务器
16
17
18
  	ac := ParseToken(token)
  	fmt.Println("token: ", token, "\nac: ", ac)
  }