Ver Fonte

app,调整蚁群APP跳转锅炉管道的认证逻辑

yangguanjin há 1 semana atrás
pai
commit
3bee23e1ac

+ 7 - 10
tz-module-system/tz-module-system-biz/src/main/java/cn/start/tz/module/system/service/auth/AdminAuthServiceImpl.java

@@ -55,10 +55,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
@@ -389,7 +386,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
         HttpEntity<Void> req = genYiQunAuthHttpEntity(reqVO);
         String appAuthPath = "/external-api/system/auth/app-auth";
         // 使用 token 交换用户信息
-        ResponseEntity<String> yiqunResp = restTemplate.postForEntity(baseUrl + appAuthPath, req, String.class);
+        ResponseEntity<String> yiqunResp = restTemplate.exchange(baseUrl + appAuthPath, HttpMethod.GET, req, String.class);
         AuthYiqunUserDTO user = null;
         if (!yiqunResp.getStatusCode().equals(HttpStatus.OK)) {
             log.warn("[authenticate] APPToken 无效");
@@ -418,11 +415,11 @@ public class AdminAuthServiceImpl implements AdminAuthService {
             throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
         }
 
-        if (Objects.equals(reqVO.getMode(), "WEB")) {
-            if (!Objects.equals(reqVO.getPassword(), "bowin123")) {
-                throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
-            }
-        }
+//        if (Objects.equals(reqVO.getMode(), "WEB")) {
+//            if (!Objects.equals(reqVO.getPassword(), "bowin123")) {
+//                throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
+//            }
+//        }
 
         String username = reqVO.getUsername();
         AdminUserDO existedUser = userService.getUserByUsername(username);