Skip to content

Commit

Permalink
fix: Use SimpleHttpClient with proxy enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
emgrav committed May 17, 2024
1 parent 3b89a3a commit 94ce66f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions synapse_token_authenticator/token_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 94ce66f

Please sign in to comment.