Class SSLContextContainerAbstract

All Implemented Interfaces:
SSLContextContainerIfc, Lifecycle
Direct Known Subclasses:

public abstract class SSLContextContainerAbstract extends Object implements SSLContextContainerIfc
Created by andrzej on 29.02.2016.
  • Constructor Details

  • Method Details

    • find

      public static <T> T find(Map<String,T> lookupMap, String domain)
      Generic method responsible for lookup of value in Map where passed key is domain name and in Map wildcard name may be used as a key.
    • addCertificates

      public void addCertificates(Map<String,String> params) throws CertificateParsingException
      Description copied from interface: SSLContextContainerIfc
      Method addCertificates allows to add more certificates at run time after the container has bee already initialized. This is to avoid server restart if there are certificates updates or new certificates for new virtual domain. The method should add new certificates or replace existing one if there is already a certificate for a domain.
      Specified by:
      addCertificates in interface SSLContextContainerIfc
      params - a Map value with configuration parameters.
    • getSSLContext

      public SSLContext getSSLContext(String protocol, String hostname, boolean clientMode)
      Description copied from interface: SSLContextContainerIfc
      Method getSSLContext creates and returns new SSLContext for a given domain (hostname). For creation of the SSLContext a certificate associated with this domain (hostname) should be used. If there is no specific certificate for a given domain then default certificate should be used.
      Specified by:
      getSSLContext in interface SSLContextContainerIfc
      protocol - a String is either 'SSL' or 'TLS' value.
      hostname - a String value keeps a hostname or domain for SSLContext.
      clientMode - if set SSLContext will be created for client mode (ie. creation of server certificate will be skipped if there is no certificate)
      a SSLContext value
    • getTrustStore

      public KeyStore getTrustStore()
      Description copied from interface: SSLContextContainerIfc
      Returns a trust store with all trusted certificates.
      Specified by:
      getTrustStore in interface SSLContextContainerIfc
      a KeyStore with all trusted certificates, the KeyStore can be empty but cannot be null.
    • createCertificate

      protected KeyManager[] createCertificate(String alias) throws Exception
    • createContextHolder

      protected SSLContextContainerAbstract.SSLHolder createContextHolder(String protocol, String hostname, String alias, boolean clientMode, TrustManager[] tms) throws Exception
      Common method used to create SSLContext instance based on provided parameters
    • getDefCertAlias

      protected String getDefCertAlias()
    • getKeyManagers

      protected KeyManager[] getKeyManagers(String hostname)
    • getTrustManagers

      protected TrustManager[] getTrustManagers()