CsrfWebFilter supports multipart/form-data

Fixes gh-7576
This commit is contained in:
Rob Winch
2019-10-28 14:05:42 -05:00
parent 387f765595
commit 635f7e1edd
5 changed files with 148 additions and 11 deletions

View File

@@ -2731,6 +2731,19 @@ public class ServerHttpSecurity {
return this;
}
/**
* Specifies if {@link CsrfWebFilter} should try to resolve the actual CSRF token from the body of multipart
* data requests.
*
* @param enabled true if should read from multipart form body, else false. Default is false
* @return the {@link CsrfSpec} for additional configuration
*/
public CsrfSpec tokenFromMultipartDataEnabled(boolean enabled) {
this.filter.setTokenFromMultipartDataEnabled(enabled);
return this;
}
/**
* Allows method chaining to continue configuring the {@link ServerHttpSecurity}
* @return the {@link ServerHttpSecurity} to continue configuring