OAuth2ResourceServerConfigurerTests should avoid MockWebServer
See original GitHub issueNow that there is support to create a JWTProcessor
using a RestOperations
, several of the tests in OAuth2ResourceServerConfigurerTests
that relied on a MockWebServer
can now rely on a mock RestOperations
, making the tests faster.
Or, as an alternative, they could be configured to use a single key instead of a JWK Set, where applicable.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Testing REST APIs Using MockWebServer - Kodeco
Learn how to mock a REST API with MockWebServer and easily test your ... You have to start the server before every test...
Read more >spring-projects/spring-security 5.2.0.M2 on GitHub - NewReleases.io
... OAuth2ResourceServerConfigurerTests should avoid MockWebServer #6104; OAuth2AuthorizationRequest.additionalParameters should not contain registration_id ...
Read more >Class MockWebServer
public final class MockWebServer extends org.junit.rules. ... Automated tests should always use port 0 to avoid flakiness when a specific port is ...
Read more >org.springframework.security.oauth2.jwt.JwtProcessors ...
... in the OpenID Configuration " + "did not match the requested issuer \"" + ... Exception { try ( MockWebServer server =...
Read more >Test Spring WebClient with MockWebServer from OkHttp
Unfortunately, this test setup does not work for the Spring ... The following usage of the Spring WebClient should look familiar to you: ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes. I will give it a try on upcoming Saturday, Sunday.
@govi20 Many of these tests use a common spring configuration, declared there in the tests class itself. In most cases, the reference to
WebServerConfig
will be removed along with the line to configure its mock response.For example, in the case of this test:
I would change this to:
Many of the tests don’t actually need to be configured with a JWK Set URI to confirm their functionality since that is not what they are testing. In those cases, a single key is preferred.
When the JWK Set endpoint is being tested, then it should use a
RestOperations
, as you have outlined.For example, this test:
Could change to: