Describe the bug
While migrating from SpringBoot 3.5.11 to SpringBoot 4.0.3, I can not succeed migrating tests related to oauth2 login.
I observe 401 while I expected to get 200.
I tested various things:
- with and without
.oauth2Login(oauth2 -> {})
- with and without BASIC
- with
bindToApplicationContext
- and various other configuration suggested by LLMs.
At the opposite of the test-tooling spectrum (i.e. bare-hand setup and mocking), I also added UserControllerTest (from some LLM) which has proper mocked authentication. But at the cost of skipping manually implicit configuration (e.g. from annotations).
To Reproduce
Run bug_report.oauth2.TestSecurity_WithOAuth2_asOAuth2User.testLoginJson() in provided github reproduction repository.
Expected behavior
I expect a 200, as I expect the call to be authenticated, with the test based on @SpringBootTest, @AutoConfigureWebTestClient and SecurityMockServerConfigurers.mockOAuth2Login().
Sample
See https://github.com/solven-eu/sb4-oauth2-migration_issue
Describe the bug
While migrating from SpringBoot 3.5.11 to SpringBoot 4.0.3, I can not succeed migrating tests related to oauth2 login.
I observe 401 while I expected to get 200.
I tested various things:
.oauth2Login(oauth2 -> {})bindToApplicationContextAt the opposite of the test-tooling spectrum (i.e. bare-hand setup and mocking), I also added
UserControllerTest(from some LLM) which has proper mocked authentication. But at the cost of skipping manually implicit configuration (e.g. from annotations).To Reproduce
Run
bug_report.oauth2.TestSecurity_WithOAuth2_asOAuth2User.testLoginJson()in provided github reproduction repository.Expected behavior
I expect a 200, as I expect the call to be authenticated, with the test based on
@SpringBootTest,@AutoConfigureWebTestClientandSecurityMockServerConfigurers.mockOAuth2Login().Sample
See https://github.com/solven-eu/sb4-oauth2-migration_issue