-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: webAn issue in web modules (web, webmvc)An issue in web modules (web, webmvc)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
Summary
By default, Spring Boot web application with CSRF enabled, unless doing http.csrf().disabled()
explicitly. HTTP POST to RESTful API with basic authentication, will be rejected as 401 UNAUTHORIZED
. And server side, no specific logging even after enabling debug output.
Propose to provide debug logs in CsrfFilter after matches in Line 196 failed.
Actual Behavior
Client side receives 401 status code, and server side no specific logs.
Expected Behavior
Server side provides debug log "POST is not supported while CSRF enabled" or alike, to help developers trouble shoot.
Configuration
See Sample.
Version
5.1.6.RELEASE
Sample
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().authenticated()
.and().httpBasic();
// http.csrf().disable(); // comment this line, client POST failed with 401
}
Tim-Rapp
Metadata
Metadata
Assignees
Labels
in: webAn issue in web modules (web, webmvc)An issue in web modules (web, webmvc)status: invalidAn issue that we don't feel is validAn issue that we don't feel is valid