Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout in oc10 while click logout in web #6939

Merged
merged 4 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-not-logged-out-if-oC10-backend
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion config/config.json.sample-oc10
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion dev/docker/oc10.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 14 additions & 8 deletions packages/web-runtime/src/store/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,23 @@ const actions = {
// clear oidc client state
vueAuthInstance.clearLoginState()
},
async logout({ dispatch }) {
const logoutFinalizer = (forceRedirect = false) => {
// Remove signed in user
dispatch('cleanUpLoginState')
dispatch('hideModal')
dispatch('loadSettingsValues')
async logout(context) {
const logoutFinalizer = (isOauth2 = false) => {
// Force redirect
if (isOauth2) {
const logoutUrl = context.getters?.configuration?.auth?.logoutUrl
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved

if (logoutUrl) {
return (window.location = logoutUrl)
}

// Force redirect to login
if (forceRedirect) {
router.push({ name: 'login' })
}

// Remove signed in user
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need the store cleanups before the redirect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is something I can't answer yet, we do a redirect, so I thought the store should be cleaned while accessing the page the next time.
I moved this code path, as there is already a redirect happening in one of these dispatched actions

context.dispatch('cleanUpLoginState')
context.dispatch('hideModal')
context.dispatch('loadSettingsValues')
}
const u = await vueAuthInstance.getStoredUserObject()

Expand Down