|
|
|
@ -63,7 +63,6 @@ from synapse.http.server import finish_request, respond_with_html |
|
|
|
|
from synapse.http.site import SynapseRequest |
|
|
|
|
from synapse.logging.context import defer_to_thread |
|
|
|
|
from synapse.metrics.background_process_metrics import run_as_background_process |
|
|
|
|
from synapse.storage.roommember import ProfileInfo |
|
|
|
|
from synapse.types import JsonDict, Requester, UserID |
|
|
|
|
from synapse.util import stringutils as stringutils |
|
|
|
|
from synapse.util.async_helpers import delay_cancellation, maybe_awaitable |
|
|
|
@ -1687,41 +1686,10 @@ class AuthHandler: |
|
|
|
|
respond_with_html(request, 403, self._sso_account_deactivated_template) |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
profile = await self.store.get_profileinfo( |
|
|
|
|
user_profile_data = await self.store.get_profileinfo( |
|
|
|
|
UserID.from_string(registered_user_id).localpart |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
self._complete_sso_login( |
|
|
|
|
registered_user_id, |
|
|
|
|
auth_provider_id, |
|
|
|
|
request, |
|
|
|
|
client_redirect_url, |
|
|
|
|
extra_attributes, |
|
|
|
|
new_user=new_user, |
|
|
|
|
user_profile_data=profile, |
|
|
|
|
auth_provider_session_id=auth_provider_session_id, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
def _complete_sso_login( |
|
|
|
|
self, |
|
|
|
|
registered_user_id: str, |
|
|
|
|
auth_provider_id: str, |
|
|
|
|
request: Request, |
|
|
|
|
client_redirect_url: str, |
|
|
|
|
extra_attributes: Optional[JsonDict] = None, |
|
|
|
|
new_user: bool = False, |
|
|
|
|
user_profile_data: Optional[ProfileInfo] = None, |
|
|
|
|
auth_provider_session_id: Optional[str] = None, |
|
|
|
|
) -> None: |
|
|
|
|
""" |
|
|
|
|
The synchronous portion of complete_sso_login. |
|
|
|
|
|
|
|
|
|
This exists purely for backwards compatibility of synapse.module_api.ModuleApi. |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
if user_profile_data is None: |
|
|
|
|
user_profile_data = ProfileInfo(None, None) |
|
|
|
|
|
|
|
|
|
# Store any extra attributes which will be passed in the login response. |
|
|
|
|
# Note that this is per-user so it may overwrite a previous value, this |
|
|
|
|
# is considered OK since the newest SSO attributes should be most valid. |
|
|
|
|