ma1uta / ma1sd

Federated Matrix Identity Server (formerly fork of kamax/mxisd)
GNU Affero General Public License v3.0
167 stars 56 forks source link

Integration with Django #17

Open the-moog opened 4 years ago

the-moog commented 4 years ago

I want to try an integrate ma1sd as a source of IDs from Django. my auth_user table in django has username, first_name, last_name, full_name, email in a view auth_fullnames Database is currently sqlite, though it will soon become postgres. Would this be correct for sqlite:

sql:
  enabled: true
  type: sqlite
  connection: /usr/lib/database/django
  directory:
    query:
      name:
        type: 'localpart'
        value: 'SELECT username, full_name FROM auth_fullnames WHERE full_name LIKE ?'
      threepid:
        type: 'localpart'
        value: 'SELECT username, full_name FROM auth_fullnames WHERE email LIKE ?'

Also: 1: If and how to use the Identity and Profile stanzas? 2: Possible to synchronise passwords using ma1sd between Django and Synapse?

For 2 I guess we use either the exec or REST backends, but the latter has limited examples.

the-moog commented 4 years ago

I can answer my own question. YES ...BUT I can't get it to work. It searches (directory API) but if I allow MA1SD to capture the profile and/or identity APIs it breaks everything.

the-moog commented 4 years ago

I still need assistance. If the user is authenticated via EXEC and their Django user id, they can login but their email 3PID is still missing from their profile. I don't understand how this is supposed to work? Is it 1 or 2? 1: Matrix supposed to delegate profile lookups to MA1SD via a proxy config 2: MA1SD supposed to update the profile 3PID, etc on the matrix server during login? As previously stated I tried sending _matrix/client/r0/profile to MA1SD and that really screws things up. It appears the client uses _matrix/client/r0/account/3pid to access this information, should I be capturing that instead?

the-moog commented 4 years ago

For reasons beyond me this is ALMOST working. Latest Synapse/Element and ma1sd v2.4.0 The user ID and automatic account creation now works. Though it breaks if the user already exists with the same email.

Only one fault. it does not update either the display name or email for the user I've made Django update Synapse database with the displayname but it does not display. Am I updating the wrong table or is it cached some place?