重构 sa-token-jwt 插件

This commit is contained in:
click33
2022-04-30 08:21:04 +08:00
parent 7f93c2086d
commit d45d404fa0
9 changed files with 24 additions and 34 deletions

View File

@@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<version>2.5.12</version>
<relativePath/>
</parent>
@@ -22,13 +22,12 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Http请求工具 -->
<dependency>
<groupId>com.ejlchina</groupId>
<artifactId>okhttps</artifactId>
<version>3.1.1</version>
<!-- Http 请求工具 -->
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.19</version>
</dependency>
</dependencies>

View File

@@ -1,14 +1,12 @@
package com.pj.sso;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.util.Map;
import java.util.Random;
import com.ejlchina.okhttps.OkHttps;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.dtflys.forest.Forest;
import com.pj.sso.util.AjaxJson;
/**
@@ -62,18 +60,9 @@ public class SsoRequestUtil {
* @param url 请求地址
* @return 返回的结果
*/
@SuppressWarnings("unchecked")
public static AjaxJson request(String url) {
String body = OkHttps.sync(url)
.post()
.getBody()
.toString();
try {
Map<String, Object> map = new ObjectMapper().readValue(body, Map.class);
return new AjaxJson(map);
} catch (IOException e) {
throw new RuntimeException(e);
}
Map<String, Object> map = Forest.post(url).executeAsMap();
return new AjaxJson(map);
}
/**