Skip to content

Conversation

gmarz
Copy link
Contributor

@gmarz gmarz commented Nov 3, 2014

This PR makes some improvements to how basic authorization is handled on the client.

Previously, basic authorization credentials needed to be specified on the URI:

var node = new Uri("http://user:password@localhost:9200");
var settings = new ConnectionSettings(node);

The above approach is still valid, however the following is now possible (and preferrred):

var node = new Uri("http://localhost:9200");
var settings = new ConnectionSettings(node)
    .SetBasicAuthorization("user", "password");

Credentials can also be specified at the request level:

var response = client.RootNodeInfo(r => r
    .RequestConfiguration(rc => rc
        .BasicAuthorization("user", "password")
    )
);

When determining what credentials to use, the client takes the following precedence (highest to lowest):

  • Request level
  • Connection settings level
  • URI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants