synapse/handlers/auth.py
def validate_user_via_ui_auth(self, requester, request_body, clientip):
        """
        Checks that the user is who they claim to be, via a UI auth.

        This is used for things like device deletion and password reset where
        the user already has a valid access token, but we want to double-check
        that it isn't stolen by re-authenticating them.

        Args:
            requester (Requester): The user, as given by the access token

            request_body (dict): The body of the request sent by the client

            clientip (str): The IP address of the client.

        Returns:
            defer.Deferred[dict]: the parameters for this request (which may
                have been given only in a previous call).

        Raises:
            InteractiveAuthIncompleteError if the client has not yet completed
                any of the permitted login flows

            AuthError if the client has completed a login flow, and it gives
                a different user to `requester`
        """

        # build a list of supported flows
        flows = [
            [login_type] for login_type in self._supported_login_types
        ]

        result, params, _ = yield self.check_auth(
            flows, request_body, clientip,
        )

        # find the completed login type
        for login_type in self._supported_login_types:
            if login_type not in result:
                continue

            user_id = result[login_type]
            break
        else:
            # this can't happen
            raise Exception(
                "check_auth returned True but no successful login type",
            )

        # check that the UI auth matched the access token
        if user_id != requester.user.to_string():
            raise AuthError(403, "Invalid auth")

        defer.returnValue(params)

        Checks that the user is who they claim to be, via a UI auth.

        This is used for things like device deletion and password reset where
        the user already has a valid access token, but we want to double-check
        that it isn't stolen by re-authenticating them.

        Args:
            requester (Requester): The user, as given by the access token

            request_body (dict): The body of the request sent by the client

            clientip (str): The IP address of the client.

        Returns:
            defer.Deferred[dict]: the parameters for this request (which may
                have been given only in a previous call).

        Raises:
            InteractiveAuthIncompleteError if the client has not yet completed
                any of the permitted login flows

            AuthError if the client has completed a login flow, and it gives
                a different user to `requester`
        
Checks that the user is who they claim to be, via a UI auth.
This is used for things like device deletion and password reset where
the user already has a valid access token, but we want to double-check
that it isn't stolen by re-authenticating them.

requester (Requester): The user, as given by the access token

request_body (dict): The body of the request sent by the client

clientip (str): The IP address of the client.

defer.Deferred[dict]: the parameters for this request (which may
have been given only in a previous call).

InteractiveAuthIncompleteError if the client has not yet completed
any of the permitted login flows

AuthError if the client has completed a login flow, and it gives
a different user to `requester`
Checks that the user is who they claim to be via a UI auth . This is used for things like device deletion and password reset where the user already has a valid access token but we want to double - check that it isn ' t stolen by re - authenticating them . requester ( Requester ) : The user as given by the access token request_body ( dict ) : The body of the request sent by the client clientip ( str ) : The IP address of the client . defer . Deferred [ dict ] : the parameters for this request ( which may have been given only in a previous call ) . InteractiveAuthIncompleteError if the client has not yet completed any of the permitted login flows AuthError if the client has completed a login flow and it gives a different user to ` requester `
def validate_user_via_ui_auth(self, requester, request_body, clientip):
        flows = [
            [login_type] for login_type in self._supported_login_types
        ]
        result, params, _ = yield self.check_auth(
            flows, request_body, clientip,
        )
        for login_type in self._supported_login_types:
            if login_type not in result:
                continue
            user_id = result[login_type]
            break
        else:
            raise Exception(
                "check_auth returned True but no successful login type",
            )
        if user_id != requester.user.to_string():
            raise AuthError(403, "Invalid auth")
        defer.returnValue(params)
def validate_user_via_ui_auth ( self , requester , request_body , clientip ) : flows = [ [ login_type ] for login_type in self . _supported_login_types ] result , params , _ = yield self . check_auth ( flows , request_body , clientip , ) for login_type in self . _supported_login_types : if login_type not in result : continue user_id = result [ login_type ] break else : raise Exception ( "check_auth returned True but no successful login type" , ) if user_id != requester . user . to_string ( ) : raise AuthError ( 403 , "Invalid auth" ) defer . returnValue ( params )
Checks that the user is who they claim to be, via a UI auth.
Checks that the user is who they claim to be via a UI auth .
"""
        Checks that the user is who they claim to be, via a UI auth.

        This is used for things like device deletion and password reset where
        the user already has a valid access token, but we want to double-check
        that it isn't stolen by re-authenticating them.

        Args:
            requester (Requester): The user, as given by the access token

            request_body (dict): The body of the request sent by the client

            clientip (str): The IP address of the client.

        Returns:
            defer.Deferred[dict]: the parameters for this request (which may
                have been given only in a previous call).

        Raises:
            InteractiveAuthIncompleteError if the client has not yet completed
                any of the permitted login flows

            AuthError if the client has completed a login flow, and it gives
                a different user to `requester`
        """ # build a list of supported flows # find the completed login type # this can't happen # check that the UI auth matched the access token
self
requester
request_body
clientip