GUACAMOLE-839: Allow testing of null nonce values.

This commit is contained in:
Michael Jumper
2023-01-26 11:35:44 -08:00
parent 2e8cf82234
commit 6bf0b8cf63

View File

@@ -120,13 +120,18 @@ public class NonceService {
* invalidates that nonce. * invalidates that nonce.
* *
* @param nonce * @param nonce
* The nonce value to test. Comparisons are case-insensitive. * The nonce value to test. This value may be null, which will be
* considered an invalid nonce. Comparisons are case-insensitive.
* *
* @return * @return
* true if the provided nonce is valid, false otherwise. * true if the provided nonce is valid, false otherwise.
*/ */
public boolean isValid(String nonce) { public boolean isValid(String nonce) {
// All null nonces are invalid.
if (nonce == null)
return false;
// Remove nonce, verifying whether it was present at all // Remove nonce, verifying whether it was present at all
Long expires = nonces.remove(nonce.toLowerCase(Locale.US)); Long expires = nonces.remove(nonce.toLowerCase(Locale.US));
if (expires == null) if (expires == null)