From: David ‘Bombe’ Roden Date: Sat, 23 May 2009 16:35:45 +0000 (+0200) Subject: Match method to detect a client token to the way a client token is generated. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b59da5ade431a7da253a1cad948e517a736b844f;p=jSite2.git Match method to detect a client token to the way a client token is generated. --- diff --git a/src/net/pterodactylus/jsite/core/RequestManager.java b/src/net/pterodactylus/jsite/core/RequestManager.java index 831c9b3..df4d1cc 100644 --- a/src/net/pterodactylus/jsite/core/RequestManager.java +++ b/src/net/pterodactylus/jsite/core/RequestManager.java @@ -120,11 +120,17 @@ public class RequestManager implements NodeListener { if (projectIdString.length() != (IdGenerator.DEFAULT_LENGTH * 2)) { return false; } + int clientTokenHashCode = -1; try { Hex.toByte(projectIdString); + Long.valueOf(clientTokenParts[1]); + clientTokenHashCode = Integer.valueOf(clientTokenParts[2]); } catch (NumberFormatException nfe1) { return false; } + if ((clientTokenParts[0] + "." + clientTokenParts[1]).hashCode() != clientTokenHashCode) { + return false; + } return true; }