Skip to content

Commit 68542b8

Browse files
feat(X-Pack): Add OIDC authentication mechanism
1 parent 0e418d2 commit 68542b8

File tree

16 files changed

+345
-89
lines changed

16 files changed

+345
-89
lines changed

frontend/src/assets/svg/logo_cas.svg

Lines changed: 5 additions & 5 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 17 additions & 0 deletions
Loading

frontend/src/components/layout/Person.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ const savePwdHandler = () => {
8383
pwdFormRef.value?.submit()
8484
}
8585
const logout = async () => {
86-
await userStore.logout()
87-
router.push('/login')
86+
if (!(await userStore.logout())) {
87+
router.push('/login')
88+
}
8889
}
8990
</script>
9091

frontend/src/components/layout/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ const menuSelect = (e: any) => {
236236
router.push(e.index)
237237
}
238238
const logout = async () => {
239-
await userStore.logout()
240-
router.push('/login')
239+
if (!(await userStore.logout())) {
240+
router.push('/login')
241+
}
241242
}
242243
const toSystem = () => {
243244
router.push('/system')

frontend/src/i18n/en.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,11 @@
737737
"revoke_url": "Revocation URL",
738738
"oauth2_field_mapping_placeholder": "Example: {'{'}\"account\": \"OAuth2Account\", \"name\": \"OAuth2Name\", \"email\": \"email\"{'}'}",
739739
"token_auth_method": "Token auth method",
740-
"userinfo_auth_method": "Userinfo auth method"
740+
"userinfo_auth_method": "Userinfo auth method",
741+
"oidc_settings": "OIDC Settings",
742+
"metadata_url": "Metadata URL",
743+
"realm": "Realm",
744+
"oidc_field_mapping_placeholder": "e.g., {\"account\": \"oidcAccount\", \"name\": \"oidcName\", \"email\": \"email\"}"
741745
},
742746
"login": {
743747
"default_login": "Default",
@@ -749,7 +753,8 @@
749753
"qr_code": "QR Code",
750754
"platform_disable": "{0} settings are not enabled!",
751755
"input_account": "Please enter account",
752-
"redirect_2_auth": "Redirecting to {0} authentication, {1} seconds..."
756+
"redirect_2_auth": "Redirecting to {0} authentication, {1} seconds...",
757+
"redirect_immediately": "Redirecting immediately"
753758
},
754759
"supplier": {
755760
"alibaba_cloud_bailian": "Alibaba Cloud Bailian",

frontend/src/i18n/ko-KR.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,11 @@
737737
"revoke_url": "취소 URL",
738738
"oauth2_field_mapping_placeholder": "예: {'{'}\"account\": \"OAuth2Account\", \"name\": \"OAuth2Name\", \"email\": \"email\"{'}'}",
739739
"token_auth_method": "토큰 인증 방식",
740-
"userinfo_auth_method": "사용자 정보 인증 방식"
740+
"userinfo_auth_method": "사용자 정보 인증 방식",
741+
"oidc_settings": "OIDC 설정",
742+
"metadata_url": "메타데이터 URL",
743+
"realm": "영역",
744+
"oidc_field_mapping_placeholder": "예: {\"account\": \"oidcAccount\", \"name\": \"oidcName\", \"email\": \"email\"}"
741745
},
742746
"login": {
743747
"default_login": "기본값",
@@ -749,7 +753,8 @@
749753
"qr_code": "QR 코드",
750754
"platform_disable": "{0} 설정이 활성화되지 않았습니다!",
751755
"input_account": "계정을 입력해 주세요",
752-
"redirect_2_auth": "{0} 인증으로 리디렉션 중입니다, {1}초..."
756+
"redirect_2_auth": "{0} 인증으로 리디렉션 중입니다, {1}초...",
757+
"redirect_immediately": "지금 이동"
753758
},
754759
"supplier": {
755760
"alibaba_cloud_bailian": "알리바바 클라우드 바이리엔",

frontend/src/i18n/zh-CN.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,11 @@
737737
"revoke_url": "撤销地址",
738738
"oauth2_field_mapping_placeholder": "例如:{'{'}\"account\": \"oauth2Account\", \"name\": \"oauth2Name\", \"email\": \"email\"{'}'}",
739739
"token_auth_method": "Token 认证方式",
740-
"userinfo_auth_method": "用户信息认证方式"
740+
"userinfo_auth_method": "用户信息认证方式",
741+
"oidc_settings": "OIDC 设置",
742+
"metadata_url": "元数据地址",
743+
"realm": "领域",
744+
"oidc_field_mapping_placeholder": "例如:{'{'}\"account\": \"oidcAccount\", \"name\": \"oidcName\", \"email\": \"email\"{'}'}"
741745
},
742746
"login": {
743747
"default_login": "默认",
@@ -749,7 +753,8 @@
749753
"qr_code": "二维码",
750754
"platform_disable": "{0}设置未开启!",
751755
"input_account": "请输入账号",
752-
"redirect_2_auth": "正在跳转至 {0} 认证,{1} 秒..."
756+
"redirect_2_auth": "正在跳转至 {0} 认证,{1} 秒...",
757+
"redirect_immediately": "立即跳转"
753758
},
754759
"supplier": {
755760
"alibaba_cloud_bailian": "阿里云百炼",

frontend/src/stores/user.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ export const UserStore = defineStore('user', {
9191
if (res) {
9292
window.location.href = res
9393
window.open(res, '_self')
94+
return res
9495
}
9596
if (getQueryString('code') && getQueryString('state')?.includes('oauth2_state')) {
9697
const logout_url = location.origin + location.pathname + '#/login'
9798
window.location.href = logout_url
9899
window.open(res, logout_url)
100+
return logout_url
99101
}
102+
return null
100103
},
101104

102105
async info() {

frontend/src/views/WelcomeView.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ const router = useRouter()
1818
const userStore = useUserStore()
1919
2020
const logout = async () => {
21-
await userStore.logout()
22-
router.push('/login')
21+
if (!(await userStore.logout())) {
22+
router.push('/login')
23+
}
2324
}
2425
</script>
2526

0 commit comments

Comments
 (0)