Moved switch tenant logic to common-ui
This commit is contained in:
parent
a9d6e5e728
commit
bd532cd28f
@ -31,6 +31,21 @@ export class KeycloakStatusService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async switchTenant(tenantId?: string) {
|
||||||
|
let redirectUri: string;
|
||||||
|
|
||||||
|
if (tenantId) {
|
||||||
|
redirectUri = this.#keycloakService.getKeycloakInstance().createLoginUrl({
|
||||||
|
redirectUri: this.createLoginUrl(tenantId),
|
||||||
|
idpHint: this.#config.OAUTH_IDP_HINT,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
redirectUri = window.location.origin + this.#baseHref;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.#keycloakService.logout(redirectUri);
|
||||||
|
}
|
||||||
|
|
||||||
createLoginUrl(tenant?: string) {
|
createLoginUrl(tenant?: string) {
|
||||||
if (tenant && window.location.href.indexOf('/' + tenant + '/') > 0) {
|
if (tenant && window.location.href.indexOf('/' + tenant + '/') > 0) {
|
||||||
return window.location.href;
|
return window.location.href;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user