title: Basic Authentication with Resteasy client
body: <p>I'm trying to perform an basic auth to the login-module which runs on my jboss using REST. I already found an StackOverflow topic which explains how to authenticate with credentials.</p>
  
  <p><a href="https://stackoverflow.com/questions/1885844/resteasy-client-framework-authentication-credentials">RESTEasy client framework authentication credentials</a></p>
  
  <p>This does not work. Analysing the established connection with Wireshark I was not able to see an HTTP package with Authorization: Basic. After more research I found this article, <a href="http://docs.jboss.org/resteasy/docs/2.3.3.Final/userguide/html/RESTEasy_Client_Framework.html" rel="noreferrer">http://docs.jboss.org/resteasy/docs/2.3.3.Final/userguide/html/RESTEasy_Client_Framework.html</a> which describes how to append basic auth to <code>ApacheHttpClient4Executor</code> from resteasy.</p>
  
  <pre class="lang-java prettyprint-override"><code>// Configure HttpClient to authenticate preemptively
  // by prepopulating the authentication data cache.
  
  // 1. Create AuthCache instance
  AuthCache authCache = new BasicAuthCache();
  
  // 2. Generate BASIC scheme object and add it to the local auth cache
  BasicScheme basicAuth = new BasicScheme();
  authCache.put("com.bluemonkeydiamond.sippycups", basicAuth);
  
  // 3. Add AuthCache to the execution context
  BasicHttpContext localContext = new BasicHttpContext();
  localContext.setAttribute(ClientContext.AUTH_CACHE, authCache);
  
  // 4. Create client executor and proxy
  httpClient = new DefaultHttpClient();
  ApacheHttpClient4Executor executor = new ApacheHttpClient4Executor(httpClient, localContext);
  client = ProxyFactory.create(BookStoreService.class, url, executor);
  </code></pre>
  
  <p>But this does not work either. There is no description how to append username and passwort for basic auth to the construct. Why is that information not associated with any class from <code>httpcomponent</code>?</p>