From 94ce66f78cbf824c3ac75be04da59cd21aac84c6 Mon Sep 17 00:00:00 2001 From: Emelie Graven Date: Fri, 17 May 2024 14:07:22 +0200 Subject: [PATCH] fix: Use SimpleHttpClient with proxy enabled --- synapse_token_authenticator/token_authenticator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/synapse_token_authenticator/token_authenticator.py b/synapse_token_authenticator/token_authenticator.py index 9b61d7d..ec42419 100644 --- a/synapse_token_authenticator/token_authenticator.py +++ b/synapse_token_authenticator/token_authenticator.py @@ -215,14 +215,15 @@ async def check_oidc_auth( return None token = login_dict["token"] + client = self.api._hs.get_proxied_http_client() oidc = self.config.oidc - oidc_metadata = await get_oidp_metadata(oidc.issuer, self.api.http_client) + oidc_metadata = await get_oidp_metadata(oidc.issuer, client) # Further validation using token introspection data = {"token": token, "token_type_hint": "access_token", "scope": "openid"} try: - introspection_resp = await self.api.http_client.post_json_get_json( + introspection_resp = await client.post_json_get_json( oidc_metadata.introspection_endpoint, data, headers=basic_auth(oidc.client_id, oidc.client_secret), @@ -303,6 +304,8 @@ async def check_custom_flow( return None token = login_dict["token"] + client = self.api._hs.get_proxied_http_client() + check_claims = {} user_id_str = self.api.get_qualified_user_id(username) @@ -350,7 +353,7 @@ async def check_custom_flow( ] } - await self.api.http_client.post_json_get_json( + await client.post_json_get_json( self.config.custom_flow.notify_on_registration_uri, {"token": login_dict["token"]}, headers=headers,