fix: missing "Userinfo" endpoint configuration entry, used by OAuth clients to request user information from the IdP.

- update config.js
- update SystemSetting.js
This commit is contained in:
OnEvent 2024-08-08 19:10:14 +08:00
parent 6be2658e9b
commit f27224ab8d
No known key found for this signature in database
GPG Key ID: 3CDB9068A32B4927
2 changed files with 23 additions and 2 deletions

View File

@ -27,6 +27,7 @@ const config = {
oauth2_app_id: '',
oauth2_authorization_endpoint: '',
oauth2_token_endpoint: '',
oauth2_userinfo_endpoint: '',
}
};

View File

@ -38,6 +38,7 @@ const SystemSetting = () => {
OAuth2AppSecret: '',
OAuth2AuthorizationEndpoint: '',
OAuth2TokenEndpoint: '',
OAuth2UserinfoEndpoint: '',
Notice: '',
SMTPServer: '',
SMTPPort: '',
@ -152,7 +153,8 @@ const SystemSetting = () => {
name === 'OAuth2AppId' ||
name === 'OAuth2AppSecret' ||
name === 'OAuth2AuthorizationEndpoint' ||
name === 'OAuth2TokenEndpoint'
name === 'OAuth2TokenEndpoint' ||
name === 'OAuth2UserinfoEndpoint'
)
{
setInputs((inputs) => ({ ...inputs, [name]: value }));
@ -241,7 +243,8 @@ const SystemSetting = () => {
OAuth2AppId: inputs.OAuth2AppId,
OAuth2AppSecret: inputs.OAuth2AppSecret,
OAuth2AuthorizationEndpoint: inputs.OAuth2AuthorizationEndpoint,
OAuth2TokenEndpoint: inputs.OAuth2TokenEndpoint
OAuth2TokenEndpoint: inputs.OAuth2TokenEndpoint,
OAuth2UserinfoEndpoint: inputs.OAuth2UserinfoEndpoint
};
console.log(OAuth2Config);
if (originInputs['OAuth2AppId'] !== inputs.OAuth2AppId) {
@ -256,6 +259,9 @@ const SystemSetting = () => {
if (originInputs['OAuth2TokenEndpoint'] !== inputs.OAuth2TokenEndpoint) {
await updateOption('OAuth2TokenEndpoint', inputs.OAuth2TokenEndpoint);
}
if (originInputs['OAuth2UserinfoEndpoint'] !== inputs.OAuth2UserinfoEndpoint) {
await updateOption('OAuth2UserinfoEndpoint', inputs.OAuth2UserinfoEndpoint);
}
};
return (
@ -727,6 +733,20 @@ const SystemSetting = () => {
/>
</FormControl>
</Grid>
<Grid xs={ 12 } md={ 6 }>
<FormControl fullWidth>
<InputLabel htmlFor="OAuth2UserinfoEndpoint">用户地址</InputLabel>
<OutlinedInput
id="OAuth2UserinfoEndpoint"
name="OAuth2UserinfoEndpoint"
value={ inputs.OAuth2UserinfoEndpoint || '' }
onChange={ handleInputChange }
label="认证地址"
placeholder="输入 OAuth 2.0 的 认证地址"
disabled={ loading }
/>
</FormControl>
</Grid>
<Grid xs={ 12 }>
<Button variant="contained" onClick={ submitOAuth2 }>
保存第三方 OAuth 2.0 设置