def set_authenticated(self, me, restart_stream = False):
with self.lock:<EOL><INDENT>self.authenticated = True<EOL>self.me = me<EOL>if restart_stream:<EOL><INDENT>self._restart_stream()<EOL><DEDENT><DEDENT>self.event(AuthenticatedEvent(self.me))<EOL>
Mark stream authenticated as `me`.

        :Parameters:
            - `me`: local JID just authenticated
            - `restart_stream`: `True` when stream should be restarted (needed
              after SASL authentication)
        :Types:
            - `me`: `JID`
            - `restart_stream`: `bool`