Closed 13940344135 closed 4 years ago
Thanks for reaching out, @13940344135. Sorry, but there is no support for combining WebFlux and MVC in the same application.
Hi all,
I found a hack way to make that work, basically need to apply this https://github.com/spring-cloud/spring-cloud-gateway/issues/474#issuecomment-533429469 and also disable the request cache on downstream service.
Spring Cloud Gateway(Redis Session) -> Downstream Backend Service(Redis)
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
return http.csrf().disable()
.authorizeHttpRequests()
.antMatchers("/actuator/**", "/error").permitAll()
.anyRequest()
.authenticated()
.and()
.formLogin().disable()
.requestCache().disable()
.build();
}
can I save the request to redis in spring mvc and then restore the request after webflux authentication?
Added: I used two services, mvc and webflux. When webflux is not authenticated, it will be redirected to the mvc login page. However, an exception will occur at this time. java.lang.ClassCastException: class java.lang.String cannot be cast to class org.springframework.security.web.savedrequest.SavedRequest