@balaji.j @rafael.felix @simonbasle -
QueryRequest.AddCredentials won’t work until MB-16964 is fixed on the server, however the workaround is to just use the bucket credentials and limit your query scope to the bucket you are authenticated against:
Motivation
----------
Part 2 of a work around for MB-16964. Forces a N1QL query to use HTTP Auth
headers as opposed to the "creds" array which is not working correctly for
HTTP POST. This commit is specifically for non-async queries. Part 1 can
be found here: 3e19deec20f230fbbe2bcdf395956b6e3432e16c.
Modifications
-------------
Added Auth headers to HttpClient and use the bucket name and password as
credentials.
Result
------
The QueryRequestAddCrendentials(..) method does not currenly work; this is
a work around.
Change-Id: I9bfc237066d8105249a6bbcd83b6a20e9af4d7d8
Reviewed-on: http://review.couchbase.org/57820
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Reviewed-by: Simon Baslé <simon@couchbase.com>
changed 2 files
with 61 additions
and 0 deletions .
Motivation
----------
Work around for MB-16964. Forces a N1QL query to use HTTP Auth headers as
opposed to the "creds" array which is not working correctly for HTTP POST.
Modifications
-------------
Added Auth headers to HttpClient and use the bucket name and password as
credentials.
Result
------
The QueryRequestAddCrendentials(..) method does not currenly work; this is
a work around.
Change-Id: I0ae3a2eb9d552ee396322be9bf6826b61441ba0f
Reviewed-on: http://review.couchbase.org/57474
Tested-by: Jeffry Morris <jeffrymorris@gmail.com>
Reviewed-by: Simon Baslé <simon@couchbase.com>
changed 4 files
with 34 additions
and 25 deletions .
So, basically this:
bucket = _cluster.OpenBucket("mybucket", CouchbaseBucketPassword);
var result = bucket.Query(new QueryRequest("SELECT * FROM `mybucket`;"));
is all you need to do to query against an authenticated bucket assuming your client version >= 2.2.4.
-Jeff