CSRF令牌的生存期应达到多长时间? [英] How long should the lifetime of a CSRF token be?

查看:216
本文介绍了CSRF令牌的生存期应达到多长时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的CSRF令牌的生存期是否应很短,还是可以在会话期间持续使用?

Should I have short lifetime for my CSRF token or can I have it last for the length of the session?

推荐答案

CSRF 令牌不是访问令牌,并且没有承载令牌那样的生存期。它们是使用会话信息生成的。

A CSRF token is not an access token and does not have a lifetime like bearer tokens do. They are generated using session information.

csrf_token = HMAC(session_token,application_secret)

CSRF将更多信息添加到您的请求中,使服务器可以验证请求是否来自授权位置。

CSRF adds additional information to your requests that lets the server verify the requests comes from an authorized location.

仅影响浏览器自动发送授权信息的请求(cookie身份验证或基本/摘要方案)

It only affects requests where the authorization info is sent automatically by the browser (cookie auth or basic/digest scheme)

这篇关于CSRF令牌的生存期应达到多长时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆