mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-25 11:45:30 +00:00
Allow RedirectResponse in SAML response handler
Allow custom SAML handlers to redirect after processing an auth response. Fixes #7149 Signed-off-by: Jason Robinson <jasonr@matrix.org>
This commit is contained in:
parent
1c1242acba
commit
060e7dce09
1
changelog.d/7151.bugfix
Normal file
1
changelog.d/7151.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Allow custom SAML handlers to redirect after processing an auth response.
|
@ -26,6 +26,7 @@ from synapse.config import ConfigError
|
|||||||
from synapse.http.server import finish_request
|
from synapse.http.server import finish_request
|
||||||
from synapse.http.servlet import parse_string
|
from synapse.http.servlet import parse_string
|
||||||
from synapse.module_api import ModuleApi
|
from synapse.module_api import ModuleApi
|
||||||
|
from synapse.module_api.errors import RedirectException
|
||||||
from synapse.types import (
|
from synapse.types import (
|
||||||
UserID,
|
UserID,
|
||||||
map_username_to_mxid_localpart,
|
map_username_to_mxid_localpart,
|
||||||
@ -119,6 +120,9 @@ class SamlHandler:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
user_id = await self._map_saml_response_to_user(resp_bytes, relay_state)
|
user_id = await self._map_saml_response_to_user(resp_bytes, relay_state)
|
||||||
|
except RedirectException:
|
||||||
|
# Raise the exception as per the wishes of the SAML module response
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If decoding the response or mapping it to a user failed, then log the
|
# If decoding the response or mapping it to a user failed, then log the
|
||||||
# error and tell the user that something went wrong.
|
# error and tell the user that something went wrong.
|
||||||
|
Loading…
Reference in New Issue
Block a user