Add support for redirecting to external pages after logout (#7905)
* Add support for redirecting to external pages after logout This is primarily useful for deployments where the account is managed and needs to be logged out in other places too, like an SSO system. See docs for more information. * Add e2e test and fix Windows instructions * Fix performance gathering stats * use logger
This commit is contained in:
parent
ac36234068
commit
a5ce1c9dcb
9 changed files with 152 additions and 16 deletions
|
@ -20,13 +20,17 @@ export interface ISsoRedirectOptions {
|
|||
on_welcome_page?: boolean; // eslint-disable-line camelcase
|
||||
}
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
export interface ConfigOptions {
|
||||
[key: string]: any;
|
||||
|
||||
logout_redirect_url?: string;
|
||||
|
||||
// sso_immediate_redirect is deprecated in favour of sso_redirect_options.immediate
|
||||
sso_immediate_redirect?: boolean; // eslint-disable-line camelcase
|
||||
sso_redirect_options?: ISsoRedirectOptions; // eslint-disable-line camelcase
|
||||
sso_immediate_redirect?: boolean;
|
||||
sso_redirect_options?: ISsoRedirectOptions;
|
||||
}
|
||||
/* eslint-enable camelcase*/
|
||||
|
||||
export const DEFAULTS: ConfigOptions = {
|
||||
// Brand name of the app
|
||||
|
@ -56,14 +60,14 @@ export default class SdkConfig {
|
|||
SdkConfig.instance = i;
|
||||
|
||||
// For debugging purposes
|
||||
(<any>window).mxReactSdkConfig = i;
|
||||
window.mxReactSdkConfig = i;
|
||||
}
|
||||
|
||||
static get() {
|
||||
public static get() {
|
||||
return SdkConfig.instance || {};
|
||||
}
|
||||
|
||||
static put(cfg: ConfigOptions) {
|
||||
public static put(cfg: ConfigOptions) {
|
||||
const defaultKeys = Object.keys(DEFAULTS);
|
||||
for (let i = 0; i < defaultKeys.length; ++i) {
|
||||
if (cfg[defaultKeys[i]] === undefined) {
|
||||
|
@ -73,11 +77,11 @@ export default class SdkConfig {
|
|||
SdkConfig.setInstance(cfg);
|
||||
}
|
||||
|
||||
static unset() {
|
||||
public static unset() {
|
||||
SdkConfig.setInstance({});
|
||||
}
|
||||
|
||||
static add(cfg: ConfigOptions) {
|
||||
public static add(cfg: ConfigOptions) {
|
||||
const liveConfig = SdkConfig.get();
|
||||
const newConfig = Object.assign({}, liveConfig, cfg);
|
||||
SdkConfig.put(newConfig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue