mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 01:25:28 +08:00
支持单点登录
This commit is contained in:
parent
f0151d6521
commit
61b76803f9
@ -1,13 +1,52 @@
|
|||||||
package org.dromara.gateway.config;
|
package org.dromara.gateway.config;
|
||||||
|
|
||||||
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
|
import cn.dev33.satoken.jwt.StpLogicJwtForSimple;
|
||||||
|
import cn.dev33.satoken.sso.config.SaSsoClientConfig;
|
||||||
import cn.dev33.satoken.stp.StpLogic;
|
import cn.dev33.satoken.stp.StpLogic;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SaTokenConfigure {
|
public class SaTokenConfigure {
|
||||||
// Sa-Token 整合 jwt (Simple 简单模式)
|
|
||||||
|
private final RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private void configSsoClient(SaSsoClientConfig ssoClientConfig) {
|
||||||
|
ssoClientConfig.sendHttp = url -> {
|
||||||
|
try {
|
||||||
|
log.info("SSO-Client端:发起请求:{}", url);
|
||||||
|
// String resStr = Forest.get(url).executeAsString();
|
||||||
|
String resStr = restTemplate.getForObject(url, String.class);
|
||||||
|
log.info("SSO-Client端:请求结果:{}", resStr);
|
||||||
|
return resStr;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("SSO-Client端:发送Http请求异常", e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private void configSsoServer(SaSsoServerConfig ssoServerConfig) {
|
||||||
|
// ssoServerConfig.sendHttp = url -> {
|
||||||
|
// try {
|
||||||
|
// log.info("SSO-Server端:发起请求:{}", url);
|
||||||
|
|
||||||
|
/// / String resStr = Forest.get(url).executeAsString();
|
||||||
|
// String resStr = restTemplate.getForObject(url,String.class);
|
||||||
|
// log.info("SSO-Server端:请求结果:{}", resStr);
|
||||||
|
// return resStr;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("SSO-Server端:发送Http请求异常", e);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// }
|
||||||
@Bean
|
@Bean
|
||||||
public StpLogic getStpLogicJwt() {
|
public StpLogic getStpLogicJwt() {
|
||||||
return new StpLogicJwtForSimple();
|
return new StpLogicJwtForSimple();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user