mirror of https://gitee.com/topiam/eiam
⚡ OIDC 协议页面配置优化
parent
deb27bace3
commit
a19aa9303a
|
@ -75,7 +75,6 @@ export default (props: { app: GetApp | Record<string, any> }) => {
|
||||||
const { id, template } = app;
|
const { id, template } = app;
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [protocolEndpoint, setProtocolEndpoint] = useState<Record<string, string>>({});
|
const [protocolEndpoint, setProtocolEndpoint] = useState<Record<string, string>>({});
|
||||||
const [idTokenCustomClaimsTableForm] = Form.useForm();
|
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
|
|
||||||
useMount(async () => {
|
useMount(async () => {
|
||||||
|
@ -127,8 +126,6 @@ export default (props: { app: GetApp | Record<string, any> }) => {
|
||||||
form={form}
|
form={form}
|
||||||
scrollToFirstError
|
scrollToFirstError
|
||||||
onFinish={async (values) => {
|
onFinish={async (values) => {
|
||||||
//校验扩展字段
|
|
||||||
await idTokenCustomClaimsTableForm.validateFields();
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const { success } = await saveAppConfig({
|
const { success } = await saveAppConfig({
|
||||||
id,
|
id,
|
||||||
|
@ -269,104 +266,127 @@ export default (props: { app: GetApp | Record<string, any> }) => {
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
</ProFormDependency>
|
</ProFormDependency>
|
||||||
<Form.List
|
<ProFormDependency name={['authGrantTypes']}>
|
||||||
name="redirectUris"
|
{({ authGrantTypes }) => {
|
||||||
rules={[
|
const required =
|
||||||
{
|
authGrantTypes?.includes('implicit') ||
|
||||||
validator: async (_, value) => {
|
authGrantTypes?.includes('authorization_code');
|
||||||
if (value && value.length > 0) {
|
return (
|
||||||
return null;
|
<Form.List
|
||||||
}
|
name="redirectUris"
|
||||||
return Promise.reject(
|
rules={
|
||||||
new Error(
|
required
|
||||||
intl.formatMessage({
|
? [
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.0.message',
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
{(fields, { add, remove }, { errors }) => (
|
|
||||||
<>
|
|
||||||
{fields.map(({ key, name, ...restField }, index) => (
|
|
||||||
<Form.Item
|
|
||||||
{...(index === 0 ? layout : formItemLayoutWithOutLabel)}
|
|
||||||
required={true}
|
|
||||||
key={key}
|
|
||||||
label={
|
|
||||||
index === 0
|
|
||||||
? intl.formatMessage({
|
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris',
|
|
||||||
})
|
|
||||||
: ''
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: '8px',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Form.Item
|
|
||||||
{...restField}
|
|
||||||
name={[name]}
|
|
||||||
validateTrigger={['onChange', 'onBlur']}
|
|
||||||
rules={[
|
|
||||||
{
|
{
|
||||||
required: true,
|
validator: async (_, value) => {
|
||||||
message: intl.formatMessage({
|
if (value && value.length > 0) {
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.0.message',
|
return null;
|
||||||
}),
|
}
|
||||||
|
return Promise.reject(
|
||||||
|
new Error(
|
||||||
|
intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.0.message',
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
]
|
||||||
type: 'url',
|
: []
|
||||||
message: intl.formatMessage({
|
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.1.message',
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
noStyle
|
|
||||||
>
|
|
||||||
<Input
|
|
||||||
placeholder={intl.formatMessage({
|
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.placeholder',
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
<DeleteOutlined onClick={() => remove(name)} />
|
|
||||||
</div>
|
|
||||||
</Form.Item>
|
|
||||||
))}
|
|
||||||
<Form.Item
|
|
||||||
{...(fields.length === 0 ? layout : formItemLayoutWithOutLabel)}
|
|
||||||
required={true}
|
|
||||||
label={
|
|
||||||
fields.length === 0
|
|
||||||
? intl.formatMessage({
|
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris',
|
|
||||||
})
|
|
||||||
: ''
|
|
||||||
}
|
}
|
||||||
extra={intl.formatMessage({
|
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.extra',
|
|
||||||
})}
|
|
||||||
>
|
>
|
||||||
<Button
|
{(fields, { add, remove }, { errors }) => (
|
||||||
type="dashed"
|
<>
|
||||||
onClick={() => add()}
|
{fields.map(({ key, name, ...restField }, index) => (
|
||||||
icon={<PlusOutlined />}
|
<Form.Item
|
||||||
style={{ width: '100%' }}
|
{...(index === 0 ? layout : formItemLayoutWithOutLabel)}
|
||||||
>
|
key={key}
|
||||||
{intl.formatMessage({ id: 'app.add' })}
|
label={
|
||||||
</Button>
|
index === 0
|
||||||
<Form.ErrorList errors={errors} />
|
? intl.formatMessage({
|
||||||
</Form.Item>
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris',
|
||||||
</>
|
})
|
||||||
)}
|
: ''
|
||||||
</Form.List>
|
}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '8px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Form.Item
|
||||||
|
{...restField}
|
||||||
|
name={[name]}
|
||||||
|
validateTrigger={['onChange', 'onBlur']}
|
||||||
|
rules={
|
||||||
|
required
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.0.message',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'url',
|
||||||
|
message: intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.1.message',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
{
|
||||||
|
type: 'url',
|
||||||
|
message: intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.rule.1.message',
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
noStyle
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
placeholder={intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.placeholder',
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<DeleteOutlined onClick={() => remove(name)} />
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
))}
|
||||||
|
<Form.Item
|
||||||
|
{...(fields.length === 0 ? layout : formItemLayoutWithOutLabel)}
|
||||||
|
required={required}
|
||||||
|
label={
|
||||||
|
fields.length === 0
|
||||||
|
? intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris',
|
||||||
|
})
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
extra={intl.formatMessage({
|
||||||
|
id: 'pages.app.config.detail.protocol_config.oidc.redirect_uris.extra',
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
onClick={() => add()}
|
||||||
|
icon={<PlusOutlined />}
|
||||||
|
style={{ width: '100%' }}
|
||||||
|
>
|
||||||
|
{intl.formatMessage({ id: 'app.add' })}
|
||||||
|
</Button>
|
||||||
|
<Form.ErrorList errors={errors} />
|
||||||
|
</Form.Item>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Form.List>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
</ProFormDependency>
|
||||||
<Form.List name="postLogoutRedirectUris">
|
<Form.List name="postLogoutRedirectUris">
|
||||||
{(fields, { add, remove }, {}) => (
|
{(fields, { add, remove }, {}) => (
|
||||||
<>
|
<>
|
||||||
|
@ -378,8 +398,8 @@ export default (props: { app: GetApp | Record<string, any> }) => {
|
||||||
label={
|
label={
|
||||||
index === 0
|
index === 0
|
||||||
? intl.formatMessage({
|
? intl.formatMessage({
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.post_logout_redirect_uris',
|
id: 'pages.app.config.detail.protocol_config.oidc.post_logout_redirect_uris',
|
||||||
})
|
})
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -426,8 +446,8 @@ export default (props: { app: GetApp | Record<string, any> }) => {
|
||||||
label={
|
label={
|
||||||
fields.length === 0
|
fields.length === 0
|
||||||
? intl.formatMessage({
|
? intl.formatMessage({
|
||||||
id: 'pages.app.config.detail.protocol_config.oidc.post_logout_redirect_uris',
|
id: 'pages.app.config.detail.protocol_config.oidc.post_logout_redirect_uris',
|
||||||
})
|
})
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
extra={intl.formatMessage({
|
extra={intl.formatMessage({
|
||||||
|
|
Loading…
Reference in New Issue