From c900d18647b7ad787c6df5a9a83b225758161c4e Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 26 Mar 2024 13:26:46 +0000 Subject: [PATCH] Fix OIDC login regression (#17031) Requests may require a User-Agent header, and the change in #16972 accidentally removed it, resulting in requests getting rejected causing login to fail. --- changelog.d/17031.feature | 1 + synapse/http/client.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 changelog.d/17031.feature diff --git a/changelog.d/17031.feature b/changelog.d/17031.feature new file mode 100644 index 0000000000..0f28cbbcd6 --- /dev/null +++ b/changelog.d/17031.feature @@ -0,0 +1 @@ +OIDC: try to JWT decode userinfo response if JSON parsing failed. diff --git a/synapse/http/client.py b/synapse/http/client.py index 08a8634dae..4718517c97 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -390,6 +390,13 @@ class BaseHttpClient: cooperator=self._cooperator, ) + # Always make sure we add a user agent to the request + if headers is None: + headers = Headers() + + if not headers.hasHeader("User-Agent"): + headers.addRawHeader("User-Agent", self.user_agent) + request_deferred: defer.Deferred = treq.request( method, uri,