Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Membase | Memcached Server 1.0.3

Java Smart Client HTTP Basic Authentication - Not Possible?

2 replies [Last post]
  • Login or register to post comments
Tue, 08/17/2010 - 15:32
Nathan Smith
Offline
Joined: 08/17/2010
Groups: None

I'm using the Membase Java Smart Client, which I believe accesses the REST API on port 8080 to provide memcached cluster access.

I want to turn on HTTP Basic Authentication for my Admin Console, however when doing so I get errors connecting the Smart Client. It seems that setting Authentication for the Admin Console also sets it for the REST API. However, I cannot find a way to get the Smart Client to use HTTP Basic authentication.

Setting the username and userpassword on the ClientManager doesn't work. It appears that those credentials relate to the bucket access not the REST API access.

Am I missing something, or is simply not possible to do this in the current version?

Top
Tue, 08/17/2010 - 21:48
ingenthr
Offline
Joined: 03/16/2010
Groups:

Yes, the Java smart client does use HTTP Basic Auth. If you use the appropriate constructor for the bucket you're accessing, it will automatically do HTTP Basic Auth against the cluster. The only situation where it won't is if you're using the "default" bucket, which is available without authentication.

What kind of constructor are you using with the ClientManager? What kind of errors are you getting?

Top
Wed, 08/18/2010 - 15:39
Nathan Smith
Offline
Joined: 08/17/2010
Groups: None

Thanks for the reply.

I have no trouble connecting to a specific bucket using the ClientManager constructor. Both the simple and bucket specific constructors work so long as the Admin Console does not have any security set. So yes the smart client uses HTTP Basic Auth for bucket access (where the username and password is same as the bucket name), that's fine.

My problem is that when a security username and password is set on the Admin Console and restart my client app Java smart client access stops working. It cannot access [url]http://localhost:8080/pools/default[/url] (regardless of the ClientManager constructor used).

The admin security is set at the url:
[url]http://localhost:8080/index.html#sec=settings[/url]

The constructor code is:
ArrayList baseList = new ArrayList();
URI base = new URI("http://localhost:8080/pools/default");
baseList.add(base);
ClientManager manager = new ClientManager(baseList, "bucket1", "bucket1");
MemcachedClient client = manager.getClient();

The error message is:
java.io.IOException: No valid base URIs have been provided.
at com.northscale.store.ClientManager.tryReadBase(ClientManager.java:624) [northscale_client-1.0.2.jar:na]
at com.northscale.store.ClientManager.getBucketMembers(ClientManager.java:266) [northscale_client-1.0.2.jar:na]
at com.northscale.store.ClientManager.getClient(ClientManager.java:458) [northscale_client-1.0.2.jar:na]

Top
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker