Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.infinispan.client.hotrod.configuration;
  
  
SSLConfigurationBuilder.

Author(s):
Tristan Tarrant
Since:
5.3
 
    private static final Log log = LogFactory.getLog(SslConfigurationBuilder.class);
    private boolean enabled = false;
    private String keyStoreFileName;
    private char[] keyStorePassword;
    private String trustStoreFileName;
    private char[] trustStorePassword;
    private SSLContext sslContext;
 
       super(builder);
    }

   
Disables the SSL support
 
    public SslConfigurationBuilder disable() {
       this. = false;
       return this;
    }

   
Enables the SSL support
 
    public SslConfigurationBuilder enable() {
       this. = true;
       return this;
    }

   
Enables or disables the SSL support
 
    public SslConfigurationBuilder enabled(boolean enabled) {
       this. = enabled;
       return this;
    }

   
Specifies the filename of a keystore to use to create the javax.net.ssl.SSLContext You also need to specify a keyStorePassword(char[]). Alternatively specify an array of keyManagers(javax.net.ssl.KeyManager[])
 
    public SslConfigurationBuilder keyStoreFileName(String keyStoreFileName) {
       this. = keyStoreFileName;
       return this;
    }

   
Specifies the password needed to open the keystore You also need to specify a keyStoreFileName(java.lang.String) Alternatively specify an array of keyManagers(javax.net.ssl.KeyManager[])
 
    public SslConfigurationBuilder keyStorePassword(char[] keyStorePassword) {
       this. = keyStorePassword;
       return this;
    }
 
    public SslConfigurationBuilder sslContext(SSLContext sslContext) {
       this. = sslContext;
       return this;
    }

   
Specifies the filename of a truststore to use to create the javax.net.ssl.SSLContext You also need to specify a trustStorePassword(char[]). Alternatively specify an array of trustManagers(javax.net.ssl.TrustManager[])
 
    public SslConfigurationBuilder trustStoreFileName(String trustStoreFileName) {
       this. = trustStoreFileName;
       return this;
    }

   
Specifies the password needed to open the truststore You also need to specify a trustStoreFileName(java.lang.String) Alternatively specify an array of trustManagers(javax.net.ssl.TrustManager[])
 
    public SslConfigurationBuilder trustStorePassword(char[] trustStorePassword) {
       this. = trustStorePassword;
       return this;
    }
 
   public void validate() {
      if () {
         if ( == null) {
            if ( == null) {
               throw .noSSLKeyManagerConfiguration();
            }
            if ( != null &&  == null) {
               throw .missingKeyStorePassword();
            }
            if ( == null) {
               throw .noSSLTrustManagerConfiguration();
            }
            if ( != null &&  == null) {
               throw .missingTrustStorePassword();
            }
         } else {
            if ( != null ||  != null) {
               throw .xorSSLContext();
            }
         }
      }
   }
   public SslConfiguration create() {
   }
   public SslConfigurationBuilder read(SslConfiguration template) {
      this. = template.enabled();
      this. = template.keyStoreFileName();
      this. = template.keyStorePassword();
      this. = template.sslContext();
      this. = template.trustStoreFileName();
      this. = template.trustStorePassword();
      return this;
   }
New to GrepCode? Check out our FAQ X