def useNonce(self, server_url, timestamp, salt):
"""Called when using a nonce.
This method should return C{True} if the nonce has not been
used before, and store it for a while to make sure nobody
tries to use the same value again. If the nonce has already
been used or the timestamp is not current, return C{False}.
You may use L{openid.store.nonce.SKEW} for your timestamp window.
"""
if is_nonce_old(timestamp):
return False
try:
mist_nonces = MistNonce.objects(server_url=server_url, salt=salt,
timestamp=timestamp)
except me.DoesNotExist:
mist_nonces = []
if len(mist_nonces) == 0:
print "Timestamp = %s" % timestamp
MistNonce(server_url=server_url, salt=salt, timestamp=timestamp).save()
return True
return False
评论列表
文章目录