Bläddra i källkod

add open id connect configuration to synapse template

pull/797/head
Klaus Schwartz 5 år sedan
förälder
incheckning
f298e00deb
2 ändrade filer med 47 tillägg och 4 borttagningar
  1. +40
    -0
      roles/matrix-synapse/defaults/main.yml
  2. +7
    -4
      roles/matrix-synapse/templates/synapse/homeserver.yaml.j2

+ 40
- 0
roles/matrix-synapse/defaults/main.yml Visa fil

@@ -426,3 +426,43 @@ matrix_synapse_configuration_extension: "{{ matrix_synapse_configuration_extensi
# Holds the final Synapse configuration (a combination of the default and its extension). # Holds the final Synapse configuration (a combination of the default and its extension).
# You most likely don't need to touch this variable. Instead, see `matrix_synapse_configuration_yaml`. # You most likely don't need to touch this variable. Instead, see `matrix_synapse_configuration_yaml`.
matrix_synapse_configuration: "{{ matrix_synapse_configuration_yaml|from_yaml|combine(matrix_synapse_configuration_extension, recursive=True) }}" matrix_synapse_configuration: "{{ matrix_synapse_configuration_yaml|from_yaml|combine(matrix_synapse_configuration_extension, recursive=True) }}"


# oidc / sso

# Set to false if you need only SSO auth
matrix_synapse_password_config_enabled: true


# Configure open id connect
matrix_synapse_oidc_enabled: false
matrix_synapse_oidc_issuer: ""
matrix_synapse_oidc_client_id: ""
matrix_synapse_oidc_client_secret: ""
matrix_synapse_oidc_scopes: ["openid"]
matrix_synapse_oidc_allow_existing_users: false
matrix_synapse_oidc_client_auth_method: client_secret_basic
matrix_synapse_oidc_subject_claim: "sub"
matrix_synapse_oidc_localpart_template: "{% raw %}{{ user.preferred_username }}{% endraw %}"
matrix_synapse_oidc_display_name_template: "{% raw %}{{ user.name }}{% endraw %}"


# see https://github.com/matrix-org/synapse/blob/develop/docs/openid.md
matrix_synapse_oidc_config:
enabled: "{{ matrix_synapse_oidc_enabled }}"
issuer: "{{ matrix_synapse_oidc_issuer }}"
client_id: "{{ matrix_synapse_oidc_client_id }}"
client_secret: "{{ matrix_synapse_oidc_client_secret }}"
scopes: "{{ matrix_synapse_oidc_scopes }}"
allow_existing_users: "{{ matrix_synapse_oidc_allow_existing_users }}"
client_auth_method: "{{ matrix_synapse_oidc_client_auth_method }}"
user_mapping_provider:
config:
subject_claim: "{{ matrix_synapse_oidc_subject_claim }}"
localpart_template: "{{ matrix_synapse_oidc_localpart_template }}"
display_name_template: "{{ matrix_synapse_oidc_display_name_template }}"

# Set trusted SSO resources, e.g. [ "https://element.matrix.domain" ]
matrix_synapse_sso:
client_whitelist: ["{{https://element.matrix.domain}}"]


+ 7
- 4
roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 Visa fil

@@ -1660,6 +1660,7 @@ saml2_config:
#idp_entityid: 'https://our_idp/entityid' #idp_entityid: 'https://our_idp/entityid'




{% if not matrix_synapse_oidc_config.enabled %}
# Enable OpenID Connect (OIDC) / OAuth 2.0 for registration and login. # Enable OpenID Connect (OIDC) / OAuth 2.0 for registration and login.
# #
# See https://github.com/matrix-org/synapse/blob/master/docs/openid.md # See https://github.com/matrix-org/synapse/blob/master/docs/openid.md
@@ -1793,8 +1794,10 @@ oidc_config:
# #
#extra_attributes: #extra_attributes:
#birthdate: "{% raw %}{{ user.birthdate }}{% endraw %}" #birthdate: "{% raw %}{{ user.birthdate }}{% endraw %}"


{% endif %}
{% if matrix_synapse_oidc_config.enabled %}
oidc_config: {{ matrix_synapse_oidc_config }}
{% endif %}


# Enable Central Authentication Service (CAS) for registration and login. # Enable Central Authentication Service (CAS) for registration and login.
# #
@@ -1849,7 +1852,7 @@ sso:
# #
# By default, this list is empty. # By default, this list is empty.
# #
#client_whitelist:
client_whitelist: {{ matrix_synapse_sso.client_whitelist|to_json }}
# - https://riot.im/develop # - https://riot.im/develop
# - https://my.custom.client/ # - https://my.custom.client/


@@ -1974,7 +1977,7 @@ sso:
password_config: password_config:
# Uncomment to disable password login # Uncomment to disable password login
# #
#enabled: false
enabled: {{ matrix_synapse_password_config_enabled|to_json }}


# Uncomment to disable authentication against the local password # Uncomment to disable authentication against the local password
# database. This is ignored if `enabled` is false, and is only useful # database. This is ignored if `enabled` is false, and is only useful


Laddar…
Avbryt
Spara