refactor: oidc add scope
This commit is contained in:
parent
7f597b6409
commit
237dd8c209
@ -40,6 +40,7 @@ export default {
|
|||||||
userInfoEndpointPlaceholder: 'Please enter user information endpoint',
|
userInfoEndpointPlaceholder: 'Please enter user information endpoint',
|
||||||
clientId: 'Client ID',
|
clientId: 'Client ID',
|
||||||
clientIdPlaceholder: 'Please enter client ID',
|
clientIdPlaceholder: 'Please enter client ID',
|
||||||
|
scopePlaceholder: 'Please enter scope',
|
||||||
clientSecret: 'Client Secret',
|
clientSecret: 'Client Secret',
|
||||||
clientSecretPlaceholder: 'Please enter client secret',
|
clientSecretPlaceholder: 'Please enter client secret',
|
||||||
logoutEndpoint: 'Logout Endpoint',
|
logoutEndpoint: 'Logout Endpoint',
|
||||||
|
|||||||
@ -38,6 +38,7 @@ export default {
|
|||||||
tokenEndpointPlaceholder: '请输入 Token 端地址',
|
tokenEndpointPlaceholder: '请输入 Token 端地址',
|
||||||
userInfoEndpoint: '用户信息端地址',
|
userInfoEndpoint: '用户信息端地址',
|
||||||
userInfoEndpointPlaceholder: '请输入用户信息端地址',
|
userInfoEndpointPlaceholder: '请输入用户信息端地址',
|
||||||
|
scopePlaceholder: '请输入连接范围',
|
||||||
clientId: '客户端 ID',
|
clientId: '客户端 ID',
|
||||||
clientIdPlaceholder: '请输入客户端 ID',
|
clientIdPlaceholder: '请输入客户端 ID',
|
||||||
clientSecret: '客户端密钥',
|
clientSecret: '客户端密钥',
|
||||||
|
|||||||
@ -40,6 +40,7 @@ export default {
|
|||||||
userInfoEndpoint: '使用者資訊端位址',
|
userInfoEndpoint: '使用者資訊端位址',
|
||||||
userInfoEndpointPlaceholder: '請輸入使用者資訊端位址',
|
userInfoEndpointPlaceholder: '請輸入使用者資訊端位址',
|
||||||
clientId: '用戶端 ID',
|
clientId: '用戶端 ID',
|
||||||
|
scopePlaceholder: '請輸入連線範圍',
|
||||||
clientIdPlaceholder: '請輸入用戶端 ID',
|
clientIdPlaceholder: '請輸入用戶端 ID',
|
||||||
clientSecret: '用戶端密鑰',
|
clientSecret: '用戶端密鑰',
|
||||||
clientSecretPlaceholder: '請輸入用戶端密鑰',
|
clientSecretPlaceholder: '請輸入用戶端密鑰',
|
||||||
|
|||||||
@ -36,6 +36,9 @@
|
|||||||
:placeholder="$t('views.system.authentication.oidc.userInfoEndpointPlaceholder')"
|
:placeholder="$t('views.system.authentication.oidc.userInfoEndpointPlaceholder')"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</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
|
<el-form-item
|
||||||
:label="$t('views.system.authentication.oidc.clientId')"
|
:label="$t('views.system.authentication.oidc.clientId')"
|
||||||
prop="config_data.clientId"
|
prop="config_data.clientId"
|
||||||
@ -94,6 +97,7 @@ const form = ref<any>({
|
|||||||
authEndpoint: '',
|
authEndpoint: '',
|
||||||
tokenEndpoint: '',
|
tokenEndpoint: '',
|
||||||
userInfoEndpoint: '',
|
userInfoEndpoint: '',
|
||||||
|
scope: '',
|
||||||
clientId: '',
|
clientId: '',
|
||||||
clientSecret: '',
|
clientSecret: '',
|
||||||
redirectUrl: ''
|
redirectUrl: ''
|
||||||
@ -127,6 +131,13 @@ const rules = reactive<FormRules<any>>({
|
|||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
'config_data.scope': [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('views.system.authentication.oidc.scopePlaceholder'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
'config_data.clientId': [
|
'config_data.clientId': [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
|||||||
@ -177,7 +177,8 @@ function redirectAuth(authType: string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (authType === 'OIDC') {
|
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') {
|
if (authType === 'OAuth2') {
|
||||||
url =
|
url =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user