rbd-target-api.py 文件源码

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

项目:ceph-iscsi-cli 作者: ceph 项目源码 文件源码
def requires_basic_auth(f):
    """
    wrapper function to check authentication credentials are valid
    """

    @wraps(f)
    def decorated(*args, **kwargs):

        # check credentials supplied in the http request are valid
        auth = request.authorization
        if not auth:
            return jsonify(message="Missing credentials"), 401

        if (auth.username != settings.config.api_user or
           auth.password != settings.config.api_password):
            return jsonify(message="username/password mismatch with the "
                                   "configuration file"), 401

        return f(*args, **kwargs)

    return decorated
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号