-
Notifications
You must be signed in to change notification settings - Fork 6k
Add WebFlux RequestDataValueProcessor #4762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Does this need any specific configuration steps besides // DEFAULT_CSRF_ATTR_NAME == "_csrf"
CsrfToken token = exchange.getAttribute(DEFAULT_CSRF_ATTR_NAME); ...but there is nothing there. Instead, the only Am I missing anything? is it normal that the CSRF token is not at the |
Unfortunately, at the moment, users must expose the CSRF token as a request attribute for it to be found. This is also true for the @ControllerAdvice
public class SecurityControllerAdvice {
private Mono<Principal> currentUser;
@ModelAttribute
Mono<CsrfToken> csrfToken(ServerWebExchange exchange) {
Mono<CsrfToken> csrfToken = exchange.getAttribute(CsrfToken.class.getName());
if (csrfToken == null) {
return Mono.empty();
}
return csrfToken.doOnSuccess(token -> exchange.getAttributes()
.put(CsrfRequestDataValueProcessor.DEFAULT_CSRF_ATTR_NAME, token));
}
@ModelAttribute("currentUser")
User currentUser(@CurrentUser User currentUser) {
return currentUser;
}
} The reason is that we don't know if the user needs the CSRF token, so we cannot subscribe to the cc @rstoyanchev |
Please see my comment on #5867. Version 3.0.10 of |
Summary
We need to provide integration with WebFlux RequestDataValueProcessor
The text was updated successfully, but these errors were encountered: