/**
* Taken from org.expressme.openid.MainServlet
*/
private void checkNonce(String nonce) {
// check response_nonce to prevent replay-attack:
if (nonce==null || nonce.length()<20) throw new OpenIdException("Verify failed.");
long nonceTime = getNonceTime(nonce);
long diff = System.currentTimeMillis() - nonceTime;
if (diff < 0) diff = (-diff);
if (diff > ONE_HOUR) throw new OpenIdException("Bad nonce time.");
if (isNonceExist(nonce)) throw new OpenIdException("Verify nonce failed.");
storeNonce(nonce, nonceTime + TWO_HOUR);
}