Match method to detect a client token to the way a client token is generated.
[jSite2.git] / src / net / pterodactylus / jsite / core / RequestManager.java
index 831c9b3..df4d1cc 100644 (file)
@@ -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;
        }