Class SSLConfig


  • public class SSLConfig
    extends java.lang.Object
    Data class to hold the configuration for the plugin.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  SSLConfig.InnerConfig
      Configuration for the SSL (secure) connector, meant to be accessed using its setters.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.function.Consumer<org.eclipse.jetty.server.ServerConnector> configConnectors
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use #configConnectors(Consumer) instead, access modifier will be changed to private in the next major release.
      boolean disableHttp3Upgrade
      Disables the handler that adds an "Alt-Svc" header to any non HTTP/3 response.
      boolean enableHttp3
      Enables HTTP/3 Support.
      java.lang.String host
      Host to bind to.
      boolean http2
      Toggle HTTP/2 Support
      int http3Port
      UDP Port to use on the HTTP/3 connector.
      SSLConfig.InnerConfig inner  
      boolean insecure
      Toggle the default http (insecure) connector.
      int insecurePort
      Port to use on the http (insecure) connector.
      boolean redirect
      Enable http to https redirection.
      boolean secure
      Toggle the default https (secure) connector.
      int securePort
      Port to use on the SSL (secure) connector.
      java.security.Provider securityProvider
      Security provider to use for the SSLContext.
      boolean sniHostCheck
      Disable SNI checks.
      TLSConfig tlsConfig
      TLS Security configuration
    • Constructor Summary

      Constructors 
      Constructor Description
      SSLConfig()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void configConnectors​(java.util.function.Consumer<org.eclipse.jetty.server.ServerConnector> configConnectors)
      Consumer to configure the different ServerConnector that will be created.
      void keystoreFromClasspath​(java.lang.String keyStoreFile, java.lang.String keyStorePassword)
      Load a key store from the classpath.
      void keystoreFromInputStream​(java.io.InputStream keyStoreInputStream, java.lang.String keyStorePassword)
      Load a key store from a given input stream.
      void keystoreFromPath​(java.lang.String keyStorePath, java.lang.String keyStorePassword)
      Load a key store from a given path in the system.
      void pemFromClasspath​(java.lang.String certificateFile, java.lang.String privateKeyFile)
      Load pem formatted identity data from the classpath.
      void pemFromClasspath​(java.lang.String certificateFile, java.lang.String privateKeyFile, java.lang.String privateKeyPassword)
      Load pem formatted identity data from the classpath.
      void pemFromInputStream​(java.io.InputStream certificateInputStream, java.io.InputStream privateKeyInputStream)
      Load pem formatted identity data from a given input stream.
      void pemFromInputStream​(java.io.InputStream certificateInputStream, java.io.InputStream privateKeyInputStream, java.lang.String privateKeyPassword)
      Load pem formatted identity data from a given input stream.
      void pemFromPath​(java.lang.String certificatePath, java.lang.String privateKeyPath)
      Load pem formatted identity data from a given path in the system.
      void pemFromPath​(java.lang.String certificatePath, java.lang.String privateKeyPath, java.lang.String privateKeyPassword)
      Load pem formatted identity data from a given path in the system.
      void pemFromString​(java.lang.String certificateString, java.lang.String privateKeyString)
      Load pem formatted identity data from a given string.
      void pemFromString​(java.lang.String certificateString, java.lang.String privateKeyString, java.lang.String privateKeyPassword)
      Load pem formatted identity data from a given string.
      void withTrustConfig​(java.util.function.Consumer<TrustConfig> trustConfigConsumer)
      Trust configuration as a consumer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • host

        public java.lang.String host
        Host to bind to.
      • insecure

        public boolean insecure
        Toggle the default http (insecure) connector.
      • secure

        public boolean secure
        Toggle the default https (secure) connector.
      • securePort

        public int securePort
        Port to use on the SSL (secure) connector.
      • insecurePort

        public int insecurePort
        Port to use on the http (insecure) connector.
      • redirect

        public boolean redirect
        Enable http to https redirection.
      • http2

        public boolean http2
        Toggle HTTP/2 Support
      • sniHostCheck

        public boolean sniHostCheck
        Disable SNI checks.
        See Also:
        Configuring SNI
      • tlsConfig

        public TLSConfig tlsConfig
        TLS Security configuration
      • enableHttp3

        public final boolean enableHttp3
        Enables HTTP/3 Support. Disabled by default because it is not yet working on Jetty.
        See Also:
        Constant Field Values
      • disableHttp3Upgrade

        public final boolean disableHttp3Upgrade
        Disables the handler that adds an "Alt-Svc" header to any non HTTP/3 response. Disabled by default because it is not yet working on Jetty.
        See Also:
        Constant Field Values
      • http3Port

        public final int http3Port
        UDP Port to use on the HTTP/3 connector. Disabled by default because it is not yet working on Jetty.
        See Also:
        Constant Field Values
      • configConnectors

        @Deprecated(forRemoval=true,
                    since="5.3.2")
        public java.util.function.Consumer<org.eclipse.jetty.server.ServerConnector> configConnectors
        Deprecated, for removal: This API element is subject to removal in a future version.
        Use #configConnectors(Consumer) instead, access modifier will be changed to private in the next major release.
        Consumer to configure the different ServerConnector that will be created. This consumer will be called as the last config step for each connector, allowing to override any previous configuration.
      • securityProvider

        public java.security.Provider securityProvider
        Security provider to use for the SSLContext.
    • Constructor Detail

      • SSLConfig

        public SSLConfig()
    • Method Detail

      • pemFromPath

        public void pemFromPath​(java.lang.String certificatePath,
                                java.lang.String privateKeyPath)
        Load pem formatted identity data from a given path in the system.
        Parameters:
        certificatePath - path to the certificate chain PEM file.
        privateKeyPath - path to the private key PEM file.
      • pemFromPath

        public void pemFromPath​(java.lang.String certificatePath,
                                java.lang.String privateKeyPath,
                                java.lang.String privateKeyPassword)
        Load pem formatted identity data from a given path in the system.
        Parameters:
        certificatePath - path to the certificate chain PEM file.
        privateKeyPath - path to the private key PEM file.
        privateKeyPassword - password for the private key.
      • pemFromClasspath

        public void pemFromClasspath​(java.lang.String certificateFile,
                                     java.lang.String privateKeyFile)
        Load pem formatted identity data from the classpath.
        Parameters:
        certificateFile - The name of the pem certificate file in the classpath.
        privateKeyFile - The name of the pem private key file in the classpath.
      • pemFromClasspath

        public void pemFromClasspath​(java.lang.String certificateFile,
                                     java.lang.String privateKeyFile,
                                     java.lang.String privateKeyPassword)
        Load pem formatted identity data from the classpath.
        Parameters:
        certificateFile - The name of the pem certificate file in the classpath.
        privateKeyFile - The name of the pem private key file in the classpath.
        privateKeyPassword - password for the private key.
      • pemFromInputStream

        public void pemFromInputStream​(java.io.InputStream certificateInputStream,
                                       java.io.InputStream privateKeyInputStream)
        Load pem formatted identity data from a given input stream.
        Parameters:
        certificateInputStream - input stream to the certificate chain PEM file.
        privateKeyInputStream - input stream to the private key PEM file.
      • pemFromInputStream

        public void pemFromInputStream​(java.io.InputStream certificateInputStream,
                                       java.io.InputStream privateKeyInputStream,
                                       java.lang.String privateKeyPassword)
        Load pem formatted identity data from a given input stream.
        Parameters:
        certificateInputStream - input stream to the certificate chain PEM file.
        privateKeyInputStream - input stream to the private key PEM file.
        privateKeyPassword - password for the private key.
      • pemFromString

        public void pemFromString​(java.lang.String certificateString,
                                  java.lang.String privateKeyString)
        Load pem formatted identity data from a given string.
        Parameters:
        certificateString - PEM encoded certificate chain.
        privateKeyString - PEM encoded private key.
      • pemFromString

        public void pemFromString​(java.lang.String certificateString,
                                  java.lang.String privateKeyString,
                                  java.lang.String privateKeyPassword)
        Load pem formatted identity data from a given string.
        Parameters:
        certificateString - PEM encoded certificate chain.
        privateKeyString - PEM encoded private key.
        privateKeyPassword - password for the private key.
      • keystoreFromPath

        public void keystoreFromPath​(java.lang.String keyStorePath,
                                     java.lang.String keyStorePassword)
        Load a key store from a given path in the system.
        Parameters:
        keyStorePath - path to the key store file.
        keyStorePassword - password for the key store.
      • keystoreFromInputStream

        public void keystoreFromInputStream​(java.io.InputStream keyStoreInputStream,
                                            java.lang.String keyStorePassword)
        Load a key store from a given input stream.
        Parameters:
        keyStoreInputStream - input stream to the key store file.
        keyStorePassword - password for the key store.
      • keystoreFromClasspath

        public void keystoreFromClasspath​(java.lang.String keyStoreFile,
                                          java.lang.String keyStorePassword)
        Load a key store from the classpath.
        Parameters:
        keyStoreFile - name of the key store file in the classpath.
        keyStorePassword - password for the key store.
      • configConnectors

        public void configConnectors​(java.util.function.Consumer<org.eclipse.jetty.server.ServerConnector> configConnectors)
        Consumer to configure the different ServerConnector that will be created. This consumer will be called as the last config step for each connector, allowing to override any previous configuration.
      • withTrustConfig

        public void withTrustConfig​(java.util.function.Consumer<TrustConfig> trustConfigConsumer)
        Trust configuration as a consumer.
        Parameters:
        trustConfigConsumer - consumer to configure the trust configuration.