在Spring Boot Web应用程序中禁用csrf的原因是什么? [英] What is the reason to disable csrf in spring boot web application?

查看:502
本文介绍了在Spring Boot Web应用程序中禁用csrf的原因是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有许多教程,其中显示了如何禁用csrf,

There are many tutorials where is shown how to disable csrf,

csrf().disable()

(以及其他可能性,例如.properties.yml等) 但是没有人解释他们为什么这样做?

(and other possibilities like .properties, .yml, etc.) but nowhere explained why they do this?

所以我的问题是:

禁用它的现实原因是什么?
它可以提高性能吗?

What is the real-life reason to disable it?
Is it improves performance?

推荐答案

禁用它的现实原因是什么?

What is the real-life reason to disable it?

Spring文档建议:

The Spring documentation suggests:

我们的建议是对普通用户可能由浏览器处理的任何请求使用CSRF保护. 如果您仅创建非浏览器客户端使用的服务,则可能要禁用CSRF保护.


它可以提高性能吗?

Does it improve performance?

它不应该影响性能.过滤器(或其他组件)将从请求处理链中删除,以使该功能不可用.

It shouldn't impact the performance. A filter (or another component) will be removed from the request processing chain to make the feature unavailable.

在Spring Boot应用程序中禁用csrf的原因是什么?

  1. 您正在使用另一种令牌机制.
  2. 您要简化客户端与服务器之间的交互.

这篇关于在Spring Boot Web应用程序中禁用csrf的原因是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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