From ee323058161ea4ab7a556590529b1fbbc8fb92e7 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 26 Oct 2022 19:24:19 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix(=E7=99=BB=E5=87=BA):=20oidc=E5=AE=95?= =?UTF-8?q?=E6=9C=BA=E5=90=8E=E6=97=A0=E6=B3=95=E9=80=80=E5=87=BA=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/auth/server/AuthServer.java | 25 +++++++++++++------ frontend/src/api/user.js | 6 +++-- frontend/src/lang/en.js | 4 +++ frontend/src/lang/tw.js | 4 +++ frontend/src/lang/zh.js | 4 +++ frontend/src/store/modules/user.js | 23 +++++++++++++++++ 6 files changed, 57 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/server/AuthServer.java b/backend/src/main/java/io/dataease/auth/server/AuthServer.java index ac43dc69ce..e86731d06f 100644 --- a/backend/src/main/java/io/dataease/auth/server/AuthServer.java +++ b/backend/src/main/java/io/dataease/auth/server/AuthServer.java @@ -12,6 +12,7 @@ import io.dataease.auth.service.AuthUserService; import io.dataease.auth.util.JWTUtils; import io.dataease.auth.util.RsaUtil; import io.dataease.commons.constants.SysLogConstants; +import io.dataease.commons.exception.DEException; import io.dataease.commons.utils.*; import io.dataease.controller.sys.request.LdapAddRequest; import io.dataease.exception.DataEaseException; @@ -240,8 +241,13 @@ public class AuthServer implements AuthApi { HttpServletRequest request = ServletUtils.request(); String idToken = request.getHeader("IdToken"); if (StringUtils.isNotBlank(idToken)) { - OidcXpackService oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class); - oidcXpackService.logout(idToken); + try { + OidcXpackService oidcXpackService = SpringContextUtil.getBean(OidcXpackService.class); + oidcXpackService.logout(idToken); + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + DEException.throwException("oidc_logout_error"); + } } } @@ -253,11 +259,16 @@ public class AuthServer implements AuthApi { String result = null; Integer defaultLoginType = systemParameterService.defaultLoginType(); if (defaultLoginType == 3 && isOpenCas()) { - HttpServletRequest request = ServletUtils.request(); - HttpSession session = request.getSession(); - session.invalidate(); - CasXpackService casXpackService = SpringContextUtil.getBean(CasXpackService.class); - result = casXpackService.logout(); + try { + HttpServletRequest request = ServletUtils.request(); + HttpSession session = request.getSession(); + session.invalidate(); + CasXpackService casXpackService = SpringContextUtil.getBean(CasXpackService.class); + result = casXpackService.logout(); + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + DEException.throwException("cas_logout_error"); + } } try { Long userId = JWTUtils.tokenInfoByToken(token).getUserId(); diff --git a/frontend/src/api/user.js b/frontend/src/api/user.js index 32d2067307..f7b0df9167 100644 --- a/frontend/src/api/user.js +++ b/frontend/src/api/user.js @@ -18,14 +18,16 @@ export function getInfo(token) { export function logout() { return request({ url: '/api/auth/logout', - method: 'post' + method: 'post', + hideMsg: true }) } export function deLogout() { return request({ url: '/api/auth/deLogout', - method: 'post' + method: 'post', + hideMsg: true }) } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 9b9d4d14b0..2b396f403a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -2626,5 +2626,9 @@ export default { apply_logs: 'Apply logs', app_group_delete_tips: 'Are you sure to delete this application category?', app_group_delete_content: 'After deletion, all application templates in this category will also be deleted.' + }, + logout: { + oidc_logout_error: 'OIDC failed to exit, do you continue to exit DataEase?', + cas_logout_error: 'CAS服务异常,请联系管理员!' } } diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index ad78066c42..3e41d495c2 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -2627,5 +2627,9 @@ export default { apply_logs: '應用記錄', app_group_delete_tips: '確定刪除該應用分類嗎?', app_group_delete_content: '刪除後,該分類中所有的應用模闆也將被刪除。' + }, + logout: { + oidc_logout_error: 'OIDC退出失敗,是否繼續退出DataEase?', + cas_logout_error: 'CAS服務異常,請聯系管理員!' } } diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 009725ad24..86e6efae90 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2627,5 +2627,9 @@ export default { apply_logs: '应用记录', app_group_delete_tips: '确定删除该应用分类吗?', app_group_delete_content: '删除后,该分类中所有的应用模板也将被删除。' + }, + logout: { + oidc_logout_error: 'OIDC退出失败,是否继续退出DataEase?', + cas_logout_error: 'The CAS service is abnormal, please contact the administrator!' } } diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index a14a2db029..5d8795d358 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -6,6 +6,7 @@ import { getLanguage } from '@/lang/index' import Cookies from 'js-cookie' import router from '@/router' import i18n from '@/lang' +import { $alert, $confirm } from '@/utils/message' const getDefaultState = () => { return { token: getToken(), @@ -146,6 +147,28 @@ const actions = { resolve(res.data) }).catch(error => { reject(error) + if (error?.response?.data?.message) { + if (error.response.data.message === ('oidc_logout_error')) { + const message = i18n.t('logout.' + error.response.data.message) + $confirm(message, () => { + removeToken() // must remove token first + resetRouter() + commit('RESET_STATE') + window.location.href = '/' + }, { + confirmButtonText: i18n.t('commons.confirm') + }) + } + if (error.response.data.message === ('cas_logout_error')) { + const message = i18n.t('logout.' + error.response.data.message) + $alert(message, () => { + + }, { + confirmButtonText: i18n.t('commons.confirm'), + showClose: false + }) + } + } }) }) }, From f70bc9152a2aee2a29d1eef5b6bc698945c4a84a Mon Sep 17 00:00:00 2001 From: junjun Date: Thu, 27 Oct 2022 15:56:38 +0800 Subject: [PATCH 2/7] =?UTF-8?q?refactor(=E8=A7=86=E5=9B=BE):=20=E8=BE=85?= =?UTF-8?q?=E5=8A=A9=E7=BA=BF=E3=80=81=E9=98=88=E5=80=BC=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=95=8C=E9=9D=A2UI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/senior/AssistLine.vue | 2 +- frontend/src/views/chart/components/senior/Threshold.vue | 4 ++-- .../views/chart/components/senior/dialog/AssistLineEdit.vue | 2 ++ .../chart/components/senior/dialog/TableThresholdEdit.vue | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chart/components/senior/AssistLine.vue b/frontend/src/views/chart/components/senior/AssistLine.vue index b0eef1e46a..0b9c24af06 100644 --- a/frontend/src/views/chart/components/senior/AssistLine.vue +++ b/frontend/src/views/chart/components/senior/AssistLine.vue @@ -51,7 +51,7 @@ :title="$t('chart.assist_line')" :visible="editLineDialog" :show-close="false" - width="70%" + width="1000px" class="dialog-css" > @@ -274,7 +274,7 @@ :title="$t('chart.threshold')" :visible="editTableThresholdDialog" :show-close="false" - width="50%" + width="800px" class="dialog-css" append-to-body > diff --git a/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue b/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue index 21e133f793..655a2a4a7c 100644 --- a/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue +++ b/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue @@ -17,6 +17,7 @@ diff --git a/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue b/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue index 073dfdee8b..119bd29ce7 100644 --- a/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue +++ b/frontend/src/views/chart/components/senior/dialog/TableThresholdEdit.vue @@ -100,6 +100,7 @@ v-show="!item.term.includes('null') && !item.term.includes('empty') && item.term !== 'between'" v-model="item.value" class="value-item" + style="margin-left: 10px;" :placeholder="$t('chart.drag_block_label_value')" size="mini" clearable From 1c64abd5d1cae84fd400ddbe6fd388842573b2b3 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 27 Oct 2022 16:00:45 +0800 Subject: [PATCH 3/7] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E8=AE=BE=E8=AE=A1=E6=96=B0=E7=94=BB?= =?UTF-8?q?=E5=B8=83=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Editor/ComponentWrapper.vue | 2 +- .../src/components/widget/DeWidget/DeTabs.vue | 19 +++++++++++++------ .../src/views/panel/edit/ComponentWait.vue | 2 +- frontend/src/views/panel/edit/index.vue | 1 + 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue index cf18c101c3..50407a9c93 100644 --- a/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/Editor/ComponentWrapper.vue @@ -195,7 +195,7 @@ export default { return style }, componentActiveFlag() { - return (this.curComponent && this.config === this.curComponent && !this.previewVisible && !this.showPosition.includes('email-task')) || this.showPosition.includes('multiplexing') + return !this.mobileLayoutStatus && ((this.curComponent && this.config === this.curComponent && !this.previewVisible && !this.showPosition.includes('email-task')) || this.showPosition.includes('multiplexing')) }, curGap() { return (this.canvasStyleData.panel.gap === 'yes' && this.config.auxiliaryMatrix) ? this.componentGap : 0 diff --git a/frontend/src/components/widget/DeWidget/DeTabs.vue b/frontend/src/components/widget/DeWidget/DeTabs.vue index edb11049dd..b97cd577fd 100644 --- a/frontend/src/components/widget/DeWidget/DeTabs.vue +++ b/frontend/src/components/widget/DeWidget/DeTabs.vue @@ -56,7 +56,7 @@ -
+
item.canvasId === tabCanvasId) + } else { + return getNowCanvasComponentData(tabCanvasId) + } }, setContentThemeStyle() { this.element.options.tabList.forEach(tab => { diff --git a/frontend/src/views/panel/edit/ComponentWait.vue b/frontend/src/views/panel/edit/ComponentWait.vue index cc7ace5ece..3434a4b07a 100644 --- a/frontend/src/views/panel/edit/ComponentWait.vue +++ b/frontend/src/views/panel/edit/ComponentWait.vue @@ -6,7 +6,7 @@ Date: Thu, 27 Oct 2022 16:04:08 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20cas=E6=9C=8D=E5=8A=A1=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E4=B8=AD=E6=96=87=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/zh.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 86e6efae90..851565d647 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -2630,6 +2630,6 @@ export default { }, logout: { oidc_logout_error: 'OIDC退出失败,是否继续退出DataEase?', - cas_logout_error: 'The CAS service is abnormal, please contact the administrator!' + cas_logout_error: 'CAS服务异常,请联系管理员!' } } From 2443b0177deeb062d058e6490a0c4f89dab2ca9c Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw <67260074+fit2cloud-chenyw@users.noreply.github.com> Date: Thu, 27 Oct 2022 16:04:53 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix:=20cas=E6=9C=8D=E5=8A=A1=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E8=8B=B1=E6=96=87=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/lang/en.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 2b396f403a..d3a53cec82 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -2629,6 +2629,6 @@ export default { }, logout: { oidc_logout_error: 'OIDC failed to exit, do you continue to exit DataEase?', - cas_logout_error: 'CAS服务异常,请联系管理员!' + cas_logout_error: 'The CAS service is abnormal, please contact the administrator!' } } From b19914ce6b7efc28da45ff1195da35a5467624e9 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 27 Oct 2022 16:08:21 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix(=E7=99=BB=E5=87=BA):=20=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5cas=E5=90=8E=E9=80=80=E5=87=BA=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B7=B3=E8=BD=AC=E5=88=B0cas=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2issues/2909?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/service/impl/ShiroServiceImpl.java | 2 ++ .../io/dataease/plugins/server/CasServer.java | 9 +++++++++ frontend/src/api/user.js | 7 +++++++ frontend/src/views/login/index.vue | 20 +++++++++++++++---- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java index b92517f050..0fd46ef9a9 100644 --- a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java +++ b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java @@ -86,6 +86,7 @@ public class ShiroServiceImpl implements ShiroService { filterChainDefinitionMap.put("/api/auth/isOpenWecom", ANON); filterChainDefinitionMap.put("/api/auth/isOpenDingtalk", ANON); filterChainDefinitionMap.put("/api/auth/isOpenLark", ANON); + filterChainDefinitionMap.put("/api/auth/isOpenCas", ANON); filterChainDefinitionMap.put("/api/auth/isOpenLarksuite", ANON); filterChainDefinitionMap.put("/api/auth/getPublicKey", ANON); filterChainDefinitionMap.put("/api/pluginCommon/component/*", ANON); @@ -106,6 +107,7 @@ public class ShiroServiceImpl implements ShiroService { filterChainDefinitionMap.put("/plugin/larksuite/bind*", ANON); filterChainDefinitionMap.put("/plugin/larksuite/getQrParam", ANON); filterChainDefinitionMap.put("/cas/reset/**", ANON); + filterChainDefinitionMap.put("/cas/loginPage", ANON); filterChainDefinitionMap.put("/unauth", ANON); filterChainDefinitionMap.put("/display/**", ANON); diff --git a/backend/src/main/java/io/dataease/plugins/server/CasServer.java b/backend/src/main/java/io/dataease/plugins/server/CasServer.java index c54639c1b3..9a68ebec93 100644 --- a/backend/src/main/java/io/dataease/plugins/server/CasServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/CasServer.java @@ -115,4 +115,13 @@ public class CasServer { return error; } } + + @GetMapping("/loginPage") + @ResponseBody + public String loginPage() { + String casServerUrlPrefix = systemParameterService.getValue("cas.login"); + String callBack = systemParameterService.getValue("cas.callBack"); + String result = casServerUrlPrefix + "?service=" + callBack; + return result; + } } diff --git a/frontend/src/api/user.js b/frontend/src/api/user.js index 32d2067307..14faf86234 100644 --- a/frontend/src/api/user.js +++ b/frontend/src/api/user.js @@ -100,6 +100,13 @@ export function casStatus() { }) } +export function casLoginPage() { + return request({ + url: '/cas/loginPage', + method: 'get' + }) +} + export function wecomStatus() { return request({ url: '/api/auth/isOpenWecom', diff --git a/frontend/src/views/login/index.vue b/frontend/src/views/login/index.vue index e5881db818..6765a686eb 100644 --- a/frontend/src/views/login/index.vue +++ b/frontend/src/views/login/index.vue @@ -130,17 +130,17 @@ > @@ -210,7 +210,7 @@