Skip to content

[OAuth2 Client] cannot access org.springframework.web.reactive.function.client.ExchangeFilterFunction #17531

@palatam

Description

@palatam

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions