Class Credential
Credential.of(username, password)Alternatively, to use a client certificate:
Credential.fromKeyStore(
Paths.get("/path/to/client-cert.p12"),
"password"
)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic CredentialfromKeyStore(Path pkcs12Path, @Nullable String password) Returns a new instance that holds a client certificate loaded from the specified PKCS#12 key store file.static CredentialfromKeyStore(KeyStore keyStore, @Nullable String password) Returns a new instance that holds a client certificate loaded from the specified key store.static CredentialReturns a new instance that holds the given username and password.static CredentialofDynamic(Supplier<Credential> supplier) Deprecated.This method is not compatible with client certificate credentials.static CredentialReturns a new instance that holds the given JSON Web Token (JWT).
-
Method Details
-
of
Returns a new instance that holds the given username and password. -
ofJwt
Returns a new instance that holds the given JSON Web Token (JWT).Requires Enterprise Analytics 2.2 or later.
NOTE: This kind of credential often has a relatively short validity period. To prevent authentication failures caused by stale credentials, periodically pass a fresh credential to
Cluster.credential(Credential). -
fromKeyStore
Returns a new instance that holds a client certificate loaded from the specified PKCS#12 key store file.The key store must have a single entry which must contain a private key and certificate chain. The same password must be used for integrity and encryption.
TIP: One way to create a suitable PKCS#12 file from a PEM-encoded private key and certificate is to concatenate the key and certificate into a file named "client-cert.pem", then run this command:
openssl pkcs12 -export -in client-cert.pem -out client-cert.p12 -passout pass:password
This creates a PKCS#12 file named "client-cert.p12" protected by the password "password".- Parameters:
password- for verifying key store integrity and decrypting the private key
-
fromKeyStore
Returns a new instance that holds a client certificate loaded from the specified key store.The key store must have a single entry which must contain a private key and certificate chain.
- Parameters:
password- for decrypting the private key
-
ofDynamic
Deprecated.This method is not compatible with client certificate credentials. Instead, please update the credential by callingCluster.credential(Credential).Returns a new instance of a dynamic credential that invokes the given supplier every time a credential is required.This enables updating a credential without having to restart your application.
-