/** * Validates the nonce. * * @param consumerKey consumer key * @param timestamp timestamp as the number of seconds since January 1, 1970 00:00:00 GMT (according to OAuth 1.0 spec) * @param nonce nonce * @throws OAuthProblemException if the nonce has been used. */ public void validateNonce(String consumerKey, long timestamp, String nonce) throws OAuthProblemException { Preconditions.checkNotNull(consumerKey); Preconditions.checkNotNull(nonce); NonceEntry entry = new NonceEntry(consumerKey, timestamp, nonce); synchronized (NONCES) { if (NONCES.contains(entry)) { throw new OAuthProblemException(OAuth.Problems.NONCE_USED); } else { NONCES.add(entry); } cleanupNonces(); } }