Fall back to OIDC response_mode query if fragment unsupported (#33169)
* Fall back to OIDC response_mode query if fragment unsupported * Tidy comments * Fix test
This commit is contained in:
@@ -44,7 +44,7 @@ function onTokenLoginCompleted(urlParams: URLParams, fragmentAfterLogin: string)
|
||||
const url = new URL(window.location.href);
|
||||
|
||||
// if we did a token login, we're now left with the login token as query param in the url; clear it out
|
||||
for (const param in { ...urlParams.legacy_sso }) {
|
||||
for (const param in { ...urlParams.legacy_sso, ...urlParams.oidc_query }) {
|
||||
url.searchParams.delete(param);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ export async function loadApp(urlParams: URLParams, matrixChatRef: React.Ref<Mat
|
||||
// Before we continue, let's see if we're supposed to do an SSO redirect
|
||||
const [userId] = await Lifecycle.getStoredSessionOwner();
|
||||
const hasPossibleToken = !!userId;
|
||||
const isReturningFromSso = !!urlParams.legacy_sso || !!urlParams.oidc;
|
||||
const isReturningFromSso = !!urlParams.legacy_sso || !!urlParams.oidc_fragment || !!urlParams.oidc_query;
|
||||
const ssoRedirects = config.sso_redirect_options || {};
|
||||
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.
|
||||
|
||||
@@ -55,10 +55,15 @@ const urlParameterConfig = {
|
||||
location: "query",
|
||||
},
|
||||
// Fragment params for OIDC login, added by the Identity Provider
|
||||
oidc: {
|
||||
oidc_fragment: {
|
||||
keys: ["code", "state"],
|
||||
location: "fragment",
|
||||
},
|
||||
// Query params for OIDC login, added by the Identity Provider, used as fallback when fragment is unsupported
|
||||
oidc_query: {
|
||||
keys: ["code", "state"],
|
||||
location: "query",
|
||||
},
|
||||
// Fragment params relating to 3pid (email) invites, added in url within the invite email itself
|
||||
threepid: {
|
||||
keys: ["client_secret", "session_id", "hs_url", "is_url", "sid"],
|
||||
|
||||
Reference in New Issue
Block a user