java - Opening a password-protected website from servlet -


The purpose of the scenario is that the user will use the servlet (for example) which in turn authenticated The password is protected by the website (such as use Windows authentication on the IIS server is enabled) interrupts and then opens - so:

  1. The target user will not get prompt for userName;
  2. Any other user will not be able to use without knowing the credentials

is required

Is this possible in Java (HTP URL connection)? << strong> / P>

Any help is appreciated.

Thanks

To ensure that I understand your needs, This is a summary: You want to connect to User A on your first server Server1.domain1.com, which will connect to another server server2.domain2.com (currently under IIS) (from inside Java Server). Then the server 1 will send the user to the server 2 web page, challenge to avoid any authentication popup.

Root problem is to be transmitted from server 1 to client browser, then from client browser to server 2, authentication ticket server 1 was found from server2.

This is not particularly a Java problem, but there is more global web problem. In fact, the only information received by Server 2 to identify the client user is in the http stream, in less words the IP address, the URL, and the cookies.

If server1 and server2 are not the same then cookies are a dead end domain (see RFC 2109), because the browser will send the cookie only on the server of a given domain if the cookie is same The server was returned from the server (the same or the other)

The answer is a two step process:

  • First of all, server 1 should get a session ID from server 2, possibly submitting an HTTP request with the appropriate credentials. To (original-certified? Form field? Or worst, "domain like Windows Auth"?). For this step, I suggest using the apache httpclient library.
  • Second, the server 1 should forward the client user to the appropriate URL of Server 2, in which session ID is included in the argument, it is necessary that there is such a possibility in server 2 .

At first sight I do not see any other simple solution.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -