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

[full-ci] Fix unloading user with oc10 backend #7128

Merged
merged 1 commit into from
Jun 15, 2022
Merged

Conversation

kulmann
Copy link
Contributor

@kulmann kulmann commented Jun 14, 2022

Description

While already being redirected to the logout URL of oc10 (killing the server side session) we had an intermediate issue of the user in oC Web not being unloaded. As a result, upon next login we still had the previous user available from the session storage. Fixed by not suppressing the user removal inside the oidc-client anymore, but instead deciding inside the userUnloaded event if we are in an oauth2 context and then redirect properly.

Related Issue

Motivation and Context

Harden the oc10 integration.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@kulmann
Copy link
Contributor Author

kulmann commented Jun 14, 2022

This has essentially been backported from the in-progress PR #7072 which will not be ready for the upcoming release.

@kulmann kulmann requested a review from dschmidt June 14, 2022 20:04
@kulmann kulmann self-assigned this Jun 14, 2022
@kulmann
Copy link
Contributor Author

kulmann commented Jun 14, 2022

@dschmidt having you as reviewer here would be awesome, since you're deep down in that rabbit hole already.

@kulmann kulmann mentioned this pull request Jun 14, 2022
25 tasks
Copy link
Member

@dschmidt dschmidt left a comment

Choose a reason for hiding this comment

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

Looks okay, but really hard to tell 🙈

@ownclouders
Copy link
Contributor

ownclouders commented Jun 14, 2022

Results for oCISSharingPublic2 https://drone.owncloud.com/owncloud/web/26243/69/1

💥 The acceptance tests failed on retry. Please find the screenshots inside ...

webUISharingPublicDifferentRoles-shareByPublicLinkDifferentRoles_feature-L169.png

webUISharingPublicDifferentRoles-shareByPublicLinkDifferentRoles_feature-L169.png

@kulmann kulmann changed the title Fix unloading user with oc10 backend [full-ci] Fix unloading user with oc10 backend Jun 15, 2022
vueAuthInstance.clearLoginState()
}
// clear oidc client state
vueAuthInstance.clearLoginState()
Copy link
Contributor Author

@kulmann kulmann Jun 15, 2022

Choose a reason for hiding this comment

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

@dschmidt for more clarity: this function removes the user from the oidc user manager (boils down to being removed from the session storage). So it must be used unconditionally on logout (before it was only used for OIDC but not for OAuth2). The only issue was that the user unload event itself had a redirect to the login page, which was then faster than the intended redirect to the oc10 logout url which is called further down in the logout function. I moved the code that determines the logout url to the user unload event and removed it from the logout function. That's the gist of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds right!

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`)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also made sure that there is no double / in the logout url here. the server url already is ensured to have a trailing slash.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@kulmann kulmann merged commit 22c39e8 into master Jun 15, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix-user-unload branch June 15, 2022 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging out of oC web does not log out of oC classic
3 participants