diff --git a/changelog/unreleased/bugfix-not-logged-out-if-oC10-backend b/changelog/unreleased/bugfix-not-logged-out-if-oC10-backend new file mode 100644 index 00000000000..c4b5a0ced7f --- /dev/null +++ b/changelog/unreleased/bugfix-not-logged-out-if-oC10-backend @@ -0,0 +1,6 @@ +Bugfix: Not logged out if backend is ownCloud 10 + +We've fixed an issue, where the user won't be logged out if the backend is ownCloud 10 + +https://github.com/owncloud/web/pull/6939 +https://github.com/owncloud/web/issues/5886 diff --git a/config/config.json.sample-oc10 b/config/config.json.sample-oc10 index a432a3044b0..9a4cadf0bbe 100644 --- a/config/config.json.sample-oc10 +++ b/config/config.json.sample-oc10 @@ -5,7 +5,8 @@ "auth": { "clientId": "UmCVsEIxdWmssxa6uVRRPC3txYBVN4qqxooJbsPhuuoPmHk9Pt9Oy68N4ZaKXUYy", "url": "http://localhost:8080/index.php/apps/oauth2/api/v1/token", - "authUrl": "http://localhost:8080/index.php/apps/oauth2/authorize" + "authUrl": "http://localhost:8080/index.php/apps/oauth2/authorize", + "logoutUrl": "http://localhost:8080/index.php/logout" }, "apps": [ "files", diff --git a/dev/docker/oc10.web.config.json b/dev/docker/oc10.web.config.json index 74159323c36..606f2ba2436 100644 --- a/dev/docker/oc10.web.config.json +++ b/dev/docker/oc10.web.config.json @@ -3,7 +3,8 @@ "auth": { "clientId": "M8W5mo3wQV3VHWYsaYpWhkr8dwa949i4GljCkedHhl7GWqmHMkxSeJgK2PcS0jt5", "url": "http://host.docker.internal:8080/index.php/apps/oauth2/api/v1/token", - "authUrl": "http://host.docker.internal:8080/index.php/apps/oauth2/authorize" + "authUrl": "http://host.docker.internal:8080/index.php/apps/oauth2/authorize", + "logoutUrl": "http://host.docker.internal:8080/index.php/logout" }, "apps": [ "files", diff --git a/packages/web-runtime/src/store/user.js b/packages/web-runtime/src/store/user.js index bfb82cf5300..f78ea877b33 100644 --- a/packages/web-runtime/src/store/user.js +++ b/packages/web-runtime/src/store/user.js @@ -21,7 +21,7 @@ const state = { } const actions = { - cleanUpLoginState(context) { + cleanUpLoginState(context, options = { clearOIDCLoginState: true }) { if (context.state.id === '') { return } @@ -31,18 +31,26 @@ const actions = { // clear dynamic navItems context.dispatch('clearDynamicNavItems') - // clear oidc client state - vueAuthInstance.clearLoginState() + if (options.clearOIDCLoginState) { + // clear oidc client state + vueAuthInstance.clearLoginState() + } }, - async logout({ dispatch }) { - const logoutFinalizer = (forceRedirect = false) => { + async logout(context) { + const logoutFinalizer = (isOauth2 = false) => { // Remove signed in user - dispatch('cleanUpLoginState') - dispatch('hideModal') - dispatch('loadSettingsValues') + context.dispatch('cleanUpLoginState', { clearOIDCLoginState: !isOauth2 }) + context.dispatch('hideModal') + context.dispatch('loadSettingsValues') + + // Force redirect + if (isOauth2) { + if (context.getters?.configuration?.auth?.logoutUrl) { + return (window.location = context.getters?.configuration?.auth?.logoutUrl) + } else if (context.getters?.configuration?.server) { + return (window.location = `${context.getters?.configuration?.server}/index.php/logout`) + } - // Force redirect to login - if (forceRedirect) { router.push({ name: 'login' }) } }