From b2c1fee672f3246963341e90ebf47888a46bbde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Wed, 12 Jan 2022 16:21:17 +0100 Subject: [PATCH] __matrix_synapse: add --saml2-mapping-provider-module flag --- type/__matrix_synapse/files/homeserver.yaml.sh | 8 ++++++++ type/__matrix_synapse/man.rst | 3 +++ type/__matrix_synapse/manifest | 5 +++++ type/__matrix_synapse/parameter/optional | 1 + 4 files changed, 17 insertions(+) diff --git a/type/__matrix_synapse/files/homeserver.yaml.sh b/type/__matrix_synapse/files/homeserver.yaml.sh index 6437f1b..be924d3 100755 --- a/type/__matrix_synapse/files/homeserver.yaml.sh +++ b/type/__matrix_synapse/files/homeserver.yaml.sh @@ -1808,7 +1808,15 @@ cat << EOF # The custom module's class. Uncomment to use a custom module. # #module: mapping_provider.SamlMappingProvider +EOF +if [ -n "$SAML2_MAPPING_PROVIDER_MODULE" ]; then + cat << EOF + module: "$SAML2_MAPPING_PROVIDER_MODULE" +EOF +fi + +cat << EOF # Custom configuration values for the module. Below options are # intended for the built-in provider, they should be changed if # using a custom module. This section will be passed as a Python diff --git a/type/__matrix_synapse/man.rst b/type/__matrix_synapse/man.rst index dbcc993..ace5ce0 100644 --- a/type/__matrix_synapse/man.rst +++ b/type/__matrix_synapse/man.rst @@ -198,6 +198,9 @@ saml2-sp-key saml2-sp-cert Path to PEM-formatted cert file for use by PySAML2. +saml2-mapping-provider-module + Name of custom Python module used to map SAML2 attributes to synapse internals. + extra-setting Arbitrary string to be added to the configuration file. Can be specified multiple times. diff --git a/type/__matrix_synapse/manifest b/type/__matrix_synapse/manifest index 70232a8..12f27ff 100755 --- a/type/__matrix_synapse/manifest +++ b/type/__matrix_synapse/manifest @@ -210,6 +210,11 @@ if [ -f "$__object/parameter/saml2-sp-cert" ]; then export SAML2_SP_CERT fi +if [ -f "$__object/parameter/saml2-mapping-provider-module" ]; then + SAML2_MAPPING_PROVIDER_MODULE=$(cat "$__object/parameter/saml2-mapping-provider-module") + export SAML2_MAPPING_PROVIDER_MODULE +fi + if [ -n "$SAML2_SP_KEY" ] && [ -z "$SAML2_SP_CERT" ]; then echo "--saml2-sp-cert must be set if --saml2-sp-key is provided." >&2 exit 1 diff --git a/type/__matrix_synapse/parameter/optional b/type/__matrix_synapse/parameter/optional index be44ca7..2e265e9 100644 --- a/type/__matrix_synapse/parameter/optional +++ b/type/__matrix_synapse/parameter/optional @@ -40,3 +40,4 @@ saml2-idp-metadata-url saml2-sp-key saml2-sp-cert default-identity-server +saml2-mapping-provider-module