diff options
author | reivilibre <oliverw@matrix.org> | 2021-12-06 19:11:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 19:11:43 +0000 |
commit | 2f053f3f82ca174cc1c858c75afffae51af8ce0d (patch) | |
tree | 668444355e50899c87dcbdd09c4641380cad0537 /synapse/rest/client/register.py | |
parent | Save the OIDC session ID (sid) with the device on login (#11482) (diff) | |
download | synapse-2f053f3f82ca174cc1c858c75afffae51af8ce0d.tar.xz |
Stabilise support for MSC2918 refresh tokens as they have now been merged into the Matrix specification. (#11435)
Diffstat (limited to 'synapse/rest/client/register.py')
-rw-r--r-- | synapse/rest/client/register.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/synapse/rest/client/register.py b/synapse/rest/client/register.py index 11fd6cd24d..8b56c76aed 100644 --- a/synapse/rest/client/register.py +++ b/synapse/rest/client/register.py @@ -419,7 +419,7 @@ class RegisterRestServlet(RestServlet): self.password_policy_handler = hs.get_password_policy_handler() self.clock = hs.get_clock() self._registration_enabled = self.hs.config.registration.enable_registration - self._msc2918_enabled = ( + self._refresh_tokens_enabled = ( hs.config.registration.refreshable_access_token_lifetime is not None ) @@ -445,18 +445,15 @@ class RegisterRestServlet(RestServlet): f"Do not understand membership kind: {kind}", ) - if self._msc2918_enabled: - # Check if this registration should also issue a refresh token, as - # per MSC2918 - should_issue_refresh_token = body.get( - "org.matrix.msc2918.refresh_token", False - ) - if not isinstance(should_issue_refresh_token, bool): - raise SynapseError( - 400, "`org.matrix.msc2918.refresh_token` should be true or false." - ) - else: - should_issue_refresh_token = False + # Check if the clients wishes for this registration to issue a refresh + # token. + client_requested_refresh_tokens = body.get("refresh_token", False) + if not isinstance(client_requested_refresh_tokens, bool): + raise SynapseError(400, "`refresh_token` should be true or false.") + + should_issue_refresh_token = ( + self._refresh_tokens_enabled and client_requested_refresh_tokens + ) # Pull out the provided username and do basic sanity checks early since # the auth layer will store these in sessions. |