V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wuwukai007
V2EX  ›  Python

django 的 csrf 在生产中可以用吗?公司用的 jwt,但是我看国外好多商用网站都用的 csrf !

  •  
  •   wuwukai007 · 2019-11-04 16:30:47 +08:00 · 3610 次点击
    这是一个创建于 1606 天前的主题,其中的信息可能已经有所发展或是发生改变。
    9 条回复    2019-11-05 10:27:33 +08:00
    zpfhbyx
        1
    zpfhbyx  
       2019-11-04 16:44:28 +08:00
    jwt 和 csrf 是两个东西...
    biu7
        2
    biu7  
       2019-11-04 16:49:35 +08:00
    csrf = Cross-site request forgery
    jwt = JSON Web Token
    你要是问 jwt 和 cookie 用哪个我还能理解。。。
    wuwukai007
        3
    wuwukai007  
    OP
       2019-11-04 16:51:42 +08:00 via Android
    我表达有问题,表单验证的话,会用自带的 csrf 吗
    find456789
        4
    find456789  
       2019-11-04 17:33:38 +08:00
    对,自带,且必须,且自动自带, 为了安全, 默认情况,你不用理会

    jwt 是认证方式, 类似的还有 session, 浏览器就用的 session,如果你做 app 就可能要用 jwt, 否则就用默认的
    libaibuaidufu
        5
    libaibuaidufu  
       2019-11-04 17:59:17 +08:00
    使用 jwt 前后端分离 ,csrf 还有用吗? csrf 不是在模板中使用的吗...
    wangyzj
        6
    wangyzj  
       2019-11-04 18:24:39 +08:00
    lz 没理解这俩东西啊
    optional
        7
    optional  
       2019-11-04 18:31:51 +08:00
    jwt in Authorization header 确实没什么必要再用 csrf
    vincentrrr
        8
    vincentrrr  
       2019-11-05 03:03:39 +08:00   ❤️ 1
    真希望这样的开发者能够越多越好
    laravel
        9
    laravel  
       2019-11-05 10:27:33 +08:00
    他的意思显然是直接提交表单还是 js 提交数据到 api
    都可以吧
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5876 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 02:01 · PVG 10:01 · LAX 19:01 · JFK 22:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.