You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by xi...@apache.org on 2024/09/11 07:27:24 UTC

(incubator-seata) branch 2.x updated: bugfix: Fix 403 error when sending a POST request from the console (#6843)

This is an automated email from the ASF dual-hosted git repository.

xingfudeshi pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/incubator-seata.git


The following commit(s) were added to refs/heads/2.x by this push:
     new 42f3ae7271 bugfix: Fix 403 error when sending a POST request from the console (#6843)
42f3ae7271 is described below

commit 42f3ae72716292faf297f73ad9367d7b5409ae02
Author: xingfudeshi <xi...@gmail.com>
AuthorDate: Wed Sep 11 15:27:20 2024 +0800

    bugfix: Fix 403 error when sending a POST request from the console (#6843)
---
 changes/en-us/2.x.md                                                  | 2 +-
 changes/zh-cn/2.x.md                                                  | 2 +-
 .../main/java/org/apache/seata/console/config/WebSecurityConfig.java  | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/changes/en-us/2.x.md b/changes/en-us/2.x.md
index 63d681c47f..9604928b5f 100644
--- a/changes/en-us/2.x.md
+++ b/changes/en-us/2.x.md
@@ -42,7 +42,7 @@ Add changes here for all PR submitted to the 2.x branch.
 - [[#6833](https://github.com/apache/incubator-seata/pull/6833)] SQLIntegrityConstraintViolationException capture incorrectly when inserting a globallock
 - [[#6835](https://github.com/apache/incubator-seata/pull/6835)] Fix the issue of missing request body of post method in HttpClientUtil
 - [[#6840](https://github.com/apache/incubator-seata/pull/6840)] Fix the issue of unsafe deserialization in ProcessorYaml.java
-
+- [[#6843](https://github.com/apache/incubator-seata/pull/6843)] Fix 403 error when sending a POST request from the console
 
 
 ### optimize:
diff --git a/changes/zh-cn/2.x.md b/changes/zh-cn/2.x.md
index 9868fa5fec..ffaff16529 100644
--- a/changes/zh-cn/2.x.md
+++ b/changes/zh-cn/2.x.md
@@ -43,7 +43,7 @@
 - [[#6833](https://github.com/apache/incubator-seata/pull/6833)] 插入全局锁时 SQLIntegrityConstraintViolationException 捕获不正确
 - [[#6835](https://github.com/apache/incubator-seata/pull/6835)] 修复HttpClientUtil中post方法请求体缺失的问题
 - [[#6840](https://github.com/apache/incubator-seata/pull/6840)] 修复ProcessorYaml中不安全的反序列化
-
+- [[#6843](https://github.com/apache/incubator-seata/pull/6843)] 修复从控制台发送POST请求时出现的403错误
 
 ### optimize:
 - [[#6499](https://github.com/apache/incubator-seata/pull/6499)] 拆分 committing 和 rollbacking 状态的任务线程池
diff --git a/console/src/main/java/org/apache/seata/console/config/WebSecurityConfig.java b/console/src/main/java/org/apache/seata/console/config/WebSecurityConfig.java
index f99c69360b..06a25c2b0c 100644
--- a/console/src/main/java/org/apache/seata/console/config/WebSecurityConfig.java
+++ b/console/src/main/java/org/apache/seata/console/config/WebSecurityConfig.java
@@ -35,6 +35,7 @@ import org.springframework.security.config.http.SessionCreationPolicy;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
+import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
 
 /**
  * Spring security config
@@ -101,7 +102,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
             // custom token authorize exception handler
             .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
             // since we use jwt, session is not necessary
-            .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).disable();
+            .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).disable()
+            .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
             // don't disable csrf, jwt may be implemented based on cookies
         http.addFilterBefore(new JwtAuthenticationTokenFilter(tokenProvider),
             UsernamePasswordAuthenticationFilter.class);


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org