refactor: oidc add scope
Some checks failed
sync2gitee / repo-sync (push) Has been cancelled
Typos Check / Spell Check with Typos (push) Has been cancelled

This commit is contained in:
wxg0103 2025-02-17 19:00:34 +08:00 committed by wxg
parent 7f597b6409
commit 237dd8c209
5 changed files with 16 additions and 1 deletions

View File

@ -40,6 +40,7 @@ export default {
userInfoEndpointPlaceholder: 'Please enter user information endpoint',
clientId: 'Client ID',
clientIdPlaceholder: 'Please enter client ID',
scopePlaceholder: 'Please enter scope',
clientSecret: 'Client Secret',
clientSecretPlaceholder: 'Please enter client secret',
logoutEndpoint: 'Logout Endpoint',

View File

@ -38,6 +38,7 @@ export default {
tokenEndpointPlaceholder: '请输入 Token 端地址',
userInfoEndpoint: '用户信息端地址',
userInfoEndpointPlaceholder: '请输入用户信息端地址',
scopePlaceholder: '请输入连接范围',
clientId: '客户端 ID',
clientIdPlaceholder: '请输入客户端 ID',
clientSecret: '客户端密钥',

View File

@ -40,6 +40,7 @@ export default {
userInfoEndpoint: '使用者資訊端位址',
userInfoEndpointPlaceholder: '請輸入使用者資訊端位址',
clientId: '用戶端 ID',
scopePlaceholder: '請輸入連線範圍',
clientIdPlaceholder: '請輸入用戶端 ID',
clientSecret: '用戶端密鑰',
clientSecretPlaceholder: '請輸入用戶端密鑰',

View File

@ -36,6 +36,9 @@
:placeholder="$t('views.system.authentication.oidc.userInfoEndpointPlaceholder')"
/>
</el-form-item>
<el-form-item label="Scope" prop="config_data.scope">
<el-input v-model="form.config_data.scope" placeholder="openid+profile+email " />
</el-form-item>
<el-form-item
:label="$t('views.system.authentication.oidc.clientId')"
prop="config_data.clientId"
@ -94,6 +97,7 @@ const form = ref<any>({
authEndpoint: '',
tokenEndpoint: '',
userInfoEndpoint: '',
scope: '',
clientId: '',
clientSecret: '',
redirectUrl: ''
@ -127,6 +131,13 @@ const rules = reactive<FormRules<any>>({
trigger: 'blur'
}
],
'config_data.scope': [
{
required: true,
message: t('views.system.authentication.oidc.scopePlaceholder'),
trigger: 'blur'
}
],
'config_data.clientId': [
{
required: true,

View File

@ -177,7 +177,8 @@ function redirectAuth(authType: string) {
}
}
if (authType === 'OIDC') {
url = `${config.authEndpoint}?client_id=${config.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=openid+profile+email`
const scope = config.scope || 'openid+profile+email'
url = `${config.authEndpoint}?client_id=${config.clientId}&redirect_uri=${redirectUrl}&response_type=code&scope=${scope}`
}
if (authType === 'OAuth2') {
url =