I have two servers in my application and both the servers have the support to authenticate its users sending http requests to them. I want to create the following setup in my application. Could you please if it is feasible to create following setup? If so, could you please let me know the ways to achieve it?
If a particular http request is sent from remote-user to Server1, then Server1 should resend the same request to Server2 with the user as remote-user instead of server user account. Then Server1 will process the results obtained from Server2 and send the response to remote-user [browser].
I tried connecting server2 using HttpURLConnection() in server1 but it is sending the request to server2 with Server1 user account instead of remote-user account. Please let me know your suggestions.
This is not a coding service. Have you looked for yourself? If I was referred to a Java class in answer to a question I would immediately look up its Javadoc and try to understand how to use it.
When you've done that and have a further concrete question, let us know.