Skip to content
Mozilla flavour of a Synapse SAML mapping provider
Python CSS JavaScript HTML
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
matrix_synapse_saml_mozilla Block new registrations based on a domain blacklist (#2) Jan 17, 2020
.gitignore update gitignore Jan 15, 2020
LICENSE Block new registrations based on a domain blacklist (#2) Jan 17, 2020
tox.ini bump to dev release of synapse Jan 17, 2020

Synapse Mozilla SAML MXID Mapper

A Synapse plugin module which allows users to choose their username when they first log in.


This plugin can be installed via PyPi:

pip install matrix-synapse-saml-mozilla


Add the following in your Synapse config:

       module: "matrix_synapse_saml_mozilla.SamlMappingProvider"

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

  - port: <port>
    type: http

      - names: [client]

        module: "matrix_synapse_saml_mozilla.pick_username_resource"

Configuration Options

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

Currently the following options are supported:

  • use_name_id_for_remote_uid: if set to False, we will use the SAML attribute mapped to uid to identify the remote user instead of the NameID from the assertion. True by default.

  • domain_block_file: should point a file containing a list of domains (one per line); users who have an email address on any of these domains will be blocked from registration.

Implementation notes

The login flow looks something like this:

login flow

Development and Testing

This repository uses tox to run linting and tests.


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


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 sdist
twine upload dist/matrix-synapse-saml-mozilla-X.Y.tar.gz
You can’t perform that action at this time.