summary refs log tree commit diff
path: root/synapse/handlers/oidc_handler.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-08-03 16:35:24 -0700
committerAndrew Morgan <andrew@amorgan.xyz>2020-08-03 16:35:24 -0700
commit678f9fb88ee72c332317d9a0ba5e2cc75d1ace2c (patch)
tree500977c0321bde0658e92a6087645327e7517eab /synapse/handlers/oidc_handler.py
parentMerge commit 'dc80a0762' into dinsic (diff)
parent1.15.2 (diff)
downloadsynapse-678f9fb88ee72c332317d9a0ba5e2cc75d1ace2c.tar.xz
Merge commit 'e8c36e527' into dinsic
* commit 'e8c36e527':
  1.15.2
  Correctly handle outliers as prev events over federation
  Ensure that HTML pages served from Synapse include headers to avoid embedding.
Diffstat (limited to 'synapse/handlers/oidc_handler.py')
-rw-r--r--synapse/handlers/oidc_handler.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/synapse/handlers/oidc_handler.py b/synapse/handlers/oidc_handler.py

index 9c08eb5399..87f0c5e197 100644 --- a/synapse/handlers/oidc_handler.py +++ b/synapse/handlers/oidc_handler.py
@@ -35,7 +35,7 @@ from typing_extensions import TypedDict from twisted.web.client import readBody from synapse.config import ConfigError -from synapse.http.server import finish_request +from synapse.http.server import respond_with_html from synapse.http.site import SynapseRequest from synapse.logging.context import make_deferred_yieldable from synapse.push.mailer import load_jinja2_templates @@ -144,15 +144,10 @@ class OidcHandler: access_denied. error_description: A human-readable description of the error. """ - html_bytes = self._error_template.render( + html = self._error_template.render( error=error, error_description=error_description - ).encode("utf-8") - - request.setResponseCode(400) - request.setHeader(b"Content-Type", b"text/html; charset=utf-8") - request.setHeader(b"Content-Length", b"%i" % len(html_bytes)) - request.write(html_bytes) - finish_request(request) + ) + respond_with_html(request, 400, html) def _validate_metadata(self): """Verifies the provider metadata.