summary refs log tree commit diff
path: root/synapse/handlers/oidc.py
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2025-03-03 09:40:48 +0000
committerGitHub <noreply@github.com>2025-03-03 09:40:48 +0000
commit154e23f6d76277cc8012dc7a5dfa5f22d62b9133 (patch)
treed14e0783d26f256962760c77a278aae3a5aec594 /synapse/handlers/oidc.py
parentAdd worker_replication_secret_path config option (#18191) (diff)
downloadsynapse-154e23f6d76277cc8012dc7a5dfa5f22d62b9133.tar.xz
Add `redirect_uri` option to `oidc_providers` entries (#18197)
Allows overriding the `redirect_uri` parameter sent to both the
authorization and token endpoints of the IdP. Typically this parameter
is hardcoded to `<public_baseurl>/_synapse/client/oidc/callback`.

Yet it can be useful in certain contexts to allow a different callback
URL. For instance, if you would like to intercept the authorization code
returned from the IdP and do something with it, before eventually
calling Synapse's OIDC callback URL yourself.

This change enables enterprise use cases but does not change the default
behaviour.

---

Best reviewed commit-by-commit.

---------

Co-authored-by: Eric Eastwood <erice@element.io>
Diffstat (limited to 'synapse/handlers/oidc.py')
-rw-r--r--synapse/handlers/oidc.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/handlers/oidc.py b/synapse/handlers/oidc.py

index 76b692928d..18efdd9f6e 100644 --- a/synapse/handlers/oidc.py +++ b/synapse/handlers/oidc.py
@@ -382,7 +382,12 @@ class OidcProvider: self._macaroon_generaton = macaroon_generator self._config = provider - self._callback_url: str = hs.config.oidc.oidc_callback_url + + self._callback_url: str + if provider.redirect_uri is not None: + self._callback_url = provider.redirect_uri + else: + self._callback_url = hs.config.oidc.oidc_callback_url # Calculate the prefix for OIDC callback paths based on the public_baseurl. # We'll insert this into the Path= parameter of any session cookies we set.