diff options
author | Charles Wright <cvwright@futo.org> | 2023-11-22 09:01:09 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 15:01:09 +0000 |
commit | 1a5f9bb651d00bd12cdfc5fbf52086d8101695c5 (patch) | |
tree | 7d8afb1a596f51d1a33cd58816698b9ac0a09eb3 | |
parent | Bump pyo3 (0.20), pythonize (0.20), pyo3-log (0.9) (#16673) (diff) | |
download | synapse-1a5f9bb651d00bd12cdfc5fbf52086d8101695c5.tar.xz |
Enable refreshable tokens on the admin registration endpoint (#16642)
Signed-off-by: Charles Wright <cvwright@futo.org>
-rw-r--r-- | changelog.d/16642.bugfix | 1 | ||||
-rw-r--r-- | synapse/rest/admin/users.py | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/changelog.d/16642.bugfix b/changelog.d/16642.bugfix new file mode 100644 index 0000000000..e83c8b4f9d --- /dev/null +++ b/changelog.d/16642.bugfix @@ -0,0 +1 @@ +Enable refreshable tokens on the admin registration endpoint. diff --git a/synapse/rest/admin/users.py b/synapse/rest/admin/users.py index 9900498fbe..77446970cb 100644 --- a/synapse/rest/admin/users.py +++ b/synapse/rest/admin/users.py @@ -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 |