Skip to content
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

Consider removing com.nimbusds:oauth2-oidc-sdk dependency #14245

Open
jgrandja opened this issue Dec 5, 2023 · 2 comments
Open

Consider removing com.nimbusds:oauth2-oidc-sdk dependency #14245

jgrandja opened this issue Dec 5, 2023 · 2 comments
Labels
type: enhancement A general enhancement

Comments

@jgrandja
Copy link
Contributor

jgrandja commented Dec 5, 2023

We should strongly consider removing the com.nimbusds:oauth2-oidc-sdk dependency as it has caused a number of issues over the years ever since we added it's usage in the OAuth2 support.

The root issue is the result of the out-of-sync release process used for the oauth2-oidc-sdk and nimbus-jose-jwt artifacts. Since oauth2-oidc-sdk depends on nimbus-jose-jwt, it's important to keep the versions of these artifacts in sync - only if oauth2-oidc-sdk is being used. However, there are cases where this poses to be a challenge, when artifacts are unexpectedly downgraded as described in this comment. As a result, we're also forced to downgrade versions to prevent dependency convergence, and this is not ideal as we should always strive to be using the latest versions as a best practice.

The support overhead that com.nimbusds:oauth2-oidc-sdk dependency has added over the years has outweighed the value of reuse of the library, so I recommend we remove the use of the library altogether and only depend on com.nimbusds:nimbus-jose-jwt and ensure we're always on the latest version.

We are currently using com.nimbusds:oauth2-oidc-sdk in the following classes:

  • OAuth2ErrorResponseErrorHandler
  • ClientRegistrations
  • DefaultReactiveOAuth2UserService
  • OAuth2AccessTokenResponseBodyExtractor
  • NimbusOpaqueTokenIntrospector
  • NimbusReactiveOpaqueTokenIntrospector

After reviewing the code in the above classes, I believe updating the code with our own implementation would be minimal effort and it ultimately would save us from any further support overhead.

Related gh-13843, gh-13990

@jgrandja jgrandja added status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 5, 2023
@jzheaux
Copy link
Contributor

jzheaux commented Dec 5, 2023

The OpaqueTokenIntrospector classes can be deprecated at this point I think. We kept them around for a while in case folks needed the Nimbus support, but now there's a Nimbus-free implementation for both servlet and reactive.

@xak2000
Copy link
Contributor

xak2000 commented Dec 12, 2023

I'll add my 5 cents.

The mentioned unexpected downgrade of nimbus-jose-jwt from 9.31 to 9.24.4 actually caused problems in our project as our code was already dependent on some methods, added in 9.26. For instance, RSAKey.Builder.notBeforeTime and RSAKey.Builder.expirationTime. After upgrading to spring-security 6.1.5, these methods disappeared. :)

The downgrade made in com.nimbusds:oauth2-oidc-sdk:9.43.3 was initiated by a request from @jzheaux according to the comment. It's interesting what was the reason...

The author of oauth2-oidc-sdk himself recommends to use a latest version of nimbus-jose-jwt, so this downgrade was really unexpected to me.

I'm also not sure that com.nimbusds:oauth2-oidc-sdk is really depends on specific features of version 9.24.4 of nimbus-jose-jwt. Probably it will work with later versions of nimbus-jose-jwt just fine. The specific version was just latest at the moment of the release. So, the dependency convergence problem is somewhat artificial.

Maybe it's worth to upgrade to the latest version of com.nimbusds:oauth2-oidc-sdk first to have a more recent version of nimbus-jose-jwt? I mean, removing the oauth2-oidc-sdk dependency will help, but probably implementing this task will not be fast.

Is there any particular reason why com.nimbusds:oauth2-oidc-sdk should be of version 9.43.3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants