kubeauth.py 文件源码

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

项目:commissaire-mvp 作者: projectatomic 项目源码 文件源码
def _decode_bearer_auth(self, req):
        """
        Decodes basic auth from the header.

        :param req: Request instance that will be passed through.
        :type req: falcon.Request
        :returns: token or None if empty.
        :rtype: str
        """
        self.logger.debug('header: {}'.format(req.auth))
        if req.auth is not None:
            if req.auth.lower().startswith('bearer '):
                decoded = req.auth[7:]
                self.logger.debug('Token given: {0}'.format(decoded))
                return decoded
            else:
                self.logger.debug(
                    'Did not find bearer in the Authorization '
                    'header from {0}.'.format(req.remote_addr))
        # Default meaning no user or password
        self.logger.debug('Authentication for {0} failed.'.format(
            req.remote_addr))
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号