summary refs log tree commit diff
path: root/synapse/module_api
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-03-03 15:20:49 +0000
committerBrendan Abolivier <babolivier@matrix.org>2020-03-03 15:20:49 +0000
commit43f874055d1dfc70496db3c1ac7e962515e4ff94 (patch)
treed7274030db58fdca49cb03c316957d5907fa65e3 /synapse/module_api
parentValidate the alt_aliases property of canonical alias events (#6971) (diff)
parentUpdate debian changelog (diff)
downloadsynapse-43f874055d1dfc70496db3c1ac7e962515e4ff94.tar.xz
Merge branch 'master' into develop
Diffstat (limited to 'synapse/module_api')
-rw-r--r--synapse/module_api/__init__.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py
index d680ee95e1..c7fffd72f2 100644
--- a/synapse/module_api/__init__.py
+++ b/synapse/module_api/__init__.py
@@ -17,6 +17,7 @@ import logging
 
 from twisted.internet import defer
 
+from synapse.http.site import SynapseRequest
 from synapse.logging.context import make_deferred_yieldable, run_in_background
 from synapse.types import UserID
 
@@ -211,3 +212,21 @@ class ModuleApi(object):
             Deferred[object]: result of func
         """
         return self._store.db.runInteraction(desc, func, *args, **kwargs)
+
+    def complete_sso_login(
+        self, registered_user_id: str, request: SynapseRequest, client_redirect_url: str
+    ):
+        """Complete a SSO login by redirecting the user to a page to confirm whether they
+        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.
+
+        Args:
+            registered_user_id: The MXID that has been registered as a previous step of
+                of this SSO login.
+            request: The request to respond to.
+            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, request, client_redirect_url,
+        )