Class SslBuilder<T>

  • Type Parameters:
    T - The server specific type to be built

    public abstract class SslBuilder<T>
    extends java.lang.Object
    A class to build a key store and a trust store for use in adding SSL support to a server.
    Since:
    1.0
    • Constructor Detail

      • SslBuilder

        public SslBuilder​(io.micronaut.core.io.ResourceResolver resourceResolver)
        Parameters:
        resourceResolver - The resource resolver
    • Method Detail

      • build

        public abstract java.util.Optional<T> build​(SslConfiguration ssl)
        Parameters:
        ssl - The ssl configuration
        Returns:
        Builds the SSL configuration wrapped inside an optional
      • build

        public abstract java.util.Optional<T> build​(SslConfiguration ssl,
                                                    HttpVersion httpVersion)
        Parameters:
        ssl - The ssl configuration
        httpVersion - The http version
        Returns:
        Builds the SSL configuration wrapped inside an optional
      • getTrustManagerFactory

        @Nullable
        protected javax.net.ssl.TrustManagerFactory getTrustManagerFactory​(SslConfiguration ssl)
        Parameters:
        ssl - The ssl configuration
        Returns:
        The TrustManagerFactory, or null for the default JDK trust store
      • getTrustStore

        protected java.util.Optional<java.security.KeyStore> getTrustStore​(SslConfiguration ssl)
                                                                    throws java.lang.Exception
        Parameters:
        ssl - The ssl configuration
        Returns:
        An optional KeyStore
        Throws:
        java.lang.Exception - if there is an error
      • getKeyManagerFactory

        protected javax.net.ssl.KeyManagerFactory getKeyManagerFactory​(SslConfiguration ssl)
        Parameters:
        ssl - The ssl configuration
        Returns:
        The KeyManagerFactory
      • getKeyStore

        protected java.util.Optional<java.security.KeyStore> getKeyStore​(SslConfiguration ssl)
                                                                  throws java.lang.Exception
        Parameters:
        ssl - The ssl configuration
        Returns:
        An optional KeyStore
        Throws:
        java.lang.Exception - if there is an error
      • load

        protected java.security.KeyStore load​(java.util.Optional<java.lang.String> optionalType,
                                              java.lang.String resource,
                                              java.util.Optional<java.lang.String> optionalPassword)
                                       throws java.lang.Exception
        Parameters:
        optionalType - The optional type
        resource - The resource
        optionalPassword - The optional password
        Returns:
        A KeyStore
        Throws:
        java.lang.Exception - if there is an error