Add ability to logout from OIDC (#6539)

* Add OIDC_LOGOUT_URI functionality

* Add logout redirect to work on logout route

* Fix lint

* Fix lint

* Fix lint

* Fix lint

* Return null if logout endpoint used

* Update import
This commit is contained in:
Shuttleu
2024-02-16 16:35:38 +00:00
committed by GitHub
parent 2c9b01391f
commit bc84714670
7 changed files with 29 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ import SearchQuery from "~/models/SearchQuery";
import KeyboardShortcuts from "~/scenes/KeyboardShortcuts";
import { createAction } from "~/actions";
import { NavigationSection, RecentSearchesSection } from "~/actions/sections";
import env from "~/env";
import Desktop from "~/utils/Desktop";
import history from "~/utils/history";
import isCloudHosted from "~/utils/isCloudHosted";
@@ -209,7 +210,12 @@ export const logout = createAction({
analyticsName: "Log out",
section: NavigationSection,
icon: <LogoutIcon />,
perform: () => stores.auth.logout(),
perform: () => {
void stores.auth.logout();
if (env.OIDC_LOGOUT_URI) {
window.location.replace(env.OIDC_LOGOUT_URI);
}
},
});
export const rootNavigationActions = [