LDAP Authentication

DSE 5.0 introduced a DSE Unified Authenticator. The DSE Authenticator can be used for LDAP authentication by configuring the cluster to use a given username/password for authentication to the DSE cluster. DSE versions earlier than 5.0 are configured similarly but use LDAP Authenticator on the DSE cluster.


a running DSE cluster with LDAP authentication enabled
the following example:
// Get the username and password from environment variables
$username = $_SERVER["USERNAME"];
$password = $_SERVER["PASSWORD"];

// Attempt to create the session using plaintext authentication
try {
    $cluster = Dse::cluster()
        ->withPlaintextAuthenticator($username, $password)
    $session = $cluster->connect();

    // Indicate the connection was successful
    echo "Login successful" . PHP_EOL;
} catch (Dse\Exception\AuthenticationException $deae) {
    // Indicate the connection was unsuccessful
    echo "Login failed" . PHP_EOL;

Authenticating with proper LDAP credentials

it is executed with proper credentials
its output should contain:
Login successful

Authenticating with improper LDAP credentials

it is executed with improper credentials, a Dse\Exception\AuthenticationException will occur
its output should contain:
Login failed