Mike Thomsen
Mike Thomsen

Reputation: 37506

How to configure SSL client for Spring Data Cassandra

The only option that I can find for configuring the SSL configuration is spring.data.cassandra.ssl=true/false. We need to configure a key store and trust store to enable two-way SSL between the client and the cluster.

Is this possible out of the box or do I need to configure the cluster manually with my own @Configuration object?

Upvotes: 1

Views: 2823

Answers (2)

R Vigneswaran
R Vigneswaran

Reputation: 51

Create a bean CqlSessionBuilderCustomizer to populate SSL details. Build your own SSLContext using truststore and keystore.

  @Bean
  public CqlSessionBuilderCustomizer cqlSessionBuilderCustomizer() {
      return cqlSessionBuilder -> {
        try {
            cqlSessionBuilder
                      .withSslContext(buildContext());
        } catch (Exception e) {
            e.printStackTrace();
        }
    };

Upvotes: 2

MRINAL RANJAN
MRINAL RANJAN

Reputation: 121

I just wrote everything in the application.properties file

server.ssl.enabled=true
server.ssl.key-store=classpath:xyz.jks
server.ssl.key-store-password=xyz
server.ssl.key-store-type=JKS
server.ssl.key-alias=xyz

Upvotes: 2

Related Questions