mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix comment and test
This commit is contained in:
parent
59275491de
commit
081a51ff83
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
# 5.7.2 (2021-06-19)
|
# 5.7.2 (2021-06-20)
|
||||||
|
|
||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
* 【core 】 增加UserPassAuthenticator
|
* 【core 】 增加UserPassAuthenticator
|
||||||
@ -12,13 +12,14 @@
|
|||||||
* 【core 】 增加TreeBuilder
|
* 【core 】 增加TreeBuilder
|
||||||
* 【core 】 IterUtil增加getFirstNonNull方法
|
* 【core 】 IterUtil增加getFirstNonNull方法
|
||||||
* 【core 】 NumberUtil判空改为isBlank(issue#1664@Github)
|
* 【core 】 NumberUtil判空改为isBlank(issue#1664@Github)
|
||||||
|
* 【jwt 】 增加JWTValidator、RegisteredPayload
|
||||||
|
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【db 】 修复Oracle下别名错误造成的SQL语法啊错误(issue#I3VTQW@Gitee)
|
* 【db 】 修复Oracle下别名错误造成的SQL语法啊错误(issue#I3VTQW@Gitee)
|
||||||
* 【core 】 修复ConcurrencyTester重复使用时开始测试未清空之前任务的问题(issue#I3VSDO@Gitee)
|
* 【core 】 修复ConcurrencyTester重复使用时开始测试未清空之前任务的问题(issue#I3VSDO@Gitee)
|
||||||
* 【poi 】 修复使用BigWriter写出,ExcelWriter修改单元格值失败的问题(issue#I3VSDO@Gitee)
|
* 【poi 】 修复使用BigWriter写出,ExcelWriter修改单元格值失败的问题(issue#I3VSDO@Gitee)
|
||||||
* 【jwt 】 修复Hmac算法下生成签名是hex的问题(issue#I3W6IP@Gitee)
|
* 【jwt 】 修复Hmac算法下生成签名是hex的问题(issue#I3W6IP@Gitee)
|
||||||
* 【jwt 】 修复TreeUtil.build中deep失效问题(issue#1661@Github)
|
* 【core 】 修复TreeUtil.build中deep失效问题(issue#1661@Github)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -587,6 +587,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
|||||||
* @param <T> 数组元素类型
|
* @param <T> 数组元素类型
|
||||||
* @param array 数组
|
* @param array 数组
|
||||||
* @param editor 编辑器接口,{@code null}返回原集合
|
* @param editor 编辑器接口,{@code null}返回原集合
|
||||||
|
* @return 编辑后的数组
|
||||||
* @since 5.3.3
|
* @since 5.3.3
|
||||||
*/
|
*/
|
||||||
public static <T> T[] edit(T[] array, Editor<T> editor) {
|
public static <T> T[] edit(T[] array, Editor<T> editor) {
|
||||||
|
@ -145,6 +145,7 @@ public class HMac implements Serializable {
|
|||||||
*
|
*
|
||||||
* @param data 被摘要数据
|
* @param data 被摘要数据
|
||||||
* @param charset 编码
|
* @param charset 编码
|
||||||
|
* @param isUrlSafe 是否使用URL安全字符
|
||||||
* @return 摘要
|
* @return 摘要
|
||||||
*/
|
*/
|
||||||
public String digestBase64(String data, Charset charset, boolean isUrlSafe) {
|
public String digestBase64(String data, Charset charset, boolean isUrlSafe) {
|
||||||
|
@ -18,10 +18,10 @@ public class JWTTest {
|
|||||||
|
|
||||||
String rightToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." +
|
String rightToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." +
|
||||||
"eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJsb29seSJ9." +
|
"eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJsb29seSJ9." +
|
||||||
"536690902d931d857d2f47d337ec81048ee09a8e71866bcc8404edbbcbf4cc40";
|
"U2aQkC2THYV9L0fTN-yBBI7gmo5xhmvMhATtu8v0zEA";
|
||||||
|
|
||||||
String token = jwt.sign();
|
String token = jwt.sign();
|
||||||
Assert.assertEquals(token, token);
|
Assert.assertEquals(token, rightToken);
|
||||||
|
|
||||||
Assert.assertTrue(JWT.of(rightToken).setKey(key).verify());
|
Assert.assertTrue(JWT.of(rightToken).setKey(key).verify());
|
||||||
}
|
}
|
||||||
@ -30,10 +30,12 @@ public class JWTTest {
|
|||||||
public void parseTest(){
|
public void parseTest(){
|
||||||
String rightToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." +
|
String rightToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." +
|
||||||
"eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJsb29seSJ9." +
|
"eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJsb29seSJ9." +
|
||||||
"536690902d931d857d2f47d337ec81048ee09a8e71866bcc8404edbbcbf4cc40";
|
"U2aQkC2THYV9L0fTN-yBBI7gmo5xhmvMhATtu8v0zEA";
|
||||||
|
|
||||||
final JWT jwt = JWT.of(rightToken);
|
final JWT jwt = JWT.of(rightToken);
|
||||||
|
|
||||||
|
Assert.assertTrue(jwt.setKey("1234567890".getBytes()).verify());
|
||||||
|
|
||||||
//header
|
//header
|
||||||
Assert.assertEquals("JWT", jwt.getHeader(JWTHeader.TYPE));
|
Assert.assertEquals("JWT", jwt.getHeader(JWTHeader.TYPE));
|
||||||
Assert.assertEquals("HS256", jwt.getHeader(JWTHeader.ALGORITHM));
|
Assert.assertEquals("HS256", jwt.getHeader(JWTHeader.ALGORITHM));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user