diff --git a/public/keycloak.json b/public/keycloak.json deleted file mode 100644 index 977acfded3..0000000000 --- a/public/keycloak.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "realm": "master", - "auth-server-url": "http://localhost:8180/auth/", - "ssl-required": "external", - "resource": "security-admin-console-v2", - "public-client": true, - "confidential-port": 0 -} \ No newline at end of file diff --git a/src/components/realm-selector/RealmSelector.tsx b/src/components/realm-selector/RealmSelector.tsx index 4f57b411ef..48747f16ec 100644 --- a/src/components/realm-selector/RealmSelector.tsx +++ b/src/components/realm-selector/RealmSelector.tsx @@ -69,7 +69,7 @@ export const RealmSelector = ({ realmList }: RealmSelectorProps) => { const dropdownItems = realmList.map((r) => ( { setRealm(r.realm); setOpen(!open); diff --git a/src/context/auth/keycloak.ts b/src/context/auth/keycloak.ts index c4c1096d01..59d5785927 100644 --- a/src/context/auth/keycloak.ts +++ b/src/context/auth/keycloak.ts @@ -1,5 +1,13 @@ import Keycloak, { KeycloakInstance } from "keycloak-js"; -const keycloak: KeycloakInstance = Keycloak("/keycloak.json"); + +const realm = + new URLSearchParams(window.location.search).get("realm") || "master"; + +const keycloak: KeycloakInstance = Keycloak({ + url: "http://localhost:8180/auth/", + realm: realm, + clientId: "security-admin-console-v2", +}); export default async function (): Promise { await keycloak.init({ onLoad: "check-sso", pkceMethod: "S256" }).catch(() => {