diff --git a/blade-core-boot/pom.xml b/blade-core-boot/pom.xml index 8da1cac..60cc857 100644 --- a/blade-core-boot/pom.xml +++ b/blade-core-boot/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-cloud/pom.xml b/blade-core-cloud/pom.xml index bb6ac01..858c0e0 100644 --- a/blade-core-cloud/pom.xml +++ b/blade-core-cloud/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-launch/pom.xml b/blade-core-launch/pom.xml index 5440d82..0e2d8d1 100644 --- a/blade-core-launch/pom.xml +++ b/blade-core-launch/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-log/pom.xml b/blade-core-log/pom.xml index 04e97b7..2741b98 100644 --- a/blade-core-log/pom.xml +++ b/blade-core-log/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-mybatis/pom.xml b/blade-core-mybatis/pom.xml index e0bc4d4..c8b7ed4 100644 --- a/blade-core-mybatis/pom.xml +++ b/blade-core-mybatis/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-secure/pom.xml b/blade-core-secure/pom.xml index 262dbea..400c6e2 100644 --- a/blade-core-secure/pom.xml +++ b/blade-core-secure/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java index dfbc381..0364f47 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java @@ -20,17 +20,15 @@ import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import org.springblade.core.secure.BladeUser; +import org.springblade.core.tool.utils.Charsets; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringPool; import org.springblade.core.tool.utils.WebUtil; import javax.crypto.spec.SecretKeySpec; import javax.servlet.http.HttpServletRequest; -import javax.xml.bind.DatatypeConverter; import java.security.Key; -import java.util.Calendar; -import java.util.Date; -import java.util.Map; +import java.util.*; /** * Secure工具类 @@ -48,7 +46,7 @@ public class SecureUtil { public final static String USER_NAME = "userName"; public final static String ROLE_NAME = "roleName"; public final static Integer AUTH_LENGTH = 7; - private static String BASE64_SECURITY = DatatypeConverter.printBase64Binary("SpringBlade".getBytes()); + private static String BASE64_SECURITY = Base64.getEncoder().encodeToString("SpringBlade".getBytes(Charsets.UTF_8)); /** * 获取用户信息 @@ -159,7 +157,7 @@ public class SecureUtil { * @return header */ public static String getHeader() { - return getHeader(WebUtil.getRequest()); + return getHeader(Objects.requireNonNull(WebUtil.getRequest())); } /** @@ -181,7 +179,7 @@ public class SecureUtil { public static Claims parseJWT(String jsonWebToken) { try { Claims claims = Jwts.parser() - .setSigningKey(DatatypeConverter.parseBase64Binary(BASE64_SECURITY)) + .setSigningKey(Base64.getDecoder().decode(BASE64_SECURITY)) .parseClaimsJws(jsonWebToken).getBody(); return claims; } catch (Exception ex) { @@ -205,7 +203,7 @@ public class SecureUtil { Date now = new Date(nowMillis); //生成签名密钥 - byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(BASE64_SECURITY); + byte[] apiKeySecretBytes = Base64.getDecoder().decode(BASE64_SECURITY); Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName()); //添加构成JWT的类 diff --git a/blade-core-swagger/pom.xml b/blade-core-swagger/pom.xml index 2eaa9aa..b8a153e 100644 --- a/blade-core-swagger/pom.xml +++ b/blade-core-swagger/pom.xml @@ -5,7 +5,7 @@ blade-tool org.springblade - 2.0.2 + 2.0.3 4.0.0 diff --git a/blade-core-tool/pom.xml b/blade-core-tool/pom.xml index 0eb02d8..b3d7909 100644 --- a/blade-core-tool/pom.xml +++ b/blade-core-tool/pom.xml @@ -6,7 +6,7 @@ org.springblade blade-tool - 2.0.2 + 2.0.3 4.0.0 diff --git a/pom.xml b/pom.xml index a7d5e9e..ac45bd9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springblade blade-tool - 2.0.2 + 2.0.3 pom blade-tool @@ -36,7 +36,7 @@ - 2.0.2 + 2.0.3 1.8 3.8.0