Browse Source

Enable refreshable tokens on the admin registration endpoint (#16642)

Signed-off-by: Charles Wright <cvwright@futo.org>
tags/v1.98.0rc1
Charles Wright 5 months ago
committed by GitHub
parent
commit
1a5f9bb651
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions
  1. +1
    -0
      changelog.d/16642.bugfix
  2. +9
    -1
      synapse/rest/admin/users.py

+ 1
- 0
changelog.d/16642.bugfix View File

@@ -0,0 +1 @@
Enable refreshable tokens on the admin registration endpoint.

+ 9
- 1
synapse/rest/admin/users.py View File

@@ -630,6 +630,12 @@ class UserRegisterServlet(RestServlet):
if not hmac.compare_digest(want_mac.encode("ascii"), got_mac.encode("ascii")):
raise SynapseError(HTTPStatus.FORBIDDEN, "HMAC incorrect")

should_issue_refresh_token = body.get("refresh_token", False)
if not isinstance(should_issue_refresh_token, bool):
raise SynapseError(
HTTPStatus.BAD_REQUEST, "refresh_token must be a boolean"
)

# Reuse the parts of RegisterRestServlet to reduce code duplication
from synapse.rest.client.register import RegisterRestServlet

@@ -645,7 +651,9 @@ class UserRegisterServlet(RestServlet):
approved=True,
)

result = await register._create_registration_details(user_id, body)
result = await register._create_registration_details(
user_id, body, should_issue_refresh_token=should_issue_refresh_token
)
return HTTPStatus.OK, result




Loading…
Cancel
Save