Parsing TokenRequest as IdP

Issue #245 resolved
Martin Kabanen created an issue

I'm trying to use this library to implement OpenID Connect identity provider. Is there any way to parse TokenRequest from HttpServletRequest?

In current version (5.62) TokenRequest has only one static parse method which takes HTTPRequest as a parameter, but HTTPRequest itself has only one constructor. I've seen in older versions (for example 4.13) that HTTPRequest had constructor accepting HttpServletRequest, so you could do

TokenRequest.parse(new HTTPRequest(myHttpServletRequest))

Right now I don't see a way to parse TokenRequest as an IdP. Only way is to manually construct HTTPRequest, is this what is recommended now?

Actually same problem exists with AuthenticationRequest although I can parse AuthenticationRequest using constructor which accepts URL parameters as a Map.

In conclusion, what is your recommended way to use TokenRequest when implementing IdP. I did not find any relevant examples.

Comments (4)

  1. Vedran Pavić

    You can use com.nimbusds.oauth2.sdk.http.ServletUtils#createHTTPRequest which will create HTTPRequest from HttpServletRequest for you.

    Similary, there is com.nimbusds.oauth2.sdk.http.ServletUtils#applyHTTPResponse to apply HTTPResponse to HttpServletResponse.

  2. Log in to comment