Fall back to IdentityProvider
component type if present (#21320)
Closes #15344
This commit is contained in:
parent
ac31c54fda
commit
982bac9db6
1 changed files with 18 additions and 7 deletions
|
@ -28,13 +28,24 @@ export default function AddIdentityProvider() {
|
||||||
const { providerId } = useParams<IdentityProviderCreateParams>();
|
const { providerId } = useParams<IdentityProviderCreateParams>();
|
||||||
const form = useForm<IdentityProviderRepresentation>();
|
const form = useForm<IdentityProviderRepresentation>();
|
||||||
const serverInfo = useServerInfo();
|
const serverInfo = useServerInfo();
|
||||||
const providerInfo = useMemo(
|
|
||||||
() =>
|
const providerInfo = useMemo(() => {
|
||||||
serverInfo.componentTypes?.[
|
const namespaces = [
|
||||||
"org.keycloak.broker.social.SocialIdentityProvider"
|
"org.keycloak.broker.social.SocialIdentityProvider",
|
||||||
]?.find((p) => p.id === providerId),
|
"org.keycloak.broker.provider.IdentityProvider",
|
||||||
[serverInfo, providerId]
|
];
|
||||||
);
|
|
||||||
|
for (const namespace of namespaces) {
|
||||||
|
const social = serverInfo.componentTypes?.[namespace]?.find(
|
||||||
|
({ id }) => id === providerId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (social) {
|
||||||
|
return social;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [serverInfo, providerId]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
formState: { isDirty },
|
formState: { isDirty },
|
||||||
|
|
Loading…
Reference in a new issue