Skip to content
Discussion options

You must be logged in to vote

Yes, actually, it is possible to write @SpringBootTest with mocked user identities. I added integration tests with @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.MOCK) to all samples to demo that.

However, test libs in this repo are not producing base64 encoded JSON Web Tokens, later decoded, validated and turned into Authentication by Spring framework.

Instead, it is directly building Authentication instances (JwtAuthenticationToken, BearerTokenAuthentication, OAuthentication<OpenidClaimSet>, etc.) and populates test security context with it.
Test Authentication are build as specified by one of the following:

  • annotations (@WithMockJwtAuth, @WithBearerTokenAuthentication, @…

Replies: 1 comment

Comment options

ch4mpy
Oct 23, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by ch4mpy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant