From 275a68a82f9e90cb7e05aee7b5e59a45c77b89c2 Mon Sep 17 00:00:00 2001 From: KonBAI <1527468660@qq.com> Date: Mon, 5 Feb 2024 17:06:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=A7=A3=E5=86=B3jwt?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=AE=BE=E7=BD=AE=20keyt=20=E7=A7=98?= =?UTF-8?q?=E9=92=A5=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/dev33/satoken/jwt/SaJwtTemplate.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sa-token-plugin/sa-token-jwt/src/main/java/cn/dev33/satoken/jwt/SaJwtTemplate.java b/sa-token-plugin/sa-token-jwt/src/main/java/cn/dev33/satoken/jwt/SaJwtTemplate.java index f527ec86..a295a04b 100644 --- a/sa-token-plugin/sa-token-jwt/src/main/java/cn/dev33/satoken/jwt/SaJwtTemplate.java +++ b/sa-token-plugin/sa-token-jwt/src/main/java/cn/dev33/satoken/jwt/SaJwtTemplate.java @@ -141,7 +141,7 @@ public class SaJwtTemplate { * @return 根据 JWT 对象和 keyt 秘钥,生成的 token 字符串 */ public String generateToken (JWT jwt, String keyt) { - return jwt.setKey(keyt.getBytes()).setSigner(createSigner(keyt)).sign(); + return jwt.setSigner(createSigner(keyt)).sign(); } /** @@ -187,7 +187,7 @@ public class SaJwtTemplate { JSONObject payloads = jwt.getPayloads(); // 校验 Token 签名 - boolean verify = jwt.setKey(keyt.getBytes()).setSigner(createSigner(keyt)).verify(); + boolean verify = jwt.setSigner(createSigner(keyt)).verify(); if( ! verify) { throw new SaJwtException("jwt 签名无效:" + token).setCode(SaJwtErrorCode.CODE_30202); } @@ -284,7 +284,7 @@ public class SaJwtTemplate { JSONObject payloads = jwt.getPayloads(); // 如果签名无效 - boolean verify = jwt.setKey(keyt.getBytes()).verify(); + boolean verify = jwt.setSigner(createSigner(keyt)).verify(); if( ! verify) { return NOT_VALUE_EXPIRE; }