def set_peer_authenticated(self, peer, restart_stream = False):
with self.lock:<EOL><INDENT>self.peer_authenticated = True<EOL>self.peer = peer<EOL>if restart_stream:<EOL><INDENT>self._restart_stream()<EOL><DEDENT><DEDENT>self.event(AuthenticatedEvent(self.peer))<EOL>
Mark the other side of the stream authenticated as `peer`

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