Reputation: 189
I have a java code which generates a JWT token using Jwts.builder(). However, the generated token is then again encoded using a Base64 encoder, e.g.
Base64.getEncoder().encodeToString(token.getBytes())
I have been able to setup kong to validate the generated JWT token but I can not find a way to validate the Base64 encoded version of the token.
Can you please suggest if there is a way to handle such a scenario.
Kind Regards,
Upvotes: 2
Views: 744
Reputation: 510
I am not aware of a ready-to-use solution, however you can:
base64 decoder
to decode it properly and then use the original jwt-plugin. You can control the order of execution so your custom plugin runs before the jwt plugin and replaces the original double-encoded token with the single-coded (normal) jwt tokenTo stay close to the original plugin and avoid code duplication, I would recommend the second way.
Upvotes: 1