修改单点登录
This commit is contained in:
@@ -178,7 +178,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/login/**","/logout", "/health", "/user/loginCode/**").permitAll()
|
||||
.antMatchers("/login/**","/logout","/outlogcas", "/health", "/user/loginCode/**").permitAll()
|
||||
.mvcMatchers(HttpMethod.GET,"/dict/item/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
||||
@@ -106,6 +106,14 @@
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
package top.lidee.taie.http;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import top.lidee.taie.http.ssl.SslSocketClient;
|
||||
import okhttp3.*;
|
||||
|
||||
@@ -135,4 +141,40 @@ public class HttpClientUtils {
|
||||
Request request = new Request.Builder().url(url).headers(headers).delete().build();
|
||||
httpClient.newCall(request).enqueue(callback);
|
||||
}
|
||||
|
||||
|
||||
public static String getPost(String url,String Token)
|
||||
{
|
||||
|
||||
try {
|
||||
// 创建HttpClient实例
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
// 创建POST请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
// 设置请求体
|
||||
StringEntity params = new StringEntity("refreshToken="+Token);
|
||||
httpPost.setEntity(params);
|
||||
|
||||
httpPost.setHeader("Authorization",Token);
|
||||
|
||||
// 发送请求并获取响应
|
||||
CloseableHttpResponse response = httpClient.execute(httpPost);
|
||||
try {
|
||||
// 获取响应状态码
|
||||
System.out.println(response.getStatusLine().getStatusCode());
|
||||
// 获取响应体内容
|
||||
String result = EntityUtils.toString(response.getEntity());
|
||||
System.out.println(result);
|
||||
return result;
|
||||
} finally {
|
||||
response.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.14</version>
|
||||
<!--<version>2.3.5.RELEASE</version>-->
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<groupId>top.lidee.taie</groupId>
|
||||
<artifactId>lidee-common</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user