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 2.0.0
     @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 2.0.0
     @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)