mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix jwt bug
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.hutool.jwt;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.jwt.signers.JWTSignerUtil;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -73,4 +74,14 @@ public class JWTTest {
|
||||
|
||||
jwt.sign();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyTest(){
|
||||
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." +
|
||||
"eyJ1c2VyX25hbWUiOiJhZG1pbiIsInNjb3BlIjpbImFsbCJdLCJleHAiOjE2MjQwMDQ4MjIsInVzZXJJZCI6MSwiYXV0aG9yaXRpZXMiOlsiUk9MRV_op5LoibLkuozlj7ciLCJzeXNfbWVudV8xIiwiUk9MRV_op5LoibLkuIDlj7ciLCJzeXNfbWVudV8yIl0sImp0aSI6ImQ0YzVlYjgwLTA5ZTctNGU0ZC1hZTg3LTVkNGI5M2FhNmFiNiIsImNsaWVudF9pZCI6ImhhbmR5LXNob3AifQ." +
|
||||
"aixF1eKlAKS_k3ynFnStE7-IRGiD5YaqznvK2xEjBew";
|
||||
|
||||
final boolean verify = JWT.of(token).setKey(StrUtil.utf8Bytes("123456")).verify();
|
||||
Assert.assertTrue(verify);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user