【问题标题】:Camunda BPM : CSRFPreventionFilter: Invalid HTTP Header TokenCamunda BPM:CSRFPreventionFilter:无效的 HTTP 标头令牌
【发布时间】:2020-07-08 10:28:31
【问题描述】:

我从 camunda BPM 开始,所以我使用 https://start.camunda.com/ 创建 camunda spring boot 应用程序。我已经创建了具有虚拟/虚拟凭据的管理员用户,我将 spring 安全选项保持在与 start 一样的位置。

入门设置一目了然:

当我启动应用程序时,每当我使用我的凭据时都会出现以下错误:

Login Failed :
CSRFPreventionFilter: Invalid HTTP Header Token

我在 application.yml 中没有看到任何相关设置

【问题讨论】:

    标签: java spring spring-boot camunda business-process-management


    【解决方案1】:

    看起来在给定版本的 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

    【讨论】:

      猜你喜欢
      • 2016-11-27
      • 1970-01-01
      • 1970-01-01
      • 2021-04-12
      • 2013-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多