title: angular2 authenticate to spring http basic auth with end user credentials
body: <p>I have a bunch of REST web services powered by Spring Boot. These web services are protected by a basic http authentication.</p>
  
  <p>I try to create an Angular2 front end, hosted <strong>on another server</strong>. I want the front end to interact with the spring boot back end, using credentials provided by the user in the front end.</p>
  
  <p>Right now, the user can log in through the angular2 front end, but then, even with user authenticate, each call to the back end requires authentication, which is normal I guess.</p>
  
  <p>So my question is: how can I tell angular2 to automatically add the authorization header with the user credentials only when the user is logged?</p>
  
  <p>Thanks for your help</p>