-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add discoverJwsAlgorithms()
in NimbusJwtDecoder
#17788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@therepanic are you able to add a unit test that shows this feature working? I imagine there is a similar test for |
Hi, @jzheaux! The problem turned out to be a little deeper than I expected. Because I didn't take a few things into account, it turns out that when the entire project is compiled, the test runs indefinitely. Let's go through everything in order. First, in my original change, the test The problem with Now it is worth discussing the fact that some tests can run indefinitely, and let's take RestOperations restOperations = mock(RestOperations.class);
given(restOperations.exchange(any(RequestEntity.class), any(ParameterizedTypeReference.class)))
.willReturn(new ResponseEntity<>(Map.of(“issuer”, issuer, ‘jwks_uri’, issuer + “/jwks”), HttpStatus.OK));
given(restOperations.exchange(any(RequestEntity.class), eq(String.class))) However, there are tests such as What do you think? |
@therepanic, thanks for looking into this. Given that For now, we can enable this behavior by adding NimbusJwtDecoder.withJwkSetUri("https://jwks.example.org").discoverJwsAlgorithms().build(); In Spring Security 8, we can make this the default setting. I believe this will preserve the behavior of the existing tests as well, correct? |
Closes: spring-projectsgh-17785 Signed-off-by: Andrey Litvitski <[email protected]>
Hi, @jzheaux! I think this is a good solution, especially considering that a bunch of tests are failing and this will be a breaking change at the very least. I pushed a new commit that implements this idea. I also added a test that verifies the idea behind this method. |
discoverJwsAlgorithms()
in NimbusJwtDecoder
Thanks, @therepanic! This is now merged into |
Closes: gh-17785