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
bindcache.py 文件源码
python
阅读 31
收藏 0
点赞 0
评论 0
评论列表
文章目录