use realm id instead of realm name (#1051)

fixes: #1042
This commit is contained in:
Erik Jan de Wit 2021-08-24 12:39:16 +02:00 committed by GitHub
parent 4d789f84e3
commit 4fc3865bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 2 deletions

View file

@ -40,9 +40,10 @@ export const UserFederationSection = () => {
const history = useHistory();
useFetch(
() => {
async () => {
const realmModel = await adminClient.realms.findOne({ realm });
const testParams: { [name: string]: string | number } = {
parentId: realm,
parentId: realmModel.id!,
type: "org.keycloak.storage.UserStorageProvider",
};
return adminClient.components.find(testParams);

View file

@ -16,6 +16,7 @@ import { useRealm } from "../../context/realm-context/RealmContext";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import _ from "lodash";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
export type KerberosSettingsRequiredProps = {
form: UseFormMethods;
@ -30,6 +31,8 @@ export const KerberosSettingsRequired = ({
}: KerberosSettingsRequiredProps) => {
const { t } = useTranslation("user-federation");
const helpText = useTranslation("user-federation-help").t;
const adminClient = useAdminClient();
const { realm } = useRealm();
const [isEditModeDropdownOpen, setIsEditModeDropdownOpen] = useState(false);
@ -39,6 +42,12 @@ export const KerberosSettingsRequired = ({
name: "config.allowPasswordAuthentication",
});
useFetch(
() => adminClient.realms.findOne({ realm }),
(result) => form.setValue("parentId", result.id),
[]
);
return (
<>
{showSectionHeading && (

View file

@ -13,6 +13,7 @@ import { FormAccess } from "../../components/form-access/FormAccess";
import { useRealm } from "../../context/realm-context/RealmContext";
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
export type LdapSettingsGeneralProps = {
form: UseFormMethods;
@ -27,8 +28,15 @@ export const LdapSettingsGeneral = ({
}: LdapSettingsGeneralProps) => {
const { t } = useTranslation("user-federation");
const helpText = useTranslation("user-federation-help").t;
const adminClient = useAdminClient();
const { realm } = useRealm();
useFetch(
() => adminClient.realms.findOne({ realm }),
(result) => form.setValue("parentId", result.id),
[]
);
const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false);
const setVendorDefaultValues = () => {