/matrix-synapse-saml-touchstone

Touchstone flavour of a Synapse SAML mapping provider

Primary LanguagePythonApache License 2.0Apache-2.0

Synapse Touchstone SAML MXID Mapper

A Synapse plugin module which allows users to choose their display name when they first log in. The username is hardcoded to the part of the email address before the @, with 1, 2, etc appended to disambiguate, if necessary.

Installation

pip install .

Config

Add the following in your Synapse config:

   saml2_config:
     user_mapping_provider:
       module: "matrix_synapse_saml_touchstone.SamlMappingProvider"

Also, under the HTTP client listener, configure an additional_resource as per the below:

listeners:
  - port: <port>
    type: http

    resources:
      - names: [client]

    additional_resources:
      "/_matrix/saml2/pick_displayname":
        module: "matrix_synapse_saml_touchstone.pick_displayname_resource"

Configuration Options

Synapse allows SAML mapping providers to specify custom configuration through the saml2_config.user_mapping_provider.config option.

There are no configuration options supported at the moment.

Implementation notes

The login flow looks something like this:

login flow

Development and Testing

This repository uses tox to run linting and tests.

Linting

Code is linted with the flake8 tool. Run tox -e lint to check for linting errors in the codebase.

Tests

This repository uses unittest to run the tests located in the tests directory. They can be ran with tox -e tests.

Making a release

git tag vX.Y
python3 setup.py sdist
twine upload dist/matrix-synapse-saml-mozilla-X.Y.tar.gz
git push origin vX.Y