Skip to content

Commit

Permalink
added AllowedAuthenticators
Browse files Browse the repository at this point in the history
Signed-off-by: mehul gautam <mehulsharma4786@gmail.com>
  • Loading branch information
hellspawn679 committed Jun 14, 2024
1 parent 7bb8259 commit e8775e7
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions pkg/cassandra/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,10 @@ type Configuration struct {
TLS tlscfg.Options `mapstructure:"tls"`
}

var (
defaultApprovedAuthenticators = []string{
"org.apache.cassandra.auth.PasswordAuthenticator",
"com.instaclustr.cassandra.auth.SharedSecretAuthenticator",
"com.datastax.bdp.cassandra.auth.DseAuthenticator",
"io.aiven.cassandra.auth.AivenAuthenticator",
"com.ericsson.bss.cassandra.ecaudit.auth.AuditPasswordAuthenticator",
"com.amazon.helenus.auth.HelenusAuthenticator",
"com.ericsson.bss.cassandra.ecaudit.auth.AuditAuthenticator",
"com.scylladb.auth.SaslauthdAuthenticator",
"com.scylladb.auth.TransitionalAuthenticator",
"com.instaclustr.cassandra.auth.InstaclustrPasswordAuthenticator",
}
)

// Authenticator holds the authentication properties needed to connect to a Cassandra cluster
type Authenticator struct {
Basic BasicAuthenticator `yaml:"basic" mapstructure:",squash"`
// TODO: add more auth types
Basic BasicAuthenticator `yaml:"basic" mapstructure:",squash"`
AllowedAuthenticators []string `yaml:"allowedAuthenticators" mapstructure:"allowedAuthenticators"`
}

// BasicAuthenticator holds the username and password for a password authenticator for a Cassandra cluster
Expand Down Expand Up @@ -160,7 +145,7 @@ func (c *Configuration) NewCluster(logger *zap.Logger) (*gocql.ClusterConfig, er
cluster.Authenticator = gocql.PasswordAuthenticator{
Username: c.Authenticator.Basic.Username,
Password: c.Authenticator.Basic.Password,
AllowedAuthenticators: defaultApprovedAuthenticators,
AllowedAuthenticators: c.Authenticator.AllowedAuthenticators,

Check warning on line 148 in pkg/cassandra/config/config.go

View check run for this annotation

Codecov / codecov/patch

pkg/cassandra/config/config.go#L146-L148

Added lines #L146 - L148 were not covered by tests
}
}
tlsCfg, err := c.TLS.Config(logger)
Expand Down

0 comments on commit e8775e7

Please sign in to comment.