Package com.couchbase.client.core.env
Class CertificateAuthenticator
java.lang.Object
com.couchbase.client.core.env.CertificateAuthenticator
- All Implemented Interfaces:
Authenticator
Performs authentication through a client certificate instead of supplying username and password.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyTlsProperties
(com.couchbase.client.core.deps.io.netty.handler.ssl.SslContextBuilder context) The authenticator gets the chance to attach the client certificate to the ssl context if needed.static CertificateAuthenticator
fromKey
(PrivateKey key, String keyPassword, List<X509Certificate> keyCertChain) Creates a newCertificateAuthenticator
directly from a key and certificate chain.static CertificateAuthenticator
fromKeyManagerFactory
(Supplier<KeyManagerFactory> keyManagerFactory) Creates a newCertificateAuthenticator
from aKeyManagerFactory
.static CertificateAuthenticator
fromKeyStore
(Path keyStorePath, String keyStorePassword, Optional<String> keyStoreType) Creates a newCertificateAuthenticator
from a key store path.static CertificateAuthenticator
fromKeyStore
(KeyStore keyStore, String keyStorePassword) Creates a newCertificateAuthenticator
from a key store.com.couchbase.client.core.deps.io.grpc.CallCredentials
boolean
If this authenticator supports non-encrypted connections.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.couchbase.client.core.env.Authenticator
authHttpRequest, authKeyValueConnection, supportsTls
-
Method Details
-
fromKeyStore
public static CertificateAuthenticator fromKeyStore(Path keyStorePath, String keyStorePassword, Optional<String> keyStoreType) Creates a newCertificateAuthenticator
from a key store path.- Parameters:
keyStorePath
- the file path to the keystore.keyStorePassword
- the password for the keystore.keyStoreType
- the type of the key store. If empty, theKeyStore.getDefaultType()
will be used.- Returns:
- the created
CertificateAuthenticator
.
-
fromKeyStore
Creates a newCertificateAuthenticator
from a key store.- Parameters:
keyStore
- the key store to load the certificate from.keyStorePassword
- the password for the key store.- Returns:
- the created
CertificateAuthenticator
.
-
fromKeyManagerFactory
public static CertificateAuthenticator fromKeyManagerFactory(Supplier<KeyManagerFactory> keyManagerFactory) Creates a newCertificateAuthenticator
from aKeyManagerFactory
.- Parameters:
keyManagerFactory
- the key manager factory in a supplier that should be used.- Returns:
- the created
CertificateAuthenticator
.
-
fromKey
public static CertificateAuthenticator fromKey(PrivateKey key, String keyPassword, List<X509Certificate> keyCertChain) Creates a newCertificateAuthenticator
directly from a key and certificate chain.- Parameters:
key
- the private key to authenticate.keyPassword
- the password for to use.keyCertChain
- the key certificate chain to use.- Returns:
- the created
CertificateAuthenticator
.
-
protostellarCallCredentials
@Nullable @Internal public com.couchbase.client.core.deps.io.grpc.CallCredentials protostellarCallCredentials()- Specified by:
protostellarCallCredentials
in interfaceAuthenticator
-
applyTlsProperties
public void applyTlsProperties(com.couchbase.client.core.deps.io.netty.handler.ssl.SslContextBuilder context) Description copied from interface:Authenticator
The authenticator gets the chance to attach the client certificate to the ssl context if needed.- Specified by:
applyTlsProperties
in interfaceAuthenticator
- Parameters:
context
- the netty context builder
-
supportsNonTls
public boolean supportsNonTls()Description copied from interface:Authenticator
If this authenticator supports non-encrypted connections.- Specified by:
supportsNonTls
in interfaceAuthenticator
-
toString
-