summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2021-02-01 13:15:51 +0000
committerGitHub <noreply@github.com>2021-02-01 13:15:51 +0000
commitf78d07bf005f7212bcc74256721677a3b255ea0e (patch)
treebd70a722503feece7aff57df2bc71b25272b95b0 /synapse/http/server.py
parentAdd 'brand' field to MSC2858 response (#9242) (diff)
downloadsynapse-f78d07bf005f7212bcc74256721677a3b255ea0e.tar.xz
Split out a separate endpoint to complete SSO registration (#9262)
There are going to be a couple of paths to get to the final step of SSO reg, and I want the URL in the browser to consistent. So, let's move the final step onto a separate path, which we redirect to.
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r--synapse/http/server.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index d69d579b3a..8249732b27 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -761,6 +761,13 @@ def set_clickjacking_protection_headers(request: Request):
     request.setHeader(b"Content-Security-Policy", b"frame-ancestors 'none';")
 
 
+def respond_with_redirect(request: Request, url: bytes) -> None:
+    """Write a 302 response to the request, if it is still alive."""
+    logger.debug("Redirect to %s", url.decode("utf-8"))
+    request.redirect(url)
+    finish_request(request)
+
+
 def finish_request(request: Request):
     """ Finish writing the response to the request.