(self, auth_response)
| 1477 | |
| 1478 | @defunct_on_error |
| 1479 | def _handle_auth_response(self, auth_response): |
| 1480 | if self.is_defunct: |
| 1481 | return |
| 1482 | |
| 1483 | if isinstance(auth_response, AuthSuccessMessage): |
| 1484 | log.debug("Connection %s successfully authenticated", self) |
| 1485 | self.authenticator.on_authentication_success(auth_response.token) |
| 1486 | if self._compressor: |
| 1487 | self.compressor = self._compressor |
| 1488 | self.connected_event.set() |
| 1489 | elif isinstance(auth_response, AuthChallengeMessage): |
| 1490 | response = self.authenticator.evaluate_challenge(auth_response.challenge) |
| 1491 | msg = AuthResponseMessage("" if response is None else response) |
| 1492 | log.debug("Responding to auth challenge on %s", self) |
| 1493 | self.send_msg(msg, self.get_request_id(), self._handle_auth_response) |
| 1494 | elif isinstance(auth_response, ErrorMessage): |
| 1495 | log.debug("Received ErrorMessage on new connection (%s) from %s: %s", |
| 1496 | id(self), self.endpoint, auth_response.summary_msg()) |
| 1497 | raise AuthenticationFailed( |
| 1498 | "Failed to authenticate to %s: %s" % |
| 1499 | (self.endpoint, auth_response.summary_msg())) |
| 1500 | elif isinstance(auth_response, ConnectionShutdown): |
| 1501 | log.debug("Connection to %s was closed during the authentication process", self.endpoint) |
| 1502 | raise auth_response |
| 1503 | else: |
| 1504 | msg = "Unexpected response during Connection authentication to %s: %r" |
| 1505 | log.error(msg, self.endpoint, auth_response) |
| 1506 | raise ProtocolError(msg % (self.endpoint, auth_response)) |
| 1507 | |
| 1508 | def set_keyspace_blocking(self, keyspace): |
| 1509 | if not keyspace or keyspace == self.keyspace: |
nothing calls this directly
no test coverage detected