flask_jwt.py 文件源码

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

项目:opp 作者: openpassphrase 项目源码 文件源码
def init_app(self, app):
        for k, v in CONFIG_DEFAULTS.items():
            app.config.setdefault(k, v)

        auth_url_rule = app.config.get('JWT_AUTH_URL_RULE', None)

        if auth_url_rule:
            if self.auth_request_callback == _default_auth_request_handler:
                msg = ("an authentication_handler function must be defined "
                       "when using the built in authentication resource")
                assert self.authentication_callback is not None, (msg)

            auth_url_options = app.config.get('JWT_AUTH_URL_OPTIONS',
                                              {'methods': ['POST']})
            auth_url_options.setdefault('view_func',
                                        self.auth_request_callback)
            app.add_url_rule(auth_url_rule, **auth_url_options)

        app.errorhandler(JWTError)(self._jwt_error_callback)

        if not hasattr(app, 'extensions'):  # pragma: no cover
            app.extensions = {}

        app.extensions['jwt'] = self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号