Record Class SslConfiguration

java.lang.Object
java.lang.Record
org.elasticsearch.common.ssl.SslConfiguration

public record SslConfiguration(String settingPrefix, boolean explicitlyConfigured, SslTrustConfig trustConfig, SslKeyConfig keyConfig, SslVerificationMode verificationMode, SslClientAuthenticationMode clientAuth, List<String> ciphers, List<String> supportedProtocols) extends Record
A object encapsulating all necessary configuration for an SSL context (client or server). The configuration itself is immutable, but the key config and trust config may depend on reading key and certificate material from files (see getDependentFiles(), and the content of those files may change.
  • Constructor Details

    • SslConfiguration

      public SslConfiguration(String settingPrefix, boolean explicitlyConfigured, SslTrustConfig trustConfig, SslKeyConfig keyConfig, SslVerificationMode verificationMode, SslClientAuthenticationMode clientAuth, List<String> ciphers, List<String> supportedProtocols)
      Creates an instance of a SslConfiguration record class.
      Parameters:
      settingPrefix - the value for the settingPrefix record component
      explicitlyConfigured - the value for the explicitlyConfigured record component
      trustConfig - the value for the trustConfig record component
      keyConfig - the value for the keyConfig record component
      verificationMode - the value for the verificationMode record component
      clientAuth - the value for the clientAuth record component
      ciphers - the value for the ciphers record component
      supportedProtocols - the value for the supportedProtocols record component
  • Method Details

    • getCipherSuites

      public List<String> getCipherSuites()
    • getDependentFiles

      public Collection<Path> getDependentFiles()
      Returns:
      A collection of files that are used by this SSL configuration. If the contents of these files change, then any subsequent call to createSslContext() (or similar methods) may create a context with different behaviour. It is recommended that these files be monitored for changes, and a new ssl-context is created whenever any of the files are modified.
    • getConfiguredCertificates

      public Collection<? extends StoredCertificate> getConfiguredCertificates()
      Returns:
      A collection of certificates that are used by this SSL configuration. This includes certificates used for identity (with a private key) and those used for trust, but excludes certificates that are provided by the JRE.
    • createSslContext

      public SSLContext createSslContext()
      Dynamically create a new SSL context based on the current state of the configuration. Because the key config and trust config may change based on the contents of their referenced files (see getDependentFiles(), consecutive calls to this method may return ssl-contexts with different configurations.
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • settingPrefix

      public String settingPrefix()
      Returns the value of the settingPrefix record component.
      Returns:
      the value of the settingPrefix record component
    • explicitlyConfigured

      public boolean explicitlyConfigured()
      Returns the value of the explicitlyConfigured record component.
      Returns:
      the value of the explicitlyConfigured record component
    • trustConfig

      public SslTrustConfig trustConfig()
      Returns the value of the trustConfig record component.
      Returns:
      the value of the trustConfig record component
    • keyConfig

      public SslKeyConfig keyConfig()
      Returns the value of the keyConfig record component.
      Returns:
      the value of the keyConfig record component
    • verificationMode

      public SslVerificationMode verificationMode()
      Returns the value of the verificationMode record component.
      Returns:
      the value of the verificationMode record component
    • clientAuth

      public SslClientAuthenticationMode clientAuth()
      Returns the value of the clientAuth record component.
      Returns:
      the value of the clientAuth record component
    • ciphers

      public List<String> ciphers()
      Returns the value of the ciphers record component.
      Returns:
      the value of the ciphers record component
    • supportedProtocols

      public List<String> supportedProtocols()
      Returns the value of the supportedProtocols record component.
      Returns:
      the value of the supportedProtocols record component