From b1cb69720609b6915b80b256def694fe487cd60a Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Thu, 27 Feb 2020 23:07:59 +0000 Subject: [PATCH] Use complete_sso_login from Synapse instead of re-implementing it --- matrix_synapse_saml_mozilla/username_picker.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/matrix_synapse_saml_mozilla/username_picker.py b/matrix_synapse_saml_mozilla/username_picker.py index ddd689e..7990d4b 100644 --- a/matrix_synapse_saml_mozilla/username_picker.py +++ b/matrix_synapse_saml_mozilla/username_picker.py @@ -171,13 +171,6 @@ class SubmitResource(AsyncResource): del username_mapping_sessions[session_id] - login_token = self._module_api.generate_short_term_login_token( - registered_user_id - ) - redirect_url = _add_login_token_to_redirect_url( - session.client_redirect_url, login_token - ) - # delete the cookie request.addCookie( SESSION_COOKIE_NAME, @@ -185,8 +178,12 @@ class SubmitResource(AsyncResource): expires=b"Thu, 01 Jan 1970 00:00:00 GMT", path=b"/", ) - request.redirect(redirect_url) - request.finish() + + self._module_api.complete_sso_login( + registered_user_id, + request, + session.client_redirect_url, + ) class AvailabilityCheckResource(AsyncResource):