From 974e42e20e00a7e1dcf26d40aef5cc1aa34365df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Sun, 16 Jan 2022 12:41:03 +0100 Subject: [PATCH] __matrix_synapse: add --saml2-mapping-provider-extra-settings flag --- type/__matrix_synapse/files/homeserver.yaml.sh | 11 +++++++++++ type/__matrix_synapse/man.rst | 4 ++++ type/__matrix_synapse/manifest | 5 +++++ type/__matrix_synapse/parameter/optional_multiple | 1 + 4 files changed, 21 insertions(+) diff --git a/type/__matrix_synapse/files/homeserver.yaml.sh b/type/__matrix_synapse/files/homeserver.yaml.sh index be924d3..d8e6653 100755 --- a/type/__matrix_synapse/files/homeserver.yaml.sh +++ b/type/__matrix_synapse/files/homeserver.yaml.sh @@ -1846,6 +1846,17 @@ cat << EOF # value will be used instead. # #mxid_mapping: dotreplace +EOF + +if [ -n "$SAML2_MAPPING_PROVIDER_EXTRA_CONFIG" ]; then + echo "$SAML2_MAPPING_PROVIDER_EXTRA_CONFIG" | while IFS= read -r entry; do + cat << EOF + $entry +EOF + done +fi + +cat << EOF # In previous versions of synapse, the mapping from SAML attribute to # MXID was always calculated dynamically rather than stored in a diff --git a/type/__matrix_synapse/man.rst b/type/__matrix_synapse/man.rst index ace5ce0..7da9282 100644 --- a/type/__matrix_synapse/man.rst +++ b/type/__matrix_synapse/man.rst @@ -201,6 +201,10 @@ saml2-sp-cert saml2-mapping-provider-module Name of custom Python module used to map SAML2 attributes to synapse internals. +saml2-mapping-provider-extra-settings + Extra YAML-formatted key/pair values provided as configuration to the SAML2 + mapping provider module (e.g. 'key: value'). Can be specified multiple times. + 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 3d62a13..5a9871d 100755 --- a/type/__matrix_synapse/manifest +++ b/type/__matrix_synapse/manifest @@ -215,6 +215,11 @@ if [ -f "$__object/parameter/saml2-mapping-provider-module" ]; then export SAML2_MAPPING_PROVIDER_MODULE fi +if [ -f "$__object/parameter/saml2-mapping-provider-extra-config" ]; then + SAML2_MAPPING_PROVIDER_EXTRA_CONFIG=$(cat "$__object/parameter/saml2-mapping-provider-extra-config") + export SAML2_MAPPING_PROVIDER_EXTRA_CONFIG +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_multiple b/type/__matrix_synapse/parameter/optional_multiple index 8871dd6..dfd69cb 100644 --- a/type/__matrix_synapse/parameter/optional_multiple +++ b/type/__matrix_synapse/parameter/optional_multiple @@ -5,3 +5,4 @@ app-service-config-file extra-setting bind-address outbound-federation-worker +saml2-mapping-provider-extra-config