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 form = useForm<IdentityProviderRepresentation>();
|
||||
const serverInfo = useServerInfo();
|
||||
const providerInfo = useMemo(
|
||||
() =>
|
||||
serverInfo.componentTypes?.[
|
||||
"org.keycloak.broker.social.SocialIdentityProvider"
|
||||
]?.find((p) => p.id === providerId),
|
||||
[serverInfo, providerId]
|
||||
);
|
||||
|
||||
const providerInfo = useMemo(() => {
|
||||
const namespaces = [
|
||||
"org.keycloak.broker.social.SocialIdentityProvider",
|
||||
"org.keycloak.broker.provider.IdentityProvider",
|
||||
];
|
||||
|
||||
for (const namespace of namespaces) {
|
||||
const social = serverInfo.componentTypes?.[namespace]?.find(
|
||||
({ id }) => id === providerId
|
||||
);
|
||||
|
||||
if (social) {
|
||||
return social;
|
||||
}
|
||||
}
|
||||
}, [serverInfo, providerId]);
|
||||
|
||||
const {
|
||||
handleSubmit,
|
||||
formState: { isDirty },
|
||||
|
|
Loading…
Reference in a new issue