-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ZCS-8246 Fixing NPE with CSRF check (#987)
* ZCS-8246 Fixing NPE with CSRF check * ZCS-8246 Code review comments
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,24 @@ public final void testIsValidCsrfTokenForAccountWithMultipleTokens() { | |
} | ||
} | ||
|
||
@Test | ||
public final void testIsValidCsrfTokenForAccountWithNullAuthToken() { | ||
try { | ||
Account acct = Provisioning.getInstance().getAccountByName( | ||
"[email protected]"); | ||
AuthToken authToken = new ZimbraAuthToken(acct); | ||
|
||
String csrfToken1 = CsrfUtil.generateCsrfToken(acct.getId(), | ||
AUTH_TOKEN_EXPR, CSRFTOKEN_SALT, authToken); | ||
boolean validToken = CsrfUtil.isValidCsrfToken(csrfToken1, null); | ||
assertEquals(false, validToken); | ||
|
||
|
||
} catch (Exception e) { | ||
fail("Should not throw exception."); | ||
} | ||
} | ||
|
||
|
||
@Test | ||
public final void testIsCsrfRequestWhenCsrfCheckIsTurnedOn() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters