Deprecate sso_immediate_redirect
and add welcome-page only option (#19437)
* Deprecate `sso_immediate_redirect` and add welcome-page only option The old `sso_immediate_redirect` option is kept in code for backwards compatibility, but is replaced by `sso_redirect_options.immediate`, where a new `on_welcome_page` option is also introduced to only target entry points to the app. The path matching is a bit brittle, but still ideal in the sense of not showing UI while the app realizes it needs to redirect. The new welcome page-only option is fully intended to avoid breaking permalinks and such while still redirecting when needed. In future, other options might be added here to further tune the experience. * Add note about guests
This commit is contained in:
parent
d24348de81
commit
004e8edcb2
2 changed files with 21 additions and 5 deletions
|
@ -30,7 +30,7 @@ import AutoDiscoveryUtils from 'matrix-react-sdk/src/utils/AutoDiscoveryUtils';
|
|||
import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
|
||||
import * as Lifecycle from "matrix-react-sdk/src/Lifecycle";
|
||||
import type MatrixChatType from "matrix-react-sdk/src/components/structures/MatrixChat";
|
||||
import SdkConfig from "matrix-react-sdk/src/SdkConfig";
|
||||
import SdkConfig, { parseSsoRedirectOptions } from "matrix-react-sdk/src/SdkConfig";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
import { parseQs, parseQsFromFragment } from './url_utils';
|
||||
|
@ -159,7 +159,13 @@ export async function loadApp(fragParams: {}) {
|
|||
const [userId] = await Lifecycle.getStoredSessionOwner();
|
||||
const hasPossibleToken = !!userId;
|
||||
const isReturningFromSso = !!params.loginToken;
|
||||
const autoRedirect = config['sso_immediate_redirect'] === true;
|
||||
const ssoRedirects = parseSsoRedirectOptions(config);
|
||||
let autoRedirect = ssoRedirects.immediate === true;
|
||||
// XXX: This path matching is a bit brittle, but better to do it early instead of in the app code.
|
||||
const isWelcomeOrLanding = window.location.hash === '#/welcome' || window.location.hash === '#';
|
||||
if (!autoRedirect && ssoRedirects.on_welcome_page && isWelcomeOrLanding) {
|
||||
autoRedirect = true;
|
||||
}
|
||||
if (!hasPossibleToken && !isReturningFromSso && autoRedirect) {
|
||||
logger.log("Bypassing app load to redirect to SSO");
|
||||
const tempCli = createClient({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue