summary refs log tree commit diff
path: root/synapse/rest/client/auth_issuer.py
diff options
context:
space:
mode:
authorQuentin Gliech <quenting@element.io>2024-08-30 16:04:08 +0200
committerGitHub <noreply@github.com>2024-08-30 14:04:08 +0000
commitca69d0f57165ecb10204ee433992b20af71cbe91 (patch)
treeb8914884249e221756efbe607a2b968eddbd1ce7 /synapse/rest/client/auth_issuer.py
parentUse custom stage UIA error for MAS cross-signing reset (#17509) (diff)
downloadsynapse-ca69d0f57165ecb10204ee433992b20af71cbe91.tar.xz
MSC3861: load the issuer and account management URLs from OIDC discovery (#17407)
This will help mitigating any discrepancies between the issuer
configured and the one returned by the OIDC provider.

This also removes the need for configuring the `account_management_url`
explicitely, as it will now be loaded from the OIDC discovery, as per
MSC2965.

Because we may now fetch stuff for the .well-known/matrix/client
endpoint, this also transforms the client well-known resource to be
asynchronous.
Diffstat (limited to 'synapse/rest/client/auth_issuer.py')
-rw-r--r--synapse/rest/client/auth_issuer.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/rest/client/auth_issuer.py b/synapse/rest/client/auth_issuer.py

index 77b9720956..acd0399d85 100644 --- a/synapse/rest/client/auth_issuer.py +++ b/synapse/rest/client/auth_issuer.py
@@ -13,7 +13,7 @@ # limitations under the License. import logging import typing -from typing import Tuple +from typing import Tuple, cast from synapse.api.errors import Codes, SynapseError from synapse.http.server import HttpServer @@ -43,10 +43,16 @@ class AuthIssuerServlet(RestServlet): def __init__(self, hs: "HomeServer"): super().__init__() self._config = hs.config + self._auth = hs.get_auth() async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: if self._config.experimental.msc3861.enabled: - return 200, {"issuer": self._config.experimental.msc3861.issuer} + # If MSC3861 is enabled, we can assume self._auth is an instance of MSC3861DelegatedAuth + # We import lazily here because of the authlib requirement + from synapse.api.auth.msc3861_delegated import MSC3861DelegatedAuth + + auth = cast(MSC3861DelegatedAuth, self._auth) + return 200, {"issuer": await auth.issuer()} else: # Wouldn't expect this to be reached: the servelet shouldn't have been # registered. Still, fail gracefully if we are registered for some reason.