mirror of
https://github.com/chillzhuang/blade-tool
synced 2024-11-05 10:09:32 +08:00
🎉 2.0.3.RELEASE 兼容jdk11
This commit is contained in:
parent
367dbc103b
commit
2feebfdead
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -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的类
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-tool</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.3</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>blade-tool</name>
|
||||
<description>
|
||||
@ -36,7 +36,7 @@
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<blade.tool.version>2.0.2</blade.tool.version>
|
||||
<blade.tool.version>2.0.3</blade.tool.version>
|
||||
|
||||
<java.version>1.8</java.version>
|
||||
<maven.plugin.version>3.8.0</maven.plugin.version>
|
||||
|
Loading…
Reference in New Issue
Block a user