-
Notifications
You must be signed in to change notification settings - Fork 6k
Add functionality to set custom web client in ReactiveOidcIdTokenDecoderFactory #13274
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
Labels
in: oauth2
An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)
type: enhancement
A general enhancement
Comments
ubaid4j
added a commit
to ubaid4j/spring-security
that referenced
this issue
Jun 9, 2023
…derFactory and that custom web client ultimately is used by NimbusReactiveJwtDecoder (spring-projectsgh-13274)
ubaid4j
added a commit
to ubaid4j/spring-security
that referenced
this issue
Jul 5, 2023
…derFactory and that custom web client ultimately is used by NimbusReactiveJwtDecoder (spring-projectsgh-13274) - resolve feedbacks - added a couple of unit tests
4 tasks
pcmoen
added a commit
to navikt/pensjon-app-gateway
that referenced
this issue
Oct 2, 2023
jzheaux
pushed a commit
to ubaid4j/spring-security
that referenced
this issue
Feb 1, 2024
jzheaux
added a commit
to ubaid4j/spring-security
that referenced
this issue
Feb 1, 2024
- Changed to #setWebClientFactory to align with other methods - Updated Copyright - Added @SInCE attribute Issue spring-projectsgh-13274
jzheaux
pushed a commit
to ubaid4j/spring-security
that referenced
this issue
Feb 1, 2024
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)
type: enhancement
A general enhancement
Current Behavior
On creating OIDC token (see: code) ReactiveOidcIdTokenDecoderFactory creates the NimbusReactiveJwtDecoder (see: code) that uses the default webclient (see: code). With default web client we see the following exception, see reactor/reactor-netty#1774.
Expected behavior
To fix the above issue, we can create our custom web client using a custom connection provider. see: reactor/reactor-netty#1774 (comment), and then pass this web client to ReactiveOidcIdTokenDecoderFactory that creates the NimbusReactiveJwtDecoder with custom web client thus we can fix above exception.
The expectation is that
ReactiveOidcIdTokenDecoderFactory
should have the functionality to set a custom web client and createsNimbusReactiveJwtDecoder
with that custom web client.Following is the required change to get this behavior:
and we can use the following code to set the custom web client in
ReactiveOidcIdTokenDecoderFactory
in our applications.Context
After migrating from Zuul API gateway to Spring Cloud gateway we rewrote our whole multi-tenant oidc login flow in
spring-security-oauth2-client
(migrated from Keycloak adapter).After deployment in dev env, we started getting above listed exception in four places.
AbstractWebClientReactiveOAuth2AccessTokenResponseClient#getTokenResponse
(fixed by providing custom web client)see
org.springframework.security.oauth2.jwt.NimbusReactiveJwtDecoder$JwkSetUriReactiveJwtDecoderBuilder.lambda$processor$6(NimbusReactiveJwtDecoder.java:398)
(This issue is created to fix exception here).So, to fix issue#4, we need the same functionality (to set web client) as for
AbstractWebClientReactiveOAuth2AccessTokenResponseClient
. see issue#3.There are workarounds like implementing
ReactiveJwtDecoderFactory<ClientRegistration>
as per our need but I am not considering it as we have already an implementation ofReactiveJwtDecoderFactory<ClientRegistration>
and we just need to set a custom web client.Let me know if there is a need for more information. I am happy to create PR for this enhancement.
Thanks
The text was updated successfully, but these errors were encountered: