OIDC settings tweaks (#28787)
* Hide 3pid account settings if account is managed externally As they would be disabled and just confusing otherwise Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Show manage device button instead of sign out button for other devices in OIDC mode Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tidy up Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix tests Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
9d5141cfaa
commit
16d2cccb73
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a delegated auth account management URL with logout params as per MSC3824 and MSC2965
|
||||
* https://github.com/matrix-org/matrix-spec-proposals/blob/hughns/sso-redirect-action/proposals/3824-oidc-aware-clients.md#definition-of-oidc-aware
|
||||
* https://github.com/sandhose/matrix-doc/blob/msc/sandhose/oidc-discovery/proposals/2965-oidc-discovery.md#account-management-url-parameters
|
||||
*/
|
||||
export const getOidcLogoutUrl = (delegatedAuthAccountUrl: string, deviceId: string): string => {
|
||||
const logoutUrl = new URL(delegatedAuthAccountUrl);
|
||||
logoutUrl.searchParams.set("action", "session_end");
|
||||
logoutUrl.searchParams.set("device_id", deviceId);
|
||||
|
||||
return logoutUrl.toString();
|
||||
};
|
||||
32
src/utils/oidc/urls.ts
Normal file
32
src/utils/oidc/urls.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
enum Action {
|
||||
Profile = "org.matrix.profile",
|
||||
SessionsList = "org.matrix.sessions_list",
|
||||
SessionView = "org.matrix.session_view",
|
||||
SessionEnd = "org.matrix.session_end",
|
||||
AccountDeactivate = "org.matrix.account_deactivate",
|
||||
CrossSigningReset = "org.matrix.cross_signing_reset",
|
||||
}
|
||||
|
||||
const getUrl = (authUrl: string, action: Action): URL => {
|
||||
const url = new URL(authUrl);
|
||||
url.searchParams.set("action", action);
|
||||
return url;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a delegated auth account management URL with logout params as per MSC4191
|
||||
* https://github.com/matrix-org/matrix-spec-proposals/blob/quenting/account-deeplink/proposals/4191-account-deeplink.md#possible-actions
|
||||
*/
|
||||
export const getManageDeviceUrl = (delegatedAuthAccountUrl: string, deviceId: string): string => {
|
||||
const url = getUrl(delegatedAuthAccountUrl, Action.SessionView);
|
||||
url.searchParams.set("device_id", deviceId);
|
||||
return url.toString();
|
||||
};
|
||||
Reference in New Issue
Block a user