Sunday, 8 July 2012

How to make the session in a Web Application secure


  • Using HTTPS to transfer session id and cookies as well. (If cookie is transferred over HTTP it can be easily stolen and used for impersonation)
  • Sending an entropic unique token in the hidden field in the page. The server authenticates the user based on this token, otherwise rejects the user request.
  • Session id/token should be unpredictable. Could be generated using java.security.SecureRandom class in Java or as explained in the post: http://technocratme.blogspot.in/2012/04/universally-unique-identifier-uuid.html
  • To confirm the authenticity of the sender of request, one can compare the sender's IP address with the IP of the user who created the session.

No comments:

Post a Comment