def _handle_auth_success(self, stream, success):
if not self._check_authorization(success.properties, stream):<EOL><INDENT>element = ElementTree.Element(FAILURE_TAG)<EOL>ElementTree.SubElement(element, SASL_QNP + "<STR_LIT>")<EOL>return True<EOL><DEDENT>authzid = success.properties.get("<STR_LIT>")<EOL>if authzid:<EOL><INDENT>peer = JID(success.authzid)<EOL><DEDENT>elif "<STR_LIT:username>" in success.properties:<EOL><INDENT>peer = JID(success.properties["<STR_LIT:username>"], stream.me.domain)<EOL><DEDENT>else:<EOL><INDENT>peer = None<EOL><DEDENT>stream.set_peer_authenticated(peer, True)<EOL>
Handle successful authentication.

        Send <success/> and mark the stream peer authenticated.

        [receiver only]