-
Notifications
You must be signed in to change notification settings - Fork 81
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
Nextcloud addressbook sync not working after logout/re-login and also with bearer auth #361
Comments
I found this post from last november (#319 (comment)) Is this still true, that "It appears nextcloud on the DAV API currently only accepts bearer tokens when nextcloud itself servers as the auth server, but not with a third party auth service."? Meaning, I can't use the preset addressbook in my case. |
I followed more the post I referenced and read the PR to add webdav access to OIDC token (pulsejet/nextcloud-oidc-login#99). If I understood correctly, I'll have to switch from SAML to OIDC plugin in Nextcloud in order to have the preset addressbooks working with bearer authentication, correct? And wait for the PR to be integrated in a future version of the OIDC plugin.. In the meantime, I'll try to have the carddav plugin working with an app password in Nextcloud (my first point in the original post). Any idea why it doesn't work anymore after a disconnect / reconnect? |
Concerning the app passwords: I'm not aware of any such problems. In your log, I only see that the password is sent to the server but the server rejects it. The only thing I could imagine is that something goes wrong with storing the password to the DB and retrieving it later. Especially if you log into roundcube using OAuth, there will be no password to encrypt the carddav password with (if you use the default encrypted scheme). $prefs['_GLOBAL']['pwstore_scheme'] = 'encrypted'; However, in that case it should encrypt the password with the roundcube des_key, as if you had configured $prefs['_GLOBAL']['pwstore_scheme'] = 'des_key'; If you can access the database, you can check the password field in the carddav addressbooks table. It will contain the scheme as a prefix in braces, e.g. You can also check if the correct password is sent to the server by inspecting the $message = $this->redactMessage($message); like so: // $message = $this->redactMessage($message); Then access the addressbook again and you will get a non-redacted authorization header. If you run |
Concerning bearer authentication:
From skimming the Lemonldap-ng docs, it should be possible to configure it work with nextcloud, but I lack experience to that end. I tried this myself only with keycloak as the auth server and that worked fine. There is one small issue that needs to be addressed in roundcube: if you stay inside the addressbook view for a longer time and the access token expires, roundcube will not refresh the access token until you get back to the mail view. See roundcube/roundcubemail#8224 |
Amazing infos you gave me here. I'll need time to read / try all this. |
That's what I have.
I checked the Authorization header. |
I started again. I tried without pwstore_scheme:
It worked even after a reconnect. I re-tried with 'encrypted'. In both cases, the entries in the Db were correct. I'm not a big fan having the password not encrypted in the DB. I'm going to test the other alternative (OIDC plugin + bearer authentication), I really would like to have that one working. |
Ok, I just found that with OAuth in roundcube 1.5, roundcube sets the session password the the bearer token. That makes the check in rcmcarddav that checks if a password for encryption is available get to the conclusion there is - and it stores the carddav password in the DB, using the access token as encryption key. However, the token is short-lived - as soon as it gets replaced by a new token, rcmcarddav is not able to decrypt the password in the DB anymore. I suggest you use |
Could you try with the latest master? It should detect OAuth login and automatically switch to des_key in the case. A broken encrypted entry won't be fixed automatically, you will have to enter the password in the preferences again and save them to store the password with des_key scheme. |
Tested with the latest master. And all was good after a reconnect. Very nice. I'm still trying the Oidc plugin. |
Sorry for the delay. I got it working with the bearer auth. For people using LemonLdap as Idp, in " OpenID Connect Relying Parties" -> "rp-roundcube" -> Options -> Advanced -> "Additional audiences", you add the Nextcloud OIDC client ID. If you connect to Nextcloud address books, you need the app "External user authentication" to be able to auth with bearer token via webdav. Very very nice. |
Hello,
I have a Roundcube / Nextcloud in SSO mode with LemonLdap as IDP, all on the same server.
It's worth mentioning Roundcube and Nextcloud are not on the same domain name.
Nextcloud is using SAML and Roundcube OIDC.
I works very well, but as soon as I disconnect and reconnect, it doesn't work anymore.
See attached file logs_with_app_passwd.tar.gz for the logs.
Here is my config:
See attached file logs_with_bearer_auth.tar.gz for the logs.
Thanks,
Kenny
logs_with_app_passwd.tar.gz
logs_with_bearer_auth.tar.gz
The text was updated successfully, but these errors were encountered: