utils.py 文件源码

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

项目:morpheus 作者: tutorcruncher 项目源码 文件源码
def authenticate(self, request):
        token = re.sub('^Basic *', '', request.headers.get('Authorization', '')) or 'x'
        try:
            _, password = base64.b64decode(token).decode().split(':', 1)
        except (ValueError, UnicodeDecodeError):
            password = ''

        if not secrets.compare_digest(password, self.settings.admin_basic_auth_password):
            raise HTTPUnauthorized(text='Invalid basic auth', headers={'WWW-Authenticate': 'Basic'})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号