{title:'BASIC Authentication'}

The {@link oajrc.RestClient.Builder#basicAuth(String,int,String,String)} method can be used to quickly enable BASIC authentication support.

Example:

| // 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:

| RestClient.Builder builder = RestClient.create(); | AuthScope scope = new AuthScope(HOST, PORT); | Credentials up = new UsernamePasswordCredentials(USER, PW); | CredentialsProvider provider = new BasicCredentialsProvider(); | provider.setCredentials(scope, up); | builder.setDefaultCredentialsProvider(provider);