Skip to content

Conversation

therepanic
Copy link
Contributor

@therepanic therepanic commented Jun 2, 2025

This will help us to throw our own WebClient.Builder into SpringReactiveOpaqueTokenIntrospector.Builder with our own parameters that we specify.

Also for this class we have one test where a builder is used. I decided to just throw WebClient.Builder in there in order to use the method, I think it doesn't make much sense to test it, wdyt?

Resolves: #17194

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 2, 2025
@jzheaux
Copy link
Contributor

jzheaux commented Jun 2, 2025

Thanks for the suggestion, @therepanic. I'm inclined to leave the class as-is since you can do:

@Bean 
ReactiveOpaqueTokenIntrospector opaqueToken() {
  WebClient.Builder builder = WebClient.builder()
      .defaultHeaders((headers) -> headers.setBasicAuth(clientId, clientSecret))
      // ... your settings
  return new SpringReactiveOpaqueTokenIntrospector(introspectionUri, builder.build());
}

Adding WebClient.Builder to the builder doesn't seem to add much:

@Bean 
ReactiveOpaqueTokenIntrospector opaqueToken() {
  WebClient.Builder builder = WebClient.builder()
      // ... your settings
  return SpringReactiveOpaqueTokenIntrospector.withIntrospectionUri(introspectionUri)
    .clientId(clientId)..clientSecret(clientSecret)
    .build();
}

Will it work for you to construct the WebClient and then pass that into the constructor?

@jzheaux jzheaux self-assigned this Jun 2, 2025
@jzheaux jzheaux added status: waiting-for-feedback We need additional information before we can continue type: enhancement A general enhancement in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 2, 2025
@therepanic
Copy link
Contributor Author

Yes, I think that will work.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jun 2, 2025
@jzheaux jzheaux added status: declined A suggestion or change that we don't feel we should currently apply and removed status: feedback-provided Feedback has been provided labels Jun 2, 2025
@jzheaux
Copy link
Contributor

jzheaux commented Jun 2, 2025

Great, @therepanic. I'll close this for now, then. We can always revisit if something comes up.

@pinguet62
Copy link

pinguet62 commented Jun 9, 2025

Hello 🖖 @jzheaux

you can do

new SpringReactiveOpaqueTokenIntrospector(introspectionUri, builder.build())

Yes, but

  • in this case the header building (setBasicAuth()) is delegated to caller
    while in the actual solution it's responsability of SpringReactiveOpaqueTokenIntrospector & it's builder.
  • this constructor is deprecated, isn't it?
    Probably for removable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: oauth2 An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow customization of WebClient used by SpringReactiveOpaqueTokenIntrospector
4 participants