Skip to content

[Bug / Feature Request] Create JsonWebToken with empty Payload #2656

@remyblok

Description

@remyblok

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.

Additional context
iDeal API desciption with requirements of Detached JWS for all requests

Metadata

Metadata

Assignees

Labels

BugProduct is not functioning as expectedCustomer reportedIndicates issue was opened by customer

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions