kamax-matrix / matrix-synapse-rest-password-provider

Password Provider for Synapse fetching data from a REST endpoint
GNU Affero General Public License v3.0
36 stars 40 forks source link

Short guide for nextcloud integration? #1

Closed poVoq closed 6 years ago

poVoq commented 7 years ago

This seems really interesting. As you already mention Nextcloud in the readme, is there somewhere a more detailed guide how this could be made to work?

maxidorius commented 7 years ago

There isn't at this point. But the process would be always this one:

  1. Create the endpoint, either within the solution directly, or as a separate, standalone item. In the case of Nextcloud, you would simply create an additional PHP page that would handle the endpoints.
  2. Integrate with your webapp. For Nextcloud, that means you would use the \OC class I believe?
  3. Validate credentials within the endpoint by checking them with your backend. For Nextcloud, you would attempt to login the user
  4. Return the JSON data. For Nextcloud, you would query the display name, avatar, e-mail and phone number within the session you created.
poVoq commented 7 years ago

Ah, I see. Actually Nextcloud does have a build in user-provisioning API, see: https://docs.nextcloud.com/server/12/admin_manual/configuration_user/user_provisioning_api.html Maybe something to support out of the box given how popular Matrix and Nextcloud are in the same user-group?

Edit: never mind, that seems to be for editing users and groups.

But is there going to be OAuth2 login support at some point? Nextcloud12 seems to have a partial implementation of that.

maxidorius commented 7 years ago

More of a general comment here: this specific piece of code is only really meant to be a "dumb" bridge to another authentication mechanism.

If there was to be a direct Nextcloud integration, it would only be in mxisd. But my impression is also that people using Nextcloud and Matrix would have a LDAP-like backend. At least I do for my own users.

For Oauth2, it requires support in the Matrix client then some bit of hacking to pass it to the backend... synapse and Riot are limited in that regards and is something I would rather do in another implementation of client/HS.

So to sum it up: this piece of code should stay as dumb as possible.