- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.6k
fix(oauth2): retain support for legacy ownCloud clients #50858
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense! I did not test the full migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Just to be sure i get it:
occ oauth2:import-legacy-oc-client CLIENT_ID CLIENT_SECRET creates a client. We know we can do this after the Owncloud repair step has been executed because it has deleted the clients that have oc://* as redirect uri. Right?
I guess my question is: Is it necessary to run the occ oauth2:import-legacy-oc-client in all scenarios or only in specific ones? In which case it would be good to add details in the command description.
| 
 Only if the server has been migrated before this patch was applied or if the system config was not enabled before the migration. In those scenarios, the client was deleted from the table during the migration and has to be added manually via the new occ command. Otherwise, if the config was set and the patch was applied before the migration, the client will be retained and the command is not required to be run. Good point, I'll add this as a hint to the command's description. | 
17517ea    to
    5b1fc2c      
    Compare
  
    Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
5b1fc2c    to
    246da73      
    Compare
  
    | /backport to stable29 | 
| /backport to stable30 | 
| /backport to stable31 | 
| The backport to  # Switch to the target branch and update it
git checkout stable29
git pull origin stable29
# Create the new backport branch
git checkout -b backport/50858/stable29
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 246da73a
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/50858/stable29Error: Failed to check for changes with origin/stable29: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. | 
| The backport to  # Switch to the target branch and update it
git checkout stable30
git pull origin stable30
# Create the new backport branch
git checkout -b backport/50858/stable30
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 246da73a
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/50858/stable30Error: Failed to check for changes with origin/stable30: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. | 
| The backport to  # Switch to the target branch and update it
git checkout stable31
git pull origin stable31
# Create the new backport branch
git checkout -b backport/50858/stable31
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 246da73a
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/50858/stable31Error: Failed to check for changes with origin/stable31: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. | 
Summary
This brings back support for legacy ownCloud clients in Nextcloud. They will continue to work seamlessly even when the OAuth authentication mode (default) is used.
How to test?
oc_oauth2_access_tokens,oc_oauth2_refresh_tokensandoc_oauth2_clientsto a Nextcloud instance.oauth2migrations on Nextcloud.oauth2migrations and repair the instance:occ migrations:migrate oauth2 && occ maintenance:repairCase 1 (best): Refresh token is retained (default)
Observe that the client will continue to work seamlessly. No prompt to login again.
Case 2 (worst): Refresh token is lost
(This case can be forced manually by removing relevant access token from the
oc_oauth2_access_tokenstable. Alternatively, you can just log out and in again in the ownCloud desktop client manually.)Observe that the the flow succeeds and the client is able to sync again.
TODO
$enableOcClientSupportinto a system/app config (currently hard-coded)Checklist