mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
923da89622
commit
aae154461e
@ -3,7 +3,7 @@
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
# 6.0.0.M1 (2022-07-17)
|
||||
# 6.0.0.M1 (2022-08-27)
|
||||
|
||||
### 计划实现
|
||||
* 【poi 】 PDF相关(基于PdfBox)
|
||||
@ -11,6 +11,7 @@
|
||||
* 【poi 】 Markdown相关(如HTML转换等),基于commonmark-java
|
||||
* 【db 】 增加DDL封装
|
||||
* 【json 】 实现自定义的类型转换,不影响全局的转换器
|
||||
* 【core 】 Functional接口重新定义
|
||||
|
||||
### ❌不兼容特性
|
||||
|
||||
|
@ -88,10 +88,12 @@ public class JWT implements RegisteredPayload<JWT> {
|
||||
/**
|
||||
* 解析JWT内容
|
||||
*
|
||||
* @param token JWT Token字符串,格式为xxxx.yyyy.zzzz
|
||||
* @param token JWT Token字符串,格式为xxxx.yyyy.zzzz,不能为空
|
||||
* @return this
|
||||
* @throws IllegalArgumentException 给定字符串为空
|
||||
*/
|
||||
public JWT parse(final String token) {
|
||||
public JWT parse(final String token) throws IllegalArgumentException {
|
||||
Assert.notBlank(token, "Token String must be not blank!");
|
||||
final List<String> tokens = splitToken(token);
|
||||
this.tokens = tokens;
|
||||
this.header.parse(tokens.get(0), this.charset);
|
||||
@ -269,7 +271,7 @@ public class JWT implements RegisteredPayload<JWT> {
|
||||
/**
|
||||
* 获取payload并获取类型
|
||||
*
|
||||
* @param <T> Bean类型
|
||||
* @param <T> Bean类型
|
||||
* @param propertyName 需要提取的属性名称
|
||||
* @param propertyType 需要提取的属性类型
|
||||
* @return 载荷信息
|
||||
|
@ -43,6 +43,24 @@ public class JWTUtilTest {
|
||||
Assert.assertEquals(true, jwt.getPayload("admin"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void parseNullTest(){
|
||||
// https://gitee.com/dromara/hutool/issues/I5OCQB
|
||||
JWTUtil.parseToken(null);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void parseEmptyTest(){
|
||||
// https://gitee.com/dromara/hutool/issues/I5OCQB
|
||||
JWTUtil.parseToken("");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void parseBlankTest(){
|
||||
// https://gitee.com/dromara/hutool/issues/I5OCQB
|
||||
JWTUtil.parseToken(" ");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyTest(){
|
||||
final String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9." +
|
||||
|
Loading…
x
Reference in New Issue
Block a user