Browse Source

登录时调用的SSO接口由读取数据库配置改成读取配置文件

丁治程 7 months ago
parent
commit
758fa6001c

+ 23 - 5
jeecg-module-interlock/src/main/java/org/jeecg/modules/ssoClient/controller/SSOLoginLogoutController.java

@@ -44,6 +44,7 @@ import org.jeecg.modules.system.service.*;
 import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.client.RestTemplate;
@@ -104,6 +105,17 @@ public class SSOLoginLogoutController {
     private RestClientService restClientService;
 
 
+
+    @Value("${sso.ip}")
+    private String ssoIp;
+    @Value("${sso.port}")
+    private String ssoPort;
+    @Value("${sso.username}")
+    private String ssoUsername;
+    @Value("${sso.password}")
+    private String ssoPassword;
+
+
     /**
      * sso校验token
      * */
@@ -141,7 +153,8 @@ public class SSOLoginLogoutController {
 
     public Result<JSONObject> ssoTokenValidation(String eiToken) {
         //        String url = "http://192.168.2.248:8188/v4.0/tokenvalidation;
-        String url = configService.getConfigValue(ConfigInfo.SSO_TOKENVALIDATION);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_TOKENVALIDATION);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/tokenvalidation";
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("token",eiToken);
@@ -690,7 +703,8 @@ public class SSOLoginLogoutController {
      */
     public  String ssodlcs(String username, String password){
         // String url = "http://192.168.2.248:8188/v4.0/auth/native";
-        String url = configService.getConfigValue(ConfigInfo.SSO_LOGIN_URL);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_LOGIN_URL);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/auth/native";
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("username",username);
@@ -746,7 +760,8 @@ public class SSOLoginLogoutController {
         JSONObject ssoUserInfo = new JSONObject();
         ssoUserInfo.put("ssoRole", "");
         ssoUserInfo.put("username", "");
-        String url = configService.getConfigValue(ConfigInfo.SSO_GETSSORLOE);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_GETSSORLOE);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/users/me";
         // 设置请求头部
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.APPLICATION_JSON);
@@ -794,7 +809,9 @@ public class SSOLoginLogoutController {
      */
     public  String getSSORole(String eiToken){
          //String url = "http://192.168.2.248:8188/v4.0/users/me";
-        String url = configService.getConfigValue(ConfigInfo.SSO_GETSSORLOE);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_GETSSORLOE);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/users/me";
+
         // 设置请求头部
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.APPLICATION_JSON);
@@ -1024,7 +1041,8 @@ public class SSOLoginLogoutController {
     /**IoTedge sso登出*/
     public String IoTedgessolgout(HttpServletResponse response1){
         //String url = "http://192.168.2.248:8188/v4.0/auth/native";
-        String url = configService.getConfigValue(ConfigInfo.SSO_LOGOUT_URL);
+        //String url = configService.getConfigValue(ConfigInfo.SSO_LOGOUT_URL);
+        String url = "http://"+ssoIp+":"+ssoPort+"/v4.0/auth/native";
 
         // 设置请求头部
         HttpHeaders headers = new HttpHeaders();