From 96d23e4301c5114bec0b7c9ad40598adb6d19872 Mon Sep 17 00:00:00 2001 From: Bret McGuire Date: Fri, 19 Jan 2024 15:57:14 -0600 Subject: [PATCH] Add support for AstraAuthenticator --- proxycore/auth.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proxycore/auth.go b/proxycore/auth.go index 0de28c4..3ad400f 100644 --- a/proxycore/auth.go +++ b/proxycore/auth.go @@ -31,11 +31,15 @@ type passwordAuth struct { password string } +const dseAuthenticator = "com.datastax.bdp.cassandra.auth.DseAuthenticator" +const passwordAuthenticator = "org.apache.cassandra.auth.PasswordAuthenticator" +const astraAuthenticator = "org.apache.cassandra.auth.AstraAuthenticator" + func (d *passwordAuth) InitialResponse(authenticator string) ([]byte, error) { switch authenticator { - case "com.datastax.bdp.cassandra.auth.DseAuthenticator": + case dseAuthenticator: return []byte("PLAIN"), nil - case "org.apache.cassandra.auth.PasswordAuthenticator": + case passwordAuthenticator, astraAuthenticator: return d.makeToken(), nil } return nil, fmt.Errorf("unknown authenticator: %v", authenticator)