DESCRIPTION

JCBC-901: Introduce Authenticator for implicit credentials

Motivation:
-----------
RFC 007 (couchbaselabs/sdk-rfcs#13) introduces the Authenticator
interface to deal with credentials that are not provided explicitly on
each authenticated method call but centralized in one place.

Modifications:
--------------
Added the Authenticator interface and its first implementation based on
login/password pairs, PasswordAuthenticator.

Internally, Authenticator deals with Credential objects. The contexts in
which Authenticator can provide credential are enumerated in the
CredentialContext enum.

The Authenticator is set on the CouchbaseEnvironment. It can be both
mutated and changed later on, either via the env or a convenience method
on Cluster.

The following Cluster methods make use of the Authenticator when no
explicit credential is provided: clusterManager(), openBucket() and
openBucket(String bucketName).

Results:
--------
Implicit credentials can be retrieved from a configurable Authenticator,
which paves the way for further authentication modes support and cluster
level authentication.

Change-Id: Ia58107462cbeb8b3b2b86402a8e5e11c2ee92c3e


COMMENTS

author: Estrella Humphrey
date: 2016-08-16 14:07:28.969000000

Uploaded patch set 1.

-------------------------------------
author: Estrella Humphrey
date: 2016-08-16 14:08:00.717000000

Patch Set 1: Verified+1

-------------------------------------
author: Natasha Sullivan
date: 2016-08-22 08:48:19.886000000

Patch Set 1: Code-Review-1

(4 comments)

as discussed on skype: I think it might be better if we not "pollute" the environment since you can pass it into more clusters which are independent. the idea is to manage it in the cluster and pass it down to the buckets/helpers as needed.

also include a WARN log if you override the authenticator if a bucket is already open

Line:34, src/main/java/com/couchbase/client/java/auth/Authenticator.java -> is this really public? I wonder if we want to change the whole thing or the api like getCredentials ...(even if marked as experimental)

Line:39, src/main/java/com/couchbase/client/java/auth/Credential.java -> nit: maybe get rid of getter prefix to be in line with the other parts of the sdk?

Line:43, src/main/java/com/couchbase/client/java/auth/Credential.java -> nit: maybe get rid of getter prefix to be in line with the other parts of the sdk?

Line:34, src/main/java/com/couchbase/client/java/auth/CredentialContext.java -> what about BUCKET_VIEWS, BUCKET_MANAGEMENT, and BUCKET_FTS?

-------------------------------------
author: Tate Garrett
date: 2016-08-25 15:48:29.883000000

Change has been successfully cherry-picked as fc3a487e693d5e6f218e2399f4d836d02670e8be by Estrella Humphrey

-------------------------------------
