BASIC Authentication
The {@link oajr.client2.RestClientBuilder#basicAuth(String,int,String,String)} method
can be used to quickly enable BASIC authentication support.
// Create a client that performs BASIC authentication using the specified user/pw.
RestClient client = RestClient.create()
.basicAuth(HOST, PORT, USER, PW)
.build();
This is functionally equivalent to the following:
RestClientBuilder builder = RestClient.create();
AuthScope scope = new AuthScope(HOST, PORT);
Credentials up = new UsernamePasswordCredentials(USER, PW);
CredentialsProvider p = new BasicCredentialsProvider();
p.setCredentials(scope, up);
builder.setDefaultCredentialsProvider(p);