I use the following code to make an authorization,however,i do not know how to return a response defined by myself!
@Bean
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http.securityContextRepository(this.securityContextRepository);
http.authorizeExchange().pathMatchers(AUTH_WHITELIST).permitAll();
http.authorizeExchange().pathMatchers(PATHMATCHER).hasRole("USER");
http.authorizeExchange().anyExchange().authenticated();
// i want to change the response content use the json object defined by myself,not the response header and statuscode. In servlet ,like this: response.getWriter().write("...").
return http.build();
}
Comment From: eleftherias
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add a minimal sample that reproduces this issue if you feel this is a genuine bug.
You may find it helpful to look at this Stack Overflow question, which seems similar to what you are asking.