spring-projects / spring-projects/spring-security
[OAuth2 Client] cannot access org.springframework.web.reactive.function.client.ExchangeFilterFunction
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Describe the bug
org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunctiondepends on Interfaces from the Reactive org.springframework.web.reactive package and therefore can not be used by non-reactive Applications without pulling in tons of unused dependencies.
java: cannot access org.springframework.web.reactive.function.client.ExchangeFilterFunction
class file for org.springframework.web.reactive.function.client.ExchangeFilterFunction not found
To Reproduce
pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
Java:
OAuth2ClientHttpRequestInterceptor oAuth2ClientHttpRequestInterceptor = new OAuth2ClientHttpRequestInterceptor(oAuth2AuthorizedClientManager);
// compiler error line:
Consumer<Map<String, Object>> requestAttributeCustomizer = ServletOAuth2AuthorizedClientExchangeFilterFunction.clientRegistrationId("my-client-id");
RestTemplate restTemplate = new RestTemplateBuilder()
.connectTimeout(Duration.of(5L, ChronoUnit.SECONDS))
.readTimeout(Duration.of(10L, ChronoUnit.SECONDS))
// required here:
.requestCustomizers(request -> requestAttributeCustomizer.accept(request.getAttributes()))
.additionalInterceptors(oAuth2ClientHttpRequestInterceptor)
.build();
Expected behavior
Class org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction should not depend on classes/interfaces of foreign projects/packages e.g. org.springframework.web.reactive.function.client.ExchangeFilterFunction
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ServletOAuth2AuthorizedClientExchangeFilterFunction and OAuth2ClientHttpRequestInterceptor, then inspect how the clientRegistrationId customizer references ExchangeFilterFunction. Reproduce the compilation failure using the pom.xml and Java example from the issue. Done means a non-reactive application can use the OAuth2 client request customization without requiring org.springframework.web.reactive.function.client.ExchangeFilterFunction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100