-
This is a dedicated point to answer a question asked by @fintans in an unrelated thread |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, actually, it is possible to write However, test libs in this repo are not producing base64 encoded JSON Web Tokens, later decoded, validated and turned into Instead, it is directly building
Why not producing actual JWTs and populating
|
Beta Was this translation helpful? Give feedback.
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:@WithMockJwtAuth
,@WithBearerTokenAuthentication
,@…