Package com.couchbase.client.java.auth
Class ClassicAuthenticator
java.lang.Object
com.couchbase.client.java.auth.ClassicAuthenticator
- All Implemented Interfaces:
Authenticator
@Committed @Public public class ClassicAuthenticator extends Object implements Authenticator
An
Authenticator
based on login/password credentials.- Since:
- 2.3
- Author:
- Simon Baslé
-
Constructor Summary
Constructors Constructor Description ClassicAuthenticator()
-
Method Summary
Modifier and Type Method Description ClassicAuthenticator
bucket(String bucketName, String password)
Sets theCredentialContext.BUCKET_KV
/CredentialContext.BUCKET_N1QL
credential for the the *bucketName* specific.ClassicAuthenticator
cluster(String adminName, String adminPassword)
Sets theCredentialContext.CLUSTER_MANAGEMENT
credential.List<Credential>
getCredentials(CredentialContext context, String specific)
Retrieve the credentials store by thisAuthenticator
for the givenCredentialContext
and optional specific.boolean
isEmpty()
-
Constructor Details
-
ClassicAuthenticator
public ClassicAuthenticator()
-
-
Method Details
-
getCredentials
Description copied from interface:Authenticator
Retrieve the credentials store by thisAuthenticator
for the givenCredentialContext
and optional specific. If no corresponding credential can be found, an empty list is returned. If the context / specific cannot be processed by this Authenticator, throws anIllegalArgumentException
.- Specified by:
getCredentials
in interfaceAuthenticator
- Parameters:
context
- the context for which the credential(s) will be used.specific
- a more restrictive sub-context specific to the context.- Returns:
- a list of credentials that can be used for the context/operation, or empty list if none was set for this context+specific combination.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceAuthenticator
- Returns:
- true if this
Authenticator
doesn't have any credentials set.
-
bucket
Sets theCredentialContext.BUCKET_KV
/CredentialContext.BUCKET_N1QL
credential for the the *bucketName* specific.- Parameters:
bucketName
- the name of the bucket for which to set a password.password
- the password for the bucket.- Returns:
- this
ClassicAuthenticator
for chaining.
-
cluster
Sets theCredentialContext.CLUSTER_MANAGEMENT
credential. Specific is ignored in this context.- Parameters:
adminName
- the administrative login to use.adminPassword
- the administrative password to use.- Returns:
- this
ClassicAuthenticator
for chaining.
-