password – Show contents of a basic authentication login-protected site on my site with a proxy

I administer website A that provides information for a number of users. Website B is an external website containing information that I would like to provide to the users of site A. Login credentials via basic HTTP authentication are required to access B. As the users of A do not know these login credentials, I am searching for a way to have the server of A (which I have full access to) acting like some sort of proxy between the users of site A and site B itself.

Here’s how I imagine the sequence of actions:

  1. User X clicks a link on A, a new browser window (or tab) opens
  2. Server A logs in to B
  3. B is mirrored to the new tab on X’s browser
  4. X is now seeing B as if he had logged in himself
  5. When X clicks a link on B, the HTTP request is not directly handled by B, instead A forwards the request to B and B’s reply to X

The main goal is to enable the users to access B without having to know the login credentials.
A nice extra would be if B would only see A’s IP, not the user’s IP.

Because information on B changes frequently, using a method similar to creating a snapshot of B that is hosted on A won’t work even if that snapshot is created in regular intervals.