From f732b290db793e92889dfb0484f737a5570824c9 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 15 Nov 2024 10:30:08 +0800 Subject: [PATCH] =?UTF-8?q?perf(X-Pack):=20CAS=E5=92=8COIDC=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E8=87=AA=E5=8A=A8=E5=8C=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/db/migration/V2.10.3__ddl.sql | 2 + .../core-frontend/src/config/axios/service.ts | 3 - core/core-frontend/src/utils/logout.ts | 19 +++-- .../views/data-visualization/PreviewHead.vue | 7 +- .../core-frontend/src/views/login/Platform.ts | 75 ------------------- de-xpack | 2 +- 6 files changed, 13 insertions(+), 95 deletions(-) delete mode 100644 core/core-frontend/src/views/login/Platform.ts diff --git a/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql b/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql index 3a6fc5527e..71f6a6168a 100644 --- a/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql +++ b/core/core-backend/src/main/resources/db/migration/V2.10.3__ddl.sql @@ -3,3 +3,5 @@ VALUES (1048232869488627719, 'basic.defaultSort', '1', 'text', 13); INSERT INTO `core_menu` VALUES (70, 0, 1, 'msg', NULL, 200, NULL, '/msg', 1, 1, 0); INSERT INTO `core_menu` VALUES (71, 70, 2, 'msg-fill', 'msg/fill', 1, 'icon_msg_fill', '/msg-fill', 0, 1, 0); + +UPDATE `xpack_setting_authentication` set `synced` = 0 where `name` = 'oidc' or name = 'cas'; \ No newline at end of file diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index c2c75363f9..008aa3397e 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -118,9 +118,6 @@ service.interceptors.request.use( const val = mapping[key] || key ;(config.headers as AxiosRequestHeaders)['Accept-Language'] = val } - ;(config.headers as AxiosRequestHeaders)['out_auth_platform'] = wsCache.get('out_auth_platform') - ? wsCache.get('out_auth_platform') - : 'default' if (config.method === 'get' && config.params) { let url = config.url as string diff --git a/core/core-frontend/src/utils/logout.ts b/core/core-frontend/src/utils/logout.ts index c0dc30ac12..e46be09873 100644 --- a/core/core-frontend/src/utils/logout.ts +++ b/core/core-frontend/src/utils/logout.ts @@ -24,21 +24,20 @@ export const logoutHandler = (justClean?: boolean) => { } let pathname = window.location.pathname if (pathname) { - if (pathname.includes('oidcbi/') || pathname.includes('casbi/')) { + if (pathname.includes('oidcbi/')) { pathname = pathname.replace('oidcbi/', '') + pathname = pathname.substring(0, pathname.length - 1) + window.location.href = pathname + '/oidcbi/oidc/logout' + return + } else if (pathname.includes('casbi/')) { pathname = pathname.replace('casbi/', '') + pathname = pathname.substring(0, pathname.length - 1) + const uri = window.location.href + window.location.href = pathname + '/casbi/cas/logout?service=' + uri + return } pathname = pathname.substring(0, pathname.length - 1) } - if (wsCache.get('out_auth_platform') === 'cas') { - const uri = window.location.href - window.location.href = pathname + '/casbi/cas/logout?service=' + uri - return - } - if (wsCache.get('out_auth_platform') === 'oidc') { - window.location.href = pathname + '/oidcbi/oidc/logout' - return - } if (wsCache.get('custom_auth_logout_url')) { window.location.href = wsCache.get('custom_auth_logout_url') } diff --git a/core/core-frontend/src/views/data-visualization/PreviewHead.vue b/core/core-frontend/src/views/data-visualization/PreviewHead.vue index 0e8304f0ab..39b1c76c3e 100644 --- a/core/core-frontend/src/views/data-visualization/PreviewHead.vue +++ b/core/core-frontend/src/views/data-visualization/PreviewHead.vue @@ -29,12 +29,7 @@ const embeddedStore = useEmbedded() const favorited = ref(false) const preview = () => { - const href = window.location.href - let baseUrl = isDataEaseBi.value ? embeddedStore.baseUrl : href.substring(0, href.indexOf('#')) - if (baseUrl.includes('oidcbi/') || baseUrl.includes('casbi/')) { - baseUrl = baseUrl.replace('oidcbi/', '') - baseUrl = baseUrl.replace('casbi/', '') - } + const baseUrl = isDataEaseBi.value ? embeddedStore.baseUrl : '' const url = baseUrl + '#/preview?dvId=' + dvInfo.value.id + '&ignoreParams=true' const newWindow = window.open(url, '_blank') initOpenHandler(newWindow) diff --git a/core/core-frontend/src/views/login/Platform.ts b/core/core-frontend/src/views/login/Platform.ts deleted file mode 100644 index f7dac8245d..0000000000 --- a/core/core-frontend/src/views/login/Platform.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { useCache } from '@/hooks/web/useCache' -import { platformLoginApi } from '@/api/login' -import { useUserStoreWithOut } from '@/store/modules/user' -import router from '@/router' -const { wsCache } = useCache() -const userStore = useUserStoreWithOut() - -export const toPlatformPage = val => { - const curOrigin = window.location.origin - const curLocation = getCurLocation() - if (val === 0) { - wsCache.set('out_auth_platform', 'default') - } else if (val === 1) { - wsCache.set('out_auth_platform', 'ldap') - // window.location.href = curOrigin + '/ldapbi/#' + curLocation - } else if (val === 2) { - wsCache.set('out_auth_platform', 'oidc') - window.location.href = curOrigin + '/oidcbi/#' + curLocation - } else if (val === 3) { - wsCache.set('out_auth_platform', 'cas') - window.location.href = curOrigin + '/casbi/#' + curLocation - } - return -} - -export const setLoginForm = state => { - const platform = wsCache.get('out_auth_platform') - state.loginForm.loginType = 0 - if (platform === 'default') { - state.loginForm.loginType = 0 - } - if (platform === 'ldap') { - state.loginForm.loginType = 1 - } - if (platform === 'oidc') { - state.loginForm.loginType = 2 - } - if (platform === 'cas') { - state.loginForm.loginType = 3 - } -} - -const platformLogin = origin => { - platformLoginApi(origin).then(res => { - const token = res.data - userStore.setToken(token) - const queryRedirectPath = getCurLocation() - router.push({ path: queryRedirectPath }) - }) -} - -export const callback = () => { - const pathname = window.location.pathname - let origin = 0 - if (pathname.startsWith('/casbi')) { - origin = 3 - } - if (pathname.startsWith('/oidcbi')) { - origin = 2 - } - if (pathname.startsWith('/ldapbi')) { - origin = 1 - } - if (origin) { - platformLogin(origin) - } -} - -const getCurLocation = () => { - let queryRedirectPath = '/workbranch/index' - if (router.currentRoute.value.query.redirect) { - queryRedirectPath = router.currentRoute.value.query.redirect as string - } - return queryRedirectPath -} diff --git a/de-xpack b/de-xpack index 5465e5d32d..cd39f4ce5c 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 5465e5d32d526fe9290258e453d6d93fd221283a +Subproject commit cd39f4ce5c213ccfc1f3847c8bdcfce7d78e673f