Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Remove the complete_sso_login method from the Module API which was deprecated in Synapse 1.13.0. #13843

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13843.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the `complete_sso_login` method from the Module API which was deprecated in Synapse 1.13.0.
sandhose marked this conversation as resolved.
Show resolved Hide resolved
34 changes: 1 addition & 33 deletions synapse/handlers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
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
Expand Down Expand Up @@ -1687,41 +1686,10 @@ async def complete_sso_login(
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.
Expand Down
9 changes: 3 additions & 6 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ def complete_sso_login(
want their access token sent to `client_redirect_url`, or redirect them to that
URL with a token directly if the URL matches with one of the whitelisted clients.
This is deprecated in favor of complete_sso_login_async.
This was removed in favor of complete_sso_login_async in Synapse 1.68.0.
Added in Synapse v1.11.1.
Expand All @@ -854,11 +854,8 @@ def complete_sso_login(
client_redirect_url: The URL to which to offer to redirect the user (or to
redirect them directly if whitelisted).
"""
self._auth_handler._complete_sso_login(
registered_user_id,
"<unknown>",
request,
client_redirect_url,
raise Exception(
"ModuleApi.complete_sso_login is deprecated in favor of ModuleApi.complete_sso_login_async"
sandhose marked this conversation as resolved.
Show resolved Hide resolved
)

async def complete_sso_login_async(
Expand Down