Better session cookie creation algorithm. Random number and timestamp are now

woven into one number. Both shorter and (presumably) more secure.
This commit is contained in:
hns 2002-07-29 18:11:51 +00:00
parent 7585b72d7f
commit 44aff437b4

View file

@ -148,8 +148,9 @@ public abstract class AbstractServletClient extends HttpServlet {
// check if we need to create a session id // check if we need to create a session id
if (reqtrans.session == null) { if (reqtrans.session == null) {
reqtrans.session = Long.toString (Math.round (Math.random ()*Long.MAX_VALUE), 16); reqtrans.session = Long.toString (
reqtrans.session += "@"+Long.toString (System.currentTimeMillis (), 16); Math.round (Math.random ()* Long.MAX_VALUE) -
System.currentTimeMillis (), 36);
Cookie c = new Cookie("HopSession", reqtrans.session); Cookie c = new Cookie("HopSession", reqtrans.session);
c.setPath ("/"); c.setPath ("/");
if (cookieDomain != null) if (cookieDomain != null)