bindcache.py 文件源码

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

项目:privacyidea-ldap-proxy 作者: NetKnights-GmbH 项目源码 文件源码
def is_cached(self, dn, app_marker, password):
        """
        Determines whether the given credentials are found in the bind cache.
        :param dn: user distinguished name
        :param app_marker: app marker as string
        :param password: user password
        :return: a boolean
        """
        item = (dn, app_marker, password)
        if item in self._cache:
            current_time = reactor.seconds()
            inserted_time = self._cache[item]
            # Even though credentials **should** be removed automatically by ``callLater``, check
            # the stored timestamp.
            if current_time - inserted_time < self.timeout:
                return True
            else:
                log.info('Inconsistent bind cache: dn={dn!r}, marker={marker!r},'
                         'inserted={inserted!r}, current={current!r}',
                    dn=dn, marker=app_marker, inserted=inserted_time, current=current_time,
                )
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号