login_token_test.go
612 字节
package domain
import "testing"
func TestTokenParse(t *testing.T) {
tk := LoginToken{}
str := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Mjk4NzY3OTcsImlhdCI6MTYyOTg2OTU5NywiaXNzIjoiYWxsaWVkX2NyZWF0aW9uX2dhdGV3YXkiLCJuYmYiOjE2Mjk4Njk1OTcsInVzZXJJZCI6MSwidXNlckJhc2VJZCI6MSwiYWNjb3VudCI6IjE4ODYwMTgzMDUwIiwicGxhdGZvcm0iOiJhcHAiLCJjb21wYW55SWQiOjEsIm9yZ0lkIjoxLCJvcmdJZHMiOlsxLDU2XSwic2Vzc2lvbk1vZGUiOjF9.aDxfLwOpZCYWRhKa4GeKRh8sXsy2WOyt4X92uEEEXKg"
err := tk.ParseToken(str)
if err != nil {
t.Error(err)
}
t.Log("tk.Account=", tk.Account, " tk.CompanyId=", tk.CompanyId, " tk.OrgId=", tk.OrgId)
}