Search code examples
javaservletsoauthopenid

How to overcome breaking API change in com.nimbusds version 4.14?


We have Oauth2 server implementation build on Nimbus OAuth 2.0 SDK.

Now we are using version 4.13 (com.nimbusds - oauth2-oidc-sdk) but want to upgrade to the latest version 5.13 - for no particular reason just want to have latest before release.

We are using java servlets for implementing OAuth endpoints and often we are using:

com.nimbusds.oauth2.sdk.http.HTTPResponse.applyTo(javax.servlet.http.HttpServletResponse sr)

but function applyTo(javax.servlet.http.HttpServletResponse sr) not exists in the API any more. (It was remove between versions 4.13 and 4.14)

I have google that for some time and also tried to find some other way how to get (or modify existing) HttpServletResponse from the com.nimbusds.oauth2.sdk.http.HTTPResponse.

I suggest that there should be some work around like http response writer or something so but I am loosing it completly.

Did someone overcome this api change?

If so thanks for your answers.


Solution

  • You seem to be looking for com.nimbusds.oauth2.sdk.http.ServletUtils.applyHTTPResponse(). Evidently, Nimbus has been refactored so that HttpResponse is a data-only class, not a behavioral class. Its one behavioral method was moved to ServletUtils.