Skip to content

Commit

Permalink
Allow RedirectResponse in SAML response handler
Browse files Browse the repository at this point in the history
Allow custom SAML handlers to redirect after processing an auth response.

Fixes matrix-org#7149

Signed-off-by: Jason Robinson <jasonr@matrix.org>
  • Loading branch information
jaywink authored and phil-flex committed Jun 16, 2020
1 parent 7f979f3 commit b0513a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/7151.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow custom SAML handlers to redirect after processing an auth response.
4 changes: 4 additions & 0 deletions synapse/handlers/saml_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from synapse.http.server import finish_request
from synapse.http.servlet import parse_string
from synapse.module_api import ModuleApi
from synapse.module_api.errors import RedirectException
from synapse.types import (
UserID,
map_username_to_mxid_localpart,
Expand Down Expand Up @@ -119,6 +120,9 @@ async def handle_saml_response(self, request):

try:
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:
# If decoding the response or mapping it to a user failed, then log the
# error and tell the user that something went wrong.
Expand Down

0 comments on commit b0513a3

Please sign in to comment.