From 5bae8504da38e1a16ce2e87af7c3b4cfe86ac552 Mon Sep 17 00:00:00 2001 From: click33 <2393584716@qq.com> Date: Tue, 16 May 2023 16:40:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20sa-token-temp-jwt=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=A0=81=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/dev33/satoken/temp/jwt/SaJwtUtil.java | 11 ++++------- .../java/cn/dev33/satoken/temp/jwt/SaTempForJwt.java | 9 +++------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaJwtUtil.java b/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaJwtUtil.java index 36e318d0..9bb66317 100644 --- a/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaJwtUtil.java +++ b/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaJwtUtil.java @@ -80,13 +80,10 @@ public class SaJwtUtil { * @return Claims对象 */ public static Claims parseToken(String jwtToken, String keyt) { - // 解析出载荷 - Claims claims = Jwts.parser() - .setSigningKey(keyt.getBytes()) - .parseClaimsJws(jwtToken).getBody(); - - // 返回 - return claims; + // 解析出载荷 + return Jwts.parser() + .setSigningKey(keyt.getBytes()) + .parseClaimsJws(jwtToken).getBody(); } /** diff --git a/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaTempForJwt.java b/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaTempForJwt.java index 1caaa982..e928ee92 100644 --- a/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaTempForJwt.java +++ b/sa-token-plugin/sa-token-temp-jwt/src/main/java/cn/dev33/satoken/temp/jwt/SaTempForJwt.java @@ -35,8 +35,7 @@ public class SaTempForJwt implements SaTempInterface { */ @Override public String createToken(String service, Object value, long timeout) { - String token = SaJwtUtil.createToken(service, value, timeout, getJwtSecretKey()); - return token; + return SaJwtUtil.createToken(service, value, timeout, getJwtSecretKey()); } /** @@ -44,8 +43,7 @@ public class SaTempForJwt implements SaTempInterface { */ @Override public Object parseToken(String service, String token) { - Object value = SaJwtUtil.getValue(service, token, getJwtSecretKey()); - return value; + return SaJwtUtil.getValue(service, token, getJwtSecretKey()); } /** @@ -53,8 +51,7 @@ public class SaTempForJwt implements SaTempInterface { */ @Override public long getTimeout(String service, String token) { - long timeout = SaJwtUtil.getTimeout(service, token, getJwtSecretKey()); - return timeout; + return SaJwtUtil.getTimeout(service, token, getJwtSecretKey()); } /**