spring-projects / spring-projects/spring-security

Fix parametersConverters nullability in AbstractRestClientOAuth2AccessTokenResponseClient

Open Beginner friendly
#19,318 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: enhancement
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

AbstractRestClientOAuth2AccessTokenResponseClient has the following methods:

  • setParametersConverter(Converter<T, MultiValueMap<String, String>> parametersConverter)
  • addParametersConverter(Converter<T, MultiValueMap<String, String>> parametersConverter)

When I want to configure a RestClientClientCredentialsTokenResponseClient which extends AbstractRestClientOAuth2AccessTokenResponseClient with a NimbusJwtClientAuthenticationParametersConverter, I get jspecify warnings because NimbusJwtClientAuthenticationParametersConverter implements Converter<T, @Nullable MultiValueMap<String, String>>.

So AbstractRestClientOAuth2AccessTokenResponseClient.addParametersConverter() expects a Converter<T, MultiValueMap<String, String>> while NimbusJwtClientAuthenticationParametersConverter is a Converter<T, @Nullable MultiValueMap<String, String>>. The only difference is the @Nullable on the MultiValueMap.

I think AbstractRestClientOAuth2AccessTokenResponseClient should be adapted to use @Nullable as well as those methods check if the returned map is null anyway:

MultiValueMap<String, String> parametersToAdd = parametersConverter.convert(authorizationGrantRequest);
if (parametersToAdd != null) {
    parameters.addAll(parametersToAdd);
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AbstractRestClientOAuth2AccessTokenResponseClient and inspect setParametersConverter and addParametersConverter alongside their existing null checks. Verify that a NimbusJwtClientAuthenticationParametersConverter can be configured without jspecify warnings, and confirm the returned parameters are still handled correctly when null.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.