Skip to content

Commit d0c0bc0

Browse files
committed
Try both http and https in known user check
1 parent 8ff1de1 commit d0c0bc0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

QueueIT.Security/src/queueit/security/KnownUserFactory.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,14 @@ private static String getExpectedHash(String url)
230230

231231
private static void validateHash(String requestUrl, String sharedEventKey, String expectedHash) {
232232
String stringToHash = requestUrl.substring(0, requestUrl.length() - 32) + sharedEventKey; //Remove hash value and add SharedEventKey
233-
String actualHash = Hashing.getMd5Hash(stringToHash);
233+
String actualHashHttp = Hashing.getMd5Hash(stringToHash.replaceFirst("^https://(.*)$", "http://$1"));
234+
String actualHashHttps = Hashing.getMd5Hash(stringToHash.replaceFirst("^http://(.*)$", "https://$1"));
234235

235-
if (!actualHash.equals(expectedHash)) {
236-
throw new InvalidKnownUserHashException();
236+
if (actualHashHttp.equals(expectedHash) || actualHashHttps.equals(expectedHash)) {
237+
return;
237238
}
239+
240+
throw new InvalidKnownUserHashException();
238241
}
239242

240243
private static void validateUrl(String url) {

0 commit comments

Comments
 (0)