5

I would like to disable security on endpoints during some unit tests. I am using webflux functional endpoints so the below configuration does not work.

@AutoConfigureMockMvc(secure = false)

I desactivated it by using profiles, but that means I cannot test security with test profile anymore. Is there another way to do it with webflux ?

Thanks in advance for your helps

3
  • have a look at stackoverflow.com/questions/23894010/… Commented Apr 28, 2020 at 15:23
  • can you post your endpoint and the mockmvc test you are trying to test against. Also the version of spring that you are using. It not very clear what you are trying to achieve. After spring boot 2.2 disabling spring security with secure=false in MockMvc is not even an option Commented Apr 28, 2020 at 23:47
  • @gkc123 I am not using mockMvc, as stated in the question I am using webflux, so a @WebFluxTest config and A WebTestClient Commented Apr 29, 2020 at 9:48

1 Answer 1

9

you can add :

@WebFluxTest(controllers = XXXX , excludeAutoConfiguration = {ReactiveSecurityAutoConfiguration.class})

Sign up to request clarification or add additional context in comments.

3 Comments

This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
@ChathurangaChandrasekara: You may want to review this post regarding low quality answers. Code only answers that make a sincere attempt to answer the question are, in fact, answers and should not be deleted.
That said, @meriam, please edit your answer to provide more explanation. Remember, we're not just here to the answer specific, narrow question that the OP asked, but to help developers with very similar problems solve their problems. By offering explanation, you help developers understand not just the what but also the why. Will you kindly edit your answer to provide that?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.