public class PasswordAuthenticator extends Object implements Authenticator
| Modifier and Type | Class and Description |
|---|---|
static class |
PasswordAuthenticator.Builder
Provides customization to the
PasswordAuthenticator. |
| Modifier and Type | Method and Description |
|---|---|
void |
authHttpRequest(ServiceType serviceType,
com.couchbase.client.core.deps.io.netty.handler.codec.http.HttpRequest request)
Allows to add authentication credentials to the http request for the given service.
|
void |
authKeyValueConnection(EndpointContext ctx,
com.couchbase.client.core.deps.io.netty.channel.ChannelPipeline pipeline)
Allows the authenticator to add KV handlers during connection bootstrap to perform
authentication.
|
static PasswordAuthenticator.Builder |
builder()
Deprecated.
Please use one of the "See Also" methods instead,
to ensure all required builder properties are set.
|
static PasswordAuthenticator.Builder |
builder(String username,
String password)
Creates a builder for an authenticator that uses the given credentials.
|
static PasswordAuthenticator.Builder |
builder(Supplier<UsernameAndPassword> supplier)
Creates a builder for an authenticator that uses dynamic credentials.
|
static PasswordAuthenticator |
create(String username,
String password)
Creates a new password authenticator with the default settings.
|
static PasswordAuthenticator |
ldapCompatible(String username,
String password)
Creates an LDAP compatible password authenticator which is INSECURE if not used with TLS.
|
com.couchbase.client.core.deps.io.grpc.CallCredentials |
protostellarCallCredentials() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitapplyTlsProperties, supportsNonTls, supportsTls@Deprecated public static PasswordAuthenticator.Builder builder()
PasswordAuthenticator.Builder which allows to customize this authenticator.builder(String, String),
builder(Supplier)public static PasswordAuthenticator.Builder builder(String username, String password)
public static PasswordAuthenticator.Builder builder(Supplier<UsernameAndPassword> supplier)
IMPORTANT: The supplier's get() method must not do blocking IO.
It is called from async contexts, where blocking IO can starve important SDK resources
like async event loops.
Instead of blocking inside the supplier, the supplier should return a value from a volatile field.
One way to keep the supplier's value up to date is to schedule a recurring task that reads new credentials from an external source and stores them in the volatile field.
public static PasswordAuthenticator create(String username, String password)
username - the username to use for all authentication.password - the password to use alongside the username.PasswordAuthenticator.builder(String, String),
builder(Supplier)public static PasswordAuthenticator ldapCompatible(String username, String password)
Please note that this is INSECURE and will leak user credentials on the wire to eavesdroppers. This should only be enabled in trusted environments.
username - the username to use for all authentication.password - the password to use alongside the username.PasswordAuthenticator.public void authKeyValueConnection(EndpointContext ctx, com.couchbase.client.core.deps.io.netty.channel.ChannelPipeline pipeline)
AuthenticatorauthKeyValueConnection in interface Authenticatorctx - the endpoint context.pipeline - the pipeline when the endpoint is constructed.public void authHttpRequest(ServiceType serviceType, com.couchbase.client.core.deps.io.netty.handler.codec.http.HttpRequest request)
AuthenticatorauthHttpRequest in interface AuthenticatorserviceType - the service for this request.request - the http request.public com.couchbase.client.core.deps.io.grpc.CallCredentials protostellarCallCredentials()
protostellarCallCredentials in interface AuthenticatorCopyright © 2024 Couchbase, Inc.. All rights reserved.