All Projects → kamax-matrix → matrix-synapse-rest-password-provider

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

Licence: AGPL-3.0 license
Password Provider for Synapse fetching data from a REST endpoint

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to matrix-synapse-rest-password-provider

matrix-chart
Helm chart for deploying a Matrix homeserver stack
Stars: ✭ 83 (+137.14%)
Mutual labels:  matrix, synapse
synadm
Command line admin tool for Synapse (Matrix reference homeserver)
Stars: ✭ 93 (+165.71%)
Mutual labels:  matrix, synapse
matrix-register-bot
Bot that offers two step registrations to a matrix-synapse server
Stars: ✭ 25 (-28.57%)
Mutual labels:  matrix, synapse
Etl
Blazing-fast Expression Templates Library (ETL) with GPU support, in C++
Stars: ✭ 190 (+442.86%)
Mutual labels:  matrix
Mxisd
Federated Matrix Identity Server
Stars: ✭ 194 (+454.29%)
Mutual labels:  matrix
Syphon
⚗️ a privacy centric matrix client
Stars: ✭ 245 (+600%)
Mutual labels:  matrix
Shafa-CD
File Compressor written in C using both Shannon Fano and RLE algorithms
Stars: ✭ 24 (-31.43%)
Mutual labels:  matrix
Md max72xx
LED Matrix Library
Stars: ✭ 186 (+431.43%)
Mutual labels:  matrix
eigen
Owl's OCaml Interface to Eigen3 C++ Library
Stars: ✭ 30 (-14.29%)
Mutual labels:  matrix
Nio
💬 Nio is an upcoming matrix client for iOS.
Stars: ✭ 235 (+571.43%)
Mutual labels:  matrix
Tmatrix
Terminal based replica of the digital rain from The Matrix.
Stars: ✭ 227 (+548.57%)
Mutual labels:  matrix
Peroxide
Rust numeric library with R, MATLAB & Python syntax
Stars: ✭ 191 (+445.71%)
Mutual labels:  matrix
Pygraphblas
GraphBLAS for Python
Stars: ✭ 252 (+620%)
Mutual labels:  matrix
Correlation
🔗 Methods for Correlation Analysis
Stars: ✭ 192 (+448.57%)
Mutual labels:  matrix
python
A Python 3 asyncio Matrix framework.
Stars: ✭ 115 (+228.57%)
Mutual labels:  matrix
Github Matrix
The GitHub Matrix
Stars: ✭ 187 (+434.29%)
Mutual labels:  matrix
eigen-js
⚡ Eigen-js is a port of the Eigen C++ linear algebra library
Stars: ✭ 78 (+122.86%)
Mutual labels:  matrix
Maubot
A plugin-based Matrix bot system.
Stars: ✭ 226 (+545.71%)
Mutual labels:  matrix
Mathnet Numerics
Math.NET Numerics
Stars: ✭ 2,688 (+7580%)
Mutual labels:  matrix
Blasjs
Pure Javascript manually written 👌 implementation of BLAS, Many numerical software applications use BLAS computations, including Armadillo, LAPACK, LINPACK, GNU Octave, Mathematica, MATLAB, NumPy, R, and Julia.
Stars: ✭ 241 (+588.57%)
Mutual labels:  matrix

Synapse REST Password provider


This project is no longer maintained.


Overview

This synapse's password provider allows you to validate a password for a given username and return a user profile using an existing backend, like:

  • Forums (phpBB, Discourse, etc.)
  • Custom Identity stores (Keycloak, ...)
  • CRMs (Wordpress, ...)
  • self-hosted clouds (Nextcloud, ownCloud, ...)

It is mainly used with mxisd, the Federated Matrix Identity Server, to provide missing features and offer a fully integrated solution (directory, authentication, search).

NOTE: This module doesn't provide direct integration with any backend. If you do not use mxisd, you will need to write your own backend, following the Integration section. This module simply translate an anthentication result and profile information into actionables in synapse, and adapt your user profile with what is given.

Install

From Synapse v0.34.0/py3

Copy in whichever directory python3.x can pick it up as a module.

If you installed synapse using the Matrix debian repos:

sudo curl https://raw.githubusercontent.com/kamax-matrix/matrix-synapse-rest-auth/master/rest_auth_provider.py -o /opt/venvs/matrix-synapse/lib/python3.5/site-packages/rest_auth_provider.py

If the command fail, double check that the python version still matches. If not, please let us know by opening an issue.

Before Synapse v0.34.0/py3 or any py2-based release

Copy in whichever directory python2.x can pick it up as a module.

If you installed synapse using the Matrix debian repos:

sudo curl https://raw.githubusercontent.com/kamax-matrix/matrix-synapse-rest-auth/master/rest_auth_provider.py -o /usr/lib/python2.7/dist-packages/rest_auth_provider.py

If the command fail, double check that the python version still matches. If not, please let us know by opening an issue.

Configure

Add or amend the password_providers entry like so:

password_providers:
  - module: "rest_auth_provider.RestAuthProvider"
    config:
      endpoint: "http://change.me.example.com:12345"

Set endpoint to the value documented with the endpoint provider.

Use

  1. Install, configure, restart synapse
  2. Try to login with a valid username and password for the endpoint configured

Next steps

Lowercase username enforcement

NOTE: This is no longer relevant as synapse natively enforces lowercase.

To avoid creating users accounts with uppercase characters in their usernames and running into known issues regarding case sensitivity in synapse, attempting to login with such username will fail.

It is highly recommended to keep this feature enable, but in case you would like to disable it:

    config:
      policy:
        registration:
          username:
            enforceLowercase: false

Profile auto-fill

By default, on first login, the display name is set to the one returned by the backend.
If none is given, the display name is not set.
Upon subsequent login, the display name is not changed.

If you would like to change the behaviour, you can use the following configuration items:

    config:
      policy:
        registration:
          profile:
            name: true
        login:
          profile:
            name: false

3PIDs received from the backend are merged with the ones already linked to the account. If you would like to change this behaviour, you can use the following configuration items:

    config:
      policy:
        all:
          threepid:
            update: false
            replace: false

If update is set to false, the 3PIDs will not be changed at all. If replace is set to true, all 3PIDs not available in the backend anymore will be deleted from synapse.

Integrate

To use this module with your back-end, you will need to implement a single REST endpoint:

Path: /_matrix-internal/identity/v1/check_credentials
Method: POST
Body as JSON UTF-8:

{
  "user": {
    "id": "@matrix.id.of.the.user:example.com",
    "password": "passwordOfTheUser"
  }
}

If the credentials are accepted, the following JSON answer will be provided:

{
  "auth": {
    "success": true,
    "mxid": "@matrix.id.of.the.user:example.com",
    "profile": {
      "display_name": "John Doe",
      "three_pids": [
        {
          "medium": "email",
          "address": "[email protected]"
        },
        {
          "medium": "msisdn",
          "address": "123456789"
        }
      ]
    }
  }
}

auth.profile and any sub-key are optional.


If the credentials are refused, the following JSON answer will be provided:

{
  "auth": {
    "success": false
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].