You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I need to create Detached JWS signature for all requests to a webservice. Also for GET requests (which do not have a body/payload). This library creates JWTs of thich I remove the payload to get the JWS variant. But for GET-requests there is no payload. The CreateToken()-method fails when the payload is null or string.Empty.
Describe the solution you'd like
I want to be able to call JsonWebTokenHandler.CreateToken() with string.Empty as payload.
The result should be an empty payload in the created token:
{header}..{signature}
Describe alternatives you've considered
I've concidered using JsonWebTokenHandler.CreateToken(SecurityTokenDescriptor tokenDescriptor). The issue is that then an (empty) json-object is automatically created as payload.
I'm now calling the internal static CreateToken() on JsonWebTokenHandler using reflection with an string.Empty payload. This actually works perfectly and results in the expected behaviour as described above. Only reflection is not a future proof solution.
Also. I looked at the documentation of CreateToken(). There it does not mention that the payload cannot be string.Empty. So this may even be concidered a bug.
/// <exception cref="ArgumentNullException">if <paramref name="payload"/> is null.</exception>
remyblok
changed the title
[Feature Request] Create JsonWebToken with empty Payload
[Bug / Feature Request] Create JsonWebToken with empty Payload
Jun 20, 2024
Is your feature request related to a problem? Please describe.
I need to create Detached JWS signature for all requests to a webservice. Also for
GET
requests (which do not have a body/payload). This library creates JWTs of thich I remove the payload to get the JWS variant. But for GET-requests there is no payload. TheCreateToken()
-method fails when the payload isnull
orstring.Empty
.Describe the solution you'd like
I want to be able to call
JsonWebTokenHandler.CreateToken()
withstring.Empty
as payload.The result should be an empty payload in the created token:
Describe alternatives you've considered
I've concidered using
JsonWebTokenHandler.CreateToken(SecurityTokenDescriptor tokenDescriptor)
. The issue is that then an (empty) json-object is automatically created as payload.I'm now calling the
internal static CreateToken()
onJsonWebTokenHandler
using reflection with anstring.Empty
payload. This actually works perfectly and results in the expected behaviour as described above. Only reflection is not a future proof solution.Additional context
iDeal API desciption with requirements of Detached JWS for all requests
The text was updated successfully, but these errors were encountered: