diff --git a/changelog/unreleased/bugfix-local-logout b/changelog/unreleased/bugfix-local-logout new file mode 100644 index 00000000000..1ade68849b7 --- /dev/null +++ b/changelog/unreleased/bugfix-local-logout @@ -0,0 +1,8 @@ +Bugfix: Local logout if IdP has no logout support + +Some IdPs don't support a logout endpoint. In those cases the web UI ran into a fatal error and showed an empty screen without +further redirects. Fixed by forgetting the currently authenticated user when the OpenID Connect configuration doesn't contain +an `endSessionEndpoint` url. + +https://github.com/owncloud/web/pull/10974 +https://github.com/owncloud/enterprise/issues/6631 diff --git a/packages/web-pkg/src/composables/authContext/useAuthService.ts b/packages/web-pkg/src/composables/authContext/useAuthService.ts index 1f8e11a559b..af6e7a4d52e 100644 --- a/packages/web-pkg/src/composables/authContext/useAuthService.ts +++ b/packages/web-pkg/src/composables/authContext/useAuthService.ts @@ -1,8 +1,10 @@ import { useService } from '../service' +import { NavigationFailure } from 'vue-router' export interface AuthServiceInterface { handleAuthError(route: any): any signinSilent(): Promise + logoutUser(): Promise } export const useAuthService = (): AuthServiceInterface => { diff --git a/packages/web-runtime/src/components/Topbar/UserMenu.vue b/packages/web-runtime/src/components/Topbar/UserMenu.vue index a8f08a23058..d9a67cc4920 100644 --- a/packages/web-runtime/src/components/Topbar/UserMenu.vue +++ b/packages/web-runtime/src/components/Topbar/UserMenu.vue @@ -143,13 +143,13 @@ import { storeToRefs } from 'pinia' import { defineComponent, PropType, ComponentPublicInstance, computed, unref } from 'vue' import { filesize } from 'filesize' -import { authService } from '../../services/auth' import { useRoute, useSpacesStore, useThemeStore, useUserStore, - routeToContextQuery + routeToContextQuery, + useAuthService } from '@ownclouders/web-pkg' import { OcDrop } from 'design-system/src/components' import { MenuItem } from '../../helpers/menuItems' @@ -167,6 +167,7 @@ export default defineComponent({ const userStore = useUserStore() const themeStore = useThemeStore() const spacesStore = useSpacesStore() + const authService = useAuthService() const { user } = storeToRefs(userStore) @@ -181,6 +182,9 @@ export default defineComponent({ query: { redirectUrl: unref(route).fullPath } } }) + const logout = () => { + authService.logoutUser() + } const imprintUrl = computed(() => themeStore.currentTheme.common.urls.imprint) const privacyUrl = computed(() => themeStore.currentTheme.common.urls.privacy) @@ -195,7 +199,8 @@ export default defineComponent({ loginLink, imprintUrl, privacyUrl, - quota + quota, + logout } }, computed: { @@ -249,11 +254,6 @@ export default defineComponent({ onShown: () => (this.$refs.menu as ComponentPublicInstance).$el.querySelector('a:first-of-type').focus() }) - }, - methods: { - logout() { - authService.logoutUser() - } } }) diff --git a/packages/web-runtime/src/pages/accessDenied.vue b/packages/web-runtime/src/pages/accessDenied.vue index 955206696cb..e70dea8de72 100644 --- a/packages/web-runtime/src/pages/accessDenied.vue +++ b/packages/web-runtime/src/pages/accessDenied.vue @@ -82,7 +82,6 @@ export default defineComponent({ } } return { - name: 'login', type: 'router-link', to: { name: 'login', diff --git a/packages/web-runtime/src/pages/logout.vue b/packages/web-runtime/src/pages/logout.vue index 2ed8ec877bf..7a1683d2026 100644 --- a/packages/web-runtime/src/pages/logout.vue +++ b/packages/web-runtime/src/pages/logout.vue @@ -1,42 +1,66 @@