diff options
author | Richard van der Hoff <richard@matrix.org> | 2021-02-26 14:05:00 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2021-02-26 14:05:00 +0000 |
commit | 0e56f02d5d8346f9bacd449d25c5ff7921943ef0 (patch) | |
tree | 902fab6f9363ed34903cc080a5e0656153283fe8 | |
parent | Revert "more login hacking" (diff) | |
download | synapse-0e56f02d5d8346f9bacd449d25c5ff7921943ef0.tar.xz |
Revert "Redirect redirect requests if they arrive on the wrong URI"
This reverts commit 5ee8a1c50a1b571a8a8704a59635232193b454f2. This has now been superceded on develop by PR #9436.
-rw-r--r-- | synapse/rest/client/v1/login.py | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/synapse/rest/client/v1/login.py b/synapse/rest/client/v1/login.py index 3e6a21e20f..6e2fbedd99 100644 --- a/synapse/rest/client/v1/login.py +++ b/synapse/rest/client/v1/login.py @@ -354,7 +354,6 @@ class SsoRedirectServlet(RestServlet): hs.get_oidc_handler() self._sso_handler = hs.get_sso_handler() self._msc2858_enabled = hs.config.experimental.msc2858_enabled - self._public_baseurl = hs.config.public_baseurl def register(self, http_server: HttpServer) -> None: super().register(http_server) @@ -374,28 +373,6 @@ class SsoRedirectServlet(RestServlet): async def on_GET( self, request: SynapseRequest, idp_id: Optional[str] = None ) -> None: - if not self._public_baseurl: - raise SynapseError(400, "SSO requires a valid public_baseurl") - - # if this isn't the expected hostname, redirect to the right one, so that we - # get our cookies back. - requested_uri = b"%s://%s%s" % ( - b"https" if request.isSecure() else b"http", - request.getHeader(b"host"), - request.uri, - ) - baseurl_bytes = self._public_baseurl.encode("utf-8") - if not requested_uri.startswith(baseurl_bytes): - i = requested_uri.index(b"/_matrix") - new_uri = baseurl_bytes[:-1] + requested_uri[i:] - logger.info( - "Requested URI %s is not canonical: redirecting to %s", - requested_uri.decode("utf-8", errors="replace"), - new_uri.decode("utf-8", errors="replace"), - ) - request.redirect(new_uri) - finish_request(request) - client_redirect_url = parse_string( request, "redirectUrl", required=True, encoding=None ) |