Skip to content

Commit 237dd8c

Browse files
committed
refactor: oidc add scope
1 parent 7f597b6 commit 237dd8c

File tree

5 files changed

+16
-1
lines changed

5 files changed

+16
-1
lines changed

ui/src/locales/lang/en-US/views/system.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default {
4040
userInfoEndpointPlaceholder: 'Please enter user information endpoint',
4141
clientId: 'Client ID',
4242
clientIdPlaceholder: 'Please enter client ID',
43+
scopePlaceholder: 'Please enter scope',
4344
clientSecret: 'Client Secret',
4445
clientSecretPlaceholder: 'Please enter client secret',
4546
logoutEndpoint: 'Logout Endpoint',

ui/src/locales/lang/zh-CN/views/system.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default {
3838
tokenEndpointPlaceholder: '请输入 Token 端地址',
3939
userInfoEndpoint: '用户信息端地址',
4040
userInfoEndpointPlaceholder: '请输入用户信息端地址',
41+
scopePlaceholder: '请输入连接范围',
4142
clientId: '客户端 ID',
4243
clientIdPlaceholder: '请输入客户端 ID',
4344
clientSecret: '客户端密钥',

ui/src/locales/lang/zh-Hant/views/system.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default {
4040
userInfoEndpoint: '使用者資訊端位址',
4141
userInfoEndpointPlaceholder: '請輸入使用者資訊端位址',
4242
clientId: '用戶端 ID',
43+
scopePlaceholder: '請輸入連線範圍',
4344
clientIdPlaceholder: '請輸入用戶端 ID',
4445
clientSecret: '用戶端密鑰',
4546
clientSecretPlaceholder: '請輸入用戶端密鑰',

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
:placeholder="$t('views.system.authentication.oidc.userInfoEndpointPlaceholder')"
3737
/>
3838
</el-form-item>
39+
<el-form-item label="Scope" prop="config_data.scope">
40+
<el-input v-model="form.config_data.scope" placeholder="openid+profile+email " />
41+
</el-form-item>
3942
<el-form-item
4043
:label="$t('views.system.authentication.oidc.clientId')"
4144
prop="config_data.clientId"
@@ -94,6 +97,7 @@ const form = ref<any>({
9497
authEndpoint: '',
9598
tokenEndpoint: '',
9699
userInfoEndpoint: '',
100+
scope: '',
97101
clientId: '',
98102
clientSecret: '',
99103
redirectUrl: ''
@@ -127,6 +131,13 @@ const rules = reactive<FormRules<any>>({
127131
trigger: 'blur'
128132
}
129133
],
134+
'config_data.scope': [
135+
{
136+
required: true,
137+
message: t('views.system.authentication.oidc.scopePlaceholder'),
138+
trigger: 'blur'
139+
}
140+
],
130141
'config_data.clientId': [
131142
{
132143
required: true,

ui/src/views/login/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ function redirectAuth(authType: string) {
177177
}
178178
}
179179
if (authType === 'OIDC') {
180-
url = `${config.authEndpoint}?client_id=${config.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=openid+profile+email`
180+
const scope = config.scope || 'openid+profile+email'
181+
url = `${config.authEndpoint}?client_id=${config.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=${scope}`
181182
}
182183
if (authType === 'OAuth2') {
183184
url =

0 commit comments

Comments
 (0)