Class CredentialConfigFactory


  • public final class CredentialConfigFactory
    extends Object
    Utility class for creating credential configs when the underlying credential is already available for use.
    • Constructor Detail

      • CredentialConfigFactory

        private CredentialConfigFactory()
        Default constructor.
    • Method Detail

      • createKeyStoreCredentialConfig

        public static CredentialConfig createKeyStoreCredentialConfig​(KeyStore trustStore)
        Creates a KeyStoreCredentialConfig from the supplied truststore.
        Parameters:
        trustStore - to create credential config from
        Returns:
        credential config
      • createKeyStoreCredentialConfig

        public static CredentialConfig createKeyStoreCredentialConfig​(KeyStore trustStore,
                                                                      String[] trustStoreAliases)
        Creates a KeyStoreCredentialConfig from the supplied truststore.
        Parameters:
        trustStore - to create credential config from
        trustStoreAliases - to use in the truststore
        Returns:
        credential config
      • createKeyStoreCredentialConfig

        public static CredentialConfig createKeyStoreCredentialConfig​(KeyStore keyStore,
                                                                      String keyStorePassword)
        Creates a KeyStoreCredentialConfig from the supplied keystore and password.
        Parameters:
        keyStore - to create credential config from
        keyStorePassword - to unlock the keystore
        Returns:
        credential config
      • createKeyStoreCredentialConfig

        public static CredentialConfig createKeyStoreCredentialConfig​(KeyStore keyStore,
                                                                      String keyStorePassword,
                                                                      String[] keyStoreAliases)
        Creates a KeyStoreCredentialConfig from the supplied keystore and password.
        Parameters:
        keyStore - to create credential config from
        keyStorePassword - to unlock the keystore
        keyStoreAliases - to use in the keystore
        Returns:
        credential config
      • createKeyStoreCredentialConfig

        public static CredentialConfig createKeyStoreCredentialConfig​(KeyStore trustStore,
                                                                      KeyStore keyStore,
                                                                      String keyStorePassword)
        Creates a KeyStoreCredentialConfig from the supplied truststore, keystore and password.
        Parameters:
        trustStore - to create credential config from
        keyStore - to create credential config from
        keyStorePassword - to unlock the keystore
        Returns:
        credential config
      • createKeyStoreCredentialConfig

        public static CredentialConfig createKeyStoreCredentialConfig​(KeyStore trustStore,
                                                                      String[] trustStoreAliases,
                                                                      KeyStore keyStore,
                                                                      String keyStorePassword,
                                                                      String[] keyStoreAliases)
        Creates a KeyStoreCredentialConfig from the supplied truststore, keystore and password.
        Parameters:
        trustStore - to create credential config from
        trustStoreAliases - to use in the truststore
        keyStore - to create credential config from
        keyStorePassword - to unlock the keystore
        keyStoreAliases - to use in the keystore
        Returns:
        credential config
      • createX509CredentialConfig

        public static CredentialConfig createX509CredentialConfig​(X509Certificate[] trustCertificates)
        Creates a X509CredentialConfig from the supplied trust certificates.
        Parameters:
        trustCertificates - to create credential config from
        Returns:
        credential config
      • createX509CredentialConfig

        public static CredentialConfig createX509CredentialConfig​(X509Certificate authenticationCertificate,
                                                                  PrivateKey authenticationKey)
        Creates a X509CredentialConfig from the supplied authentication certificate and private key.
        Parameters:
        authenticationCertificate - to create credential config from
        authenticationKey - that belongs to the certificate
        Returns:
        credential config
      • createX509CredentialConfig

        public static CredentialConfig createX509CredentialConfig​(X509Certificate[] trustCertificates,
                                                                  X509Certificate authenticationCertificate,
                                                                  PrivateKey authenticationKey)
        Creates a X509CredentialConfig from the supplied trust certificates, authentication certificate and private key.
        Parameters:
        trustCertificates - to create credential config from
        authenticationCertificate - to create credential config from
        authenticationKey - that belongs to the certificate
        Returns:
        credential config
      • createX509CredentialConfig

        public static CredentialConfig createX509CredentialConfig​(String trustCertificates)
        Creates a X509CredentialConfig from PEM encoded certificate(s).
        Parameters:
        trustCertificates - to create credential config from
        Returns:
        credential config