Skip to content

Question about usage of @WithMockJwtAuth #52

Answered by ch4mpy
theexiile1305 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @theexiile1305 ,

Sorry for late answer, I wasn't notified of your question.

Did you have a look at the sample modules? More specifically at the tutorials section? You'll find a few working sample, including one with @WithMockJwtAuth.

You might not have @Import / @ComponentScan your web-security config, (most probable reason for 200 on protected resource)

Side note, wit MokcMvc, the Authentication instance is not build from the Authorization header (do not expect to find one). It is build by an authentication factory provided with test annotation. You can inspect the built Authentication by accessing it from SecurityContextHolder.getContext().getAuthentication()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@theexiile1305
Comment options

Answer selected by theexiile1305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants