def test_host_passthrough(self): sasl_kwargs = {'service': 'cassandra', 'mechanism': 'PLAIN'} provider = SaslAuthProvider(**sasl_kwargs) host = 'thehostname' authenticator = provider.new_authenticator(host) self.assertEqual(authenticator.sasl.host, host)
def get_authentication_provider(self, username, password): sasl_kwargs = {'service': 'cassandra', 'mechanism': 'PLAIN', 'qops': ['auth'], 'username': username, 'password': password} return SaslAuthProvider(**sasl_kwargs)
def test_proxy_login_allowed(self): """ Test that a proxy login is allowed with proper permissions. @since 3.20 @jira_ticket PYTHON-662 @test_category dse auth @expected_result connect and query should be allowed """ auth_provider = SaslAuthProvider(**self.get_sasl_options()) self.grant_proxy_login() self.connect_and_query(auth_provider)
def test_proxy_login_forbidden(self): """ Test that a proxy login is forbidden by default for a user. @since 3.20 @jira_ticket PYTHON-662 @test_category dse auth @expected_result connect and query should not be allowed """ auth_provider = SaslAuthProvider(**self.get_sasl_options()) with self.assertRaises(Unauthorized): self.connect_and_query(auth_provider)
def test_can_connect_auth_sasl(self): """ Verify that the driver can connect despite some nodes being in different versions with ssl authentication @since 3.12 @jira_ticket PYTHON-546 @expected_result the driver connects successfully and can execute queries against all the hosts @test_category upgrade """ sasl_kwargs = {'service': 'cassandra', 'mechanism': 'PLAIN', 'qops': ['auth'], 'username': '******', 'password': '******'} auth_provider = SaslAuthProvider(**sasl_kwargs) self.connect_and_shutdown(auth_provider) for node in self.nodes: self.upgrade_node(node) self.connect_and_shutdown(auth_provider) self.connect_and_shutdown(auth_provider)