You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Caldarale, Charles R" <Ch...@unisys.com> on 2008/12/16 21:38:08 UTC

RE: How to install the session cookie into the original request of the secure area?

> From: removeps-groups@yahoo.com [mailto:removeps-groups@yahoo.com]
> Subject: How to install the session cookie into the original
> request of the secure area?
>
> When making a connection to the secure area of my
> website through code, the original request is saved,
> but the JSESSIONID cookie is not added to it.

You need to invest* in a copy of Wireshark so you can see the differences in the requests that a browser sends vs the ones your client code makes.

 - Chuck

*It's open source, so the investment is primarily one of education.


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to install the session cookie into the original request ofthe secure area?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
> Subject: RE: How to install the session cookie into the
> original request ofthe secure area?
>
> You need to invest* in a copy of Wireshark so you can see the
> differences in the requests that a browser sends vs the ones
> your client code makes.

When I look at a packet trace of an access to a secured resource, I see the following:

<-- GET for secured resource
--> 200 with JSESSIONID cookie and login page
<-- POST with jsessionid parameter, JSESSIONID cookie, and credentials
--> 302 with original request
<-- GET for secured resource with JSESSIONID cookie

I suspect your client code is not including the JSESSIONID cookie on the GET after the 302.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to install the session cookie into the original request of the secure area?

Posted by Dominic Mitchell <do...@semantico.com>.
On 23 Dec 2008, at 04:56, removeps-groups@yahoo.com wrote:
> There are other requests such as wpad.dat.  No idea what that is.

It's a web-proxy auto detect file.

   http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol

-Dom


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: How to install the session cookie into the original request of the secure area?

Posted by re...@yahoo.com.
Was not able to figure out how to use Wireshark.  But I found an extension called Tamper Data for Firefox.

On browser I type https://localhost/myaccount/index.faces

Tamper Data shows
- a GET request for the above page with no JSESSIONID, which returns 200 - OK

There are other requests such as wpad.dat.  No idea what that is.  There are also requests to get the images and style sheets.

The above response is actually the login page.

Now I login.  Tamper Data shows
- a POST request for the http://localhost/myaccount/j_security_check page with JSESSION passed in

The server evidently returns status code 302 - moved temporarily to the above request, and the location returned is "http://localhost/myacccount/index.faces".

The above makes sense, because the code in FormAuthenticator.java is

            response.sendRedirect(response.encodeRedirectURL(requestURI));

which redirects the user to the saved page.

So the browser sends a request to the above page, passing in the JSESSIONID, but probably no body data as that has already been saved.

But in my application, the above call to sendRedirect does not send anything back to the client.  Instead, the server directly goes on to handle the saved request, as if the sendRedirect was a jsp:forward.

So why?

It seems my code needs to call

      HttpURLConnection.setFollowRedirects(false);

This way, when j_security_check finishes, my code sees the response code 302.  My code then resubmits the request, passing in JSESSIoNID.

It looks like the default behavior of HttpURLConnection is to automatically go to the redirect page (without adding the JSESSIONID).


--- On Tue, 12/16/08, Caldarale, Charles R <Ch...@unisys.com> wrote:

> From: Caldarale, Charles R <Ch...@unisys.com>
> Subject: RE: How to install the session cookie into the original request of the  secure area?
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Date: Tuesday, December 16, 2008, 12:38 PM
> > From: removeps-groups@yahoo.com
> [mailto:removeps-groups@yahoo.com]
> > Subject: How to install the session cookie into the
> original
> > request of the secure area?
> >
> > When making a connection to the secure area of my
> > website through code, the original request is saved,
> > but the JSESSIONID cookie is not added to it.
> 
> You need to invest* in a copy of Wireshark so you can see
> the differences in the requests that a browser sends vs the
> ones your client code makes.
> 
>  - Chuck
> 
> *It's open source, so the investment is primarily one
> of education.
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR
> OTHERWISE PROPRIETARY MATERIAL and is thus for use only by
> the intended recipient. If you received this in error,
> please contact the sender and delete the e-mail and its
> attachments from all computers.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail:
> users-help@tomcat.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org