Ask for this client to reconnect to the origin This function will de-dupe all calls here and return a *single* future for the sign-in-- whis way callers can all assume there aren't others
(self, callback=None)
| 1035 | del AsyncAuth.creds_map[key] |
| 1036 | |
| 1037 | def authenticate(self, callback=None): |
| 1038 | """ |
| 1039 | Ask for this client to reconnect to the origin |
| 1040 | |
| 1041 | This function will de-dupe all calls here and return a *single* future |
| 1042 | for the sign-in-- whis way callers can all assume there aren't others |
| 1043 | """ |
| 1044 | # if an auth is in flight-- and not done-- just pass that back as the future to wait on |
| 1045 | if ( |
| 1046 | hasattr(self, "_authenticate_future") |
| 1047 | and not self._authenticate_future.done() |
| 1048 | ): |
| 1049 | future = self._authenticate_future |
| 1050 | else: |
| 1051 | future = tornado.concurrent.Future() |
| 1052 | self._authenticate_future = future |
| 1053 | self.io_loop.create_task(self._authenticate()) |
| 1054 | |
| 1055 | if callback is not None: |
| 1056 | |
| 1057 | def handle_future(future): |
| 1058 | response = future.result() |
| 1059 | self.io_loop.call_soon(callback, response) |
| 1060 | |
| 1061 | future.add_done_callback(handle_future) |
| 1062 | |
| 1063 | return future |
| 1064 | |
| 1065 | async def _authenticate(self): |
| 1066 | """ |