refactor: oidc add state

--bug=1054135 --user=王孝刚 【认证】maxkb在调用okta的时候少个state参数,可以加上state参数 https://www.tapd.cn/57709429/s/1678654
This commit is contained in:
wxg0103 2025-03-31 18:47:08 +08:00
parent 7afc1da0af
commit 2612894557
2 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,9 @@
<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="State" prop="config_data.state">
<el-input v-model="form.config_data.state" placeholder="" />
</el-form-item>
<el-form-item
:label="$t('views.system.authentication.oidc.clientId')"
prop="config_data.clientId"
@ -98,6 +101,7 @@ const form = ref<any>({
tokenEndpoint: '',
userInfoEndpoint: '',
scope: '',
state: '',
clientId: '',
clientSecret: '',
redirectUrl: ''

View File

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