• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pass on HTTP request to external server

 
Laurence Prescott
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are trying to work out how to pass on a request to an external server and catch the response in code.
The situation is this:
Most users need authenticating against AD, but some we'll handle differently.
Our server doesn't have access into our corporate domain so can't authenticate users against Active Directory.
We have been supplied with an aspx page on another server that will do this authentication then redirect the client back to our server with their username in the query string.
Currently we check any new requests, and if we have not yet authenticated the user we use a response.sendRedirect() call to pass them on to the authenticating server.

The problem is this: if the authenticating server's authentication fails, it sends a message back to the client that makes no sense to the user and they can't access our web site. In this case we'd like to handle this (failed) user differently, but have no way of knowing of the authentication failure.
So basically we would like to pass on the original request to the authenticating server and catch the response.
If the response is an authentication challenge we need to pass this back to the client (to facilitate the authorization mechanism).
If the response is a redirection back to our server we know the user is okay and can serve them what they need.
If the response is the failure message we want to do something else.

Is this possible or is it not allowed due to security risks.

We are running Tomcat5 on Windows 2000 Server.

Thanks,
Howd
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64716
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the classes in java.net (notably URL and URLConnection) or a library such as HttpClient.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Laurence Prescott
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear and Rob,
Greetings and thanks for the welcome.
Sorry about the slow response (how rude!).
I've was pulled of this task for the moment but will let you know any results I achieve.

Nice to be part of the ranch.
Howd
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic