Browse Source

Base64改为Hutool的,指定Lombok版本

master
lzh 3 years ago
parent
commit
06887bb405
  1. 3
      anrui-portal/anrui-portal-api/pom.xml
  2. 6
      anrui-portal/anrui-portal-biz/pom.xml
  3. 4
      anrui-portal/anrui-portal-biz/src/test/java/com/yxt/anrui/portal/test/controller/TestController.java

3
anrui-portal/anrui-portal-api/pom.xml

@ -32,9 +32,12 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>

6
anrui-portal/anrui-portal-biz/pom.xml

@ -84,6 +84,12 @@
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>

4
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;

Loading…
Cancel
Save