From 06887bb4050b6e7c29c6e4c77b2617c3ad70af5c Mon Sep 17 00:00:00 2001 From: lzh Date: Tue, 27 Sep 2022 15:49:18 +0800 Subject: [PATCH] =?UTF-8?q?Base64=E6=94=B9=E4=B8=BAHutool=E7=9A=84,?= =?UTF-8?q?=E6=8C=87=E5=AE=9ALombok=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- anrui-portal/anrui-portal-api/pom.xml | 3 +++ anrui-portal/anrui-portal-biz/pom.xml | 6 ++++++ .../yxt/anrui/portal/test/controller/TestController.java | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/anrui-portal/anrui-portal-api/pom.xml b/anrui-portal/anrui-portal-api/pom.xml index 5805a9043d..79caffa5b9 100644 --- a/anrui-portal/anrui-portal-api/pom.xml +++ b/anrui-portal/anrui-portal-api/pom.xml @@ -32,9 +32,12 @@ org.springframework.cloud spring-cloud-starter-openfeign + org.projectlombok lombok + 1.18.24 + true com.baomidou diff --git a/anrui-portal/anrui-portal-biz/pom.xml b/anrui-portal/anrui-portal-biz/pom.xml index e7539e40a3..43f5afdc20 100644 --- a/anrui-portal/anrui-portal-biz/pom.xml +++ b/anrui-portal/anrui-portal-biz/pom.xml @@ -84,6 +84,12 @@ 0.0.1 compile + + org.projectlombok + lombok + 1.18.24 + true + diff --git a/anrui-portal/anrui-portal-biz/src/test/java/com/yxt/anrui/portal/test/controller/TestController.java b/anrui-portal/anrui-portal-biz/src/test/java/com/yxt/anrui/portal/test/controller/TestController.java index 204df0540a..ecc5e9292a 100644 --- a/anrui-portal/anrui-portal-biz/src/test/java/com/yxt/anrui/portal/test/controller/TestController.java +++ b/anrui-portal/anrui-portal-biz/src/test/java/com/yxt/anrui/portal/test/controller/TestController.java @@ -1,5 +1,6 @@ package com.yxt.anrui.portal.test.controller; +import cn.hutool.core.codec.Base64; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.annotation.JSONField; @@ -14,7 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import sun.misc.BASE64Encoder; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; @@ -218,7 +218,7 @@ public class TestController { Key sKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), mac.getAlgorithm()); mac.init(sKey); byte[] hash = mac.doFinal(signStr.getBytes("UTF-8")); - String sig = new BASE64Encoder().encode(hash); + String sig = Base64.encode(hash); String auth = "hmac id=\"" + secretId + "\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"" + sig + "\""; return auth;