aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/config
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-11-14 17:53:35 +0300
committerGravatar Vitaly Takmazov2021-11-14 17:53:35 +0300
commit451a462996c7b4d55cd2461f961defe11cc4e136 (patch)
treea1684b8cd8dba0b6c1f88ae0b6c19723dcb5cfde /src/main/java/com/juick/config
parent90884d525456e4644723e416424f1581661b2aa8 (diff)
Handle rejected requests with error 400
Diffstat (limited to 'src/main/java/com/juick/config')
-rw-r--r--src/main/java/com/juick/config/WebConfig.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/com/juick/config/WebConfig.java b/src/main/java/com/juick/config/WebConfig.java
index fcd9a46b..59f9a99c 100644
--- a/src/main/java/com/juick/config/WebConfig.java
+++ b/src/main/java/com/juick/config/WebConfig.java
@@ -45,6 +45,8 @@ import org.springframework.core.io.Resource;
import org.springframework.http.CacheControl;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.security.web.firewall.HttpStatusRequestRejectedHandler;
+import org.springframework.security.web.firewall.RequestRejectedHandler;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -204,4 +206,8 @@ public class WebConfig implements WebMvcConfigurer {
public User archiveUser() {
return userService.getUserByName(archiveUsername);
}
+ @Bean
+ public RequestRejectedHandler requestRejectedHandler() {
+ return new HttpStatusRequestRejectedHandler();
+ }
}