Allow login to different realms using query param (#188)
This commit is contained in:
parent
9fb081e3bf
commit
45b878e2e6
3 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
}
|
|
@ -69,7 +69,7 @@ export const RealmSelector = ({ realmList }: RealmSelectorProps) => {
|
|||
|
||||
const dropdownItems = realmList.map((r) => (
|
||||
<DropdownItem
|
||||
key={r.id}
|
||||
key={`realm-dropdown-item-${r.realm}`}
|
||||
onClick={() => {
|
||||
setRealm(r.realm);
|
||||
setOpen(!open);
|
||||
|
|
|
@ -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<KeycloakInstance> {
|
||||
await keycloak.init({ onLoad: "check-sso", pkceMethod: "S256" }).catch(() => {
|
||||
|
|
Loading…
Reference in a new issue