oidstore.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:mist.api 作者: mistio 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号