Skip to content

Commit 2550324

Browse files
committed
refactor: oidc add field_mapping
1 parent bf52dd8 commit 2550324

File tree

1 file changed

+23
-0
lines changed
  • ui/src/views/authentication/component

1 file changed

+23
-0
lines changed

ui/src/views/authentication/component/OIDC.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@
6161
show-password
6262
/>
6363
</el-form-item>
64+
<el-form-item
65+
:label="$t('views.system.authentication.oauth2.filedMapping')"
66+
prop="config_data.fieldMapping"
67+
>
68+
<el-input
69+
v-model="form.config_data.fieldMapping"
70+
:placeholder="$t('views.system.authentication.oauth2.filedMappingPlaceholder')"
71+
/>
72+
</el-form-item>
6473
<el-form-item
6574
:label="$t('views.system.authentication.oidc.redirectUrl')"
6675
prop="config_data.redirectUrl"
@@ -104,6 +113,7 @@ const form = ref<any>({
104113
state: '',
105114
clientId: '',
106115
clientSecret: '',
116+
fieldMapping: '{"username": "preferred_username", "email": "email"}',
107117
redirectUrl: ''
108118
},
109119
is_active: true
@@ -156,6 +166,13 @@ const rules = reactive<FormRules<any>>({
156166
trigger: 'blur'
157167
}
158168
],
169+
'config_data.fieldMapping': [
170+
{
171+
required: true,
172+
message: t('views.system.authentication.oauth2.filedMappingPlaceholder'),
173+
trigger: 'blur'
174+
}
175+
],
159176
'config_data.redirectUrl': [
160177
{
161178
required: true,
@@ -187,6 +204,12 @@ function getDetail() {
187204
authApi.getAuthSetting(form.value.auth_type, loading).then((res: any) => {
188205
if (res.data && JSON.stringify(res.data) !== '{}') {
189206
form.value = res.data
207+
if (
208+
form.value.config_data.fieldMapping === '' ||
209+
form.value.config_data.fieldMapping === undefined
210+
) {
211+
form.value.config_data.fieldMapping = '{"username": "preferred_username", "email": "email"}'
212+
}
190213
}
191214
})
192215
}

0 commit comments

Comments
 (0)