From 2550324003b85f4abe3b9e122053d71e8feae855 Mon Sep 17 00:00:00 2001
From: wxg0103 <727495428@qq.com>
Date: Mon, 21 Apr 2025 17:45:49 +0800
Subject: [PATCH] refactor: oidc add field_mapping
---
.../views/authentication/component/OIDC.vue | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/ui/src/views/authentication/component/OIDC.vue b/ui/src/views/authentication/component/OIDC.vue
index 2666bc647..d71158b9a 100644
--- a/ui/src/views/authentication/component/OIDC.vue
+++ b/ui/src/views/authentication/component/OIDC.vue
@@ -61,6 +61,15 @@
show-password
/>
+
+
+
({
state: '',
clientId: '',
clientSecret: '',
+ fieldMapping: '{"username": "preferred_username", "email": "email"}',
redirectUrl: ''
},
is_active: true
@@ -156,6 +166,13 @@ const rules = reactive>({
trigger: 'blur'
}
],
+ 'config_data.fieldMapping': [
+ {
+ required: true,
+ message: t('views.system.authentication.oauth2.filedMappingPlaceholder'),
+ trigger: 'blur'
+ }
+ ],
'config_data.redirectUrl': [
{
required: true,
@@ -187,6 +204,12 @@ function getDetail() {
authApi.getAuthSetting(form.value.auth_type, loading).then((res: any) => {
if (res.data && JSON.stringify(res.data) !== '{}') {
form.value = res.data
+ if (
+ form.value.config_data.fieldMapping === '' ||
+ form.value.config_data.fieldMapping === undefined
+ ) {
+ form.value.config_data.fieldMapping = '{"username": "preferred_username", "email": "email"}'
+ }
}
})
}