mkjellman / perlcassa

a Perl client for Apache Cassandra
Apache License 2.0
20 stars 12 forks source link

Added simple authentication support to perlcassa #63

Open gsiglet opened 9 years ago

gsiglet commented 9 years ago

Tried to add authentication support for perlcassa. Please feel free to re-factor. It works for me on a single-node Cassandra 2.1 cluster with PasswordAuthenticator.

 my $client = new perlcassa(
      keyspace => 'mykeyspace,
      hosts => ['localhost'],
      do_not_discover_peers => 1,
      'credentials' => { 'username' => 'cassandra', 'password' => 'cassandra' },
 );
 my $result = $client->exec("SELECT id from my_table limit 1");
gsiglet commented 9 years ago

Not sure whether perlcassa::Client::check_host should also authenticate. Could add authentication there as well