summary refs log tree commit diff
path: root/synapse/config/registration.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2021-06-29 11:27:25 +0100
committerRichard van der Hoff <richard@matrix.org>2021-06-29 11:27:25 +0100
commit077d441d42a34c994a3eeeaa2068b837a96e5a7c (patch)
treef6e387b9288d7f932c618aa2983cc75b6f28facd /synapse/config/registration.py
parentFix SQL (diff)
parentMigrate stream_ordering to a bigint (#10264) (diff)
downloadsynapse-077d441d42a34c994a3eeeaa2068b837a96e5a7c.tar.xz
Merge branch 'develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/config/registration.py')
-rw-r--r--synapse/config/registration.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/synapse/config/registration.py b/synapse/config/registration.py

index d9dc55a0c3..0ad919b139 100644 --- a/synapse/config/registration.py +++ b/synapse/config/registration.py
@@ -119,6 +119,27 @@ class RegistrationConfig(Config): session_lifetime = self.parse_duration(session_lifetime) self.session_lifetime = session_lifetime + # The `access_token_lifetime` applies for tokens that can be renewed + # using a refresh token, as per MSC2918. If it is `None`, the refresh + # token mechanism is disabled. + # + # Since it is incompatible with the `session_lifetime` mechanism, it is set to + # `None` by default if a `session_lifetime` is set. + access_token_lifetime = config.get( + "access_token_lifetime", "5m" if session_lifetime is None else None + ) + if access_token_lifetime is not None: + access_token_lifetime = self.parse_duration(access_token_lifetime) + self.access_token_lifetime = access_token_lifetime + + if session_lifetime is not None and access_token_lifetime is not None: + raise ConfigError( + "The refresh token mechanism is incompatible with the " + "`session_lifetime` option. Consider disabling the " + "`session_lifetime` option or disabling the refresh token " + "mechanism by removing the `access_token_lifetime` option." + ) + # The success template used during fallback auth. self.fallback_success_template = self.read_template("auth_success.html")