Skip to content

Commit 5c9b3da

Browse files
committed
fix: logout host
1 parent f5108f6 commit 5c9b3da

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

backend/api-gateway/src/main/java/com/datamate/gateway/infrastructure/client/impl/OmsServiceImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* OmsServiceImpl is a service that interacts with the OMS service.
24-
*
24+
*
2525
* @author songyongtan
2626
* @date 2026-03-16
2727
*/
@@ -66,7 +66,6 @@ public String getUserNameFromOms(String authToken, String csrfToken, String real
6666

6767
CloseableHttpResponse response = httpClient.execute(httpPost);
6868
String responseBody = EntityUtils.toString(response.getEntity());
69-
log.info("response code: {}", response.getCode());
7069

7170
try {
7271
JSONObject jsonObject = JSON.parseObject(responseBody);

frontend/src/pages/Layout/Header.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,20 @@ export function Header() {
8989

9090
const handleLogout = () => {
9191
if (authMode === 'SSO') {
92-
// SSO 模式:跳转到 OMS 登出
93-
window.location.href = `${OMS_LOGOUT_URL}?redirect=${encodeURIComponent(window.location.href)}`;
92+
// SSO 模式:检查是否配置了有效的登出 URL
93+
const logoutUrl = OMS_LOGOUT_URL;
94+
95+
// 如果配置的是默认值(内部 service 名称),只清除本地状态
96+
if (logoutUrl.includes('oms-service') || logoutUrl.includes('localhost')) {
97+
console.warn('OMS logout URL not configured or using internal address, skipping redirect');
98+
setCurrentUser(null);
99+
setAuthMode('NONE');
100+
message.success(t('user.messages.logoutSuccess'));
101+
window.location.reload();
102+
} else {
103+
// 使用配置的登出 URL
104+
window.location.href = `${logoutUrl}?redirect=${encodeURIComponent(window.location.href)}`;
105+
}
94106
} else {
95107
// JWT 模式:清除本地 session
96108
localStorage.removeItem('session');

0 commit comments

Comments
 (0)