use of com.zimbra.cs.ephemeral.EphemeralInput.Expiration in project zm-mailbox by Zimbra.
the class CsrfUtil method storeTokenData.
/**
* @param tokenSalt
* @param accountId
* @param authTokenExpiration
* @param crumb
* @throws ServiceException
*/
private static void storeTokenData(String data, AuthToken authToken, long authTokenExpiration, String crumb) throws ServiceException {
Account account = getAccount(authToken, Boolean.TRUE);
if (account != null) {
Expiration expiration = new AbsoluteExpiration(authTokenExpiration);
boolean needToAdd = true;
String curData = account.getCsrfTokenData(crumb);
if (curData != null) {
if (!data.equals(curData)) {
account.removeCsrfTokenData(crumb, curData);
} else {
ZimbraLog.ephemeral.debug("CSRF token already stored in ephemeral storage");
needToAdd = false;
}
}
if (needToAdd) {
account.addCsrfTokenData(crumb, data, expiration);
}
}
}
Aggregations