|
|
package domain
|
|
|
|
|
|
import "testing"
|
|
|
import (
|
|
|
"testing"
|
|
|
|
|
|
"github.com/dgrijalva/jwt-go"
|
|
|
)
|
|
|
|
|
|
func TestGenerateToken(t *testing.T) {
|
|
|
ut := UserAuth{
|
...
|
...
|
@@ -24,5 +28,9 @@ func TestParsetToken2(t *testing.T) { |
|
|
ut := UserAuth{}
|
|
|
str := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjM0MjYxMDAxMTcwOTM4ODgsImNvbXBhbnlJZCI6MSwiY29tcGFueU5hbWUiOiLnpo_lt57ntKDlpKnkuIvpo5_lk4HmnInpmZDlhazlj7giLCJwaG9uZSI6IjE1NjU5Mzc1OTQwIiwicGxhdGZvcm1JZCI6MjksIm5hbWUiOiLlurfkvJ_ljY4iLCJhZG1pblR5cGUiOjF9.BwJ2mLdTlFKF322y4GeqPOW6wKroIrPSI8eNyuQEMkQ`
|
|
|
tk, _ := ut.ParseAccessToken(str)
|
|
|
t.Logf("%+v", tk)
|
|
|
t.Logf("===》%+v", tk)
|
|
|
tk.StandardClaims = jwt.StandardClaims{}
|
|
|
tk.PlatformId = 29
|
|
|
tkStr, _ := tk.CreateAccessToken()
|
|
|
t.Logf(" ===》%v", tkStr)
|
|
|
} |
...
|
...
|
|