mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Enable refreshable tokens on the admin registration endpoint (#16642)
Signed-off-by: Charles Wright <cvwright@futo.org>
This commit is contained in:
parent
f2430b16d1
commit
1a5f9bb651
1
changelog.d/16642.bugfix
Normal file
1
changelog.d/16642.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Enable refreshable tokens on the admin registration endpoint.
|
@ -630,6 +630,12 @@ class UserRegisterServlet(RestServlet):
|
|||||||
if not hmac.compare_digest(want_mac.encode("ascii"), got_mac.encode("ascii")):
|
if not hmac.compare_digest(want_mac.encode("ascii"), got_mac.encode("ascii")):
|
||||||
raise SynapseError(HTTPStatus.FORBIDDEN, "HMAC incorrect")
|
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
|
# Reuse the parts of RegisterRestServlet to reduce code duplication
|
||||||
from synapse.rest.client.register import RegisterRestServlet
|
from synapse.rest.client.register import RegisterRestServlet
|
||||||
|
|
||||||
@ -645,7 +651,9 @@ class UserRegisterServlet(RestServlet):
|
|||||||
approved=True,
|
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
|
return HTTPStatus.OK, result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user