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:
parent
7585b72d7f
commit
44aff437b4
1 changed files with 3 additions and 2 deletions
|
@ -148,8 +148,9 @@ public abstract class AbstractServletClient extends HttpServlet {
|
|||
|
||||
// check if we need to create a session id
|
||||
if (reqtrans.session == null) {
|
||||
reqtrans.session = Long.toString (Math.round (Math.random ()*Long.MAX_VALUE), 16);
|
||||
reqtrans.session += "@"+Long.toString (System.currentTimeMillis (), 16);
|
||||
reqtrans.session = Long.toString (
|
||||
Math.round (Math.random ()* Long.MAX_VALUE) -
|
||||
System.currentTimeMillis (), 36);
|
||||
Cookie c = new Cookie("HopSession", reqtrans.session);
|
||||
c.setPath ("/");
|
||||
if (cookieDomain != null)
|
||||
|
|
Loading…
Add table
Reference in a new issue