java - Camunda BPM:CSRFPreventionFilter:无效的 HTTP 标头令牌
问题描述
我从 camunda BPM 开始,所以我使用https://start.camunda.com/创建 camunda spring boot 应用程序。我已经创建了具有虚拟/虚拟凭据的管理员用户,我将弹簧安全选项保持在与开始一样的位置。
当我启动应用程序时,每当我使用我的信用时,我都会收到以下错误:
Login Failed :
CSRFPreventionFilter: Invalid HTTP Header Token
我在 application.yml 中看不到任何相关设置
解决方案
看起来在给定版本的 Camunda 中存在错误。为了手动抑制 CSRFFilter 我添加了以下配置。之后它现在正在工作。
package com.example.workflow;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class CsrfAutoConfiguration {
private static final String CSRF_PREVENTION_FILTER = "CsrfPreventionFilter";
/**
* Overwrite csrf filter from Camunda configured here
* org.camunda.bpm.spring.boot.starter.webapp.CamundaBpmWebappInitializer
* org.camunda.bpm.spring.boot.starter.webapp.filter.SpringBootCsrfPreventionFilter
* Is configured with basically a 'no-op' filter
*/
@Bean
public ServletContextInitializer csrfOverwrite() {
return servletContext -> servletContext.addFilter(CSRF_PREVENTION_FILTER, (request, response, chain) -> chain.doFilter(request, response));
}
}
礼貌: https ://forum.camunda.org/t/how-to-disable-csrfpreventionfilter/13095/8
推荐阅读
- apache-spark - 如何在不调用 Hive 执行引擎的任何部分的情况下使用 SparkSQL 及其执行引擎来查询 Hive 数据库和表?
- sql - 在带有年份变化的 sql 中使用 STR_TO_DATE
- java - Spring Boot Web应用程序未在tomcat 9上运行
- cassandra - Cassandra 中的布尔值
- oracle - 这两种情况的最佳连接条件是什么
- sql - Netezza 中的左外连接
- android - 导航抽屉上的自定义徽章布局未正确显示
- .net - 正确的时间转换
- c# - 在存在文字“\”+“n”的情况下转义换行符
- javascript - JavaScript 按钮不再适用于移动设备