Class: Cassandra::Auth::Providers::Password

Inherits:
Cassandra::Auth::Provider show all
Defined in:
lib/cassandra/auth/providers/password.rb

Overview

Note:

No need to instantiate this class manually, use :username and :password options when calling Cassandra.cluster and one will be created automatically for you.

Auth provider used for Cassandra's built in authentication.

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Password

Returns a new instance of Password.

Parameters:

  • username (String)

    username to use for authentication to Cassandra

  • password (String)

    password to use for authentication to Cassandra



51
52
53
54
# File 'lib/cassandra/auth/providers/password.rb', line 51

def initialize(username, password)
  @username = username
  @password = password
end

Instance Method Details

#create_authenticator(authentication_class) ⇒ Cassandra::Auth::Authenticator?

Returns a Password Authenticator only if org.apache.cassandra.auth.PasswordAuthenticator is given.

Parameters:

  • authentication_class (String)

    must equal to org.apache.cassandra.auth.PasswordAuthenticator

Returns:

  • (Cassandra::Auth::Authenticator)

    when authentication_class == "org.apache.cassandra.auth.PasswordAuthenticator"

  • (nil)

    for all other values of authentication_class



60
61
62
63
64
# File 'lib/cassandra/auth/providers/password.rb', line 60

def create_authenticator(authentication_class)
  if authentication_class == PASSWORD_AUTHENTICATOR_FQCN
    Authenticator.new(@username, @password)
  end
end