I am working with JWT
token using io.jsonwebtoken
maven dependency.
I am able to create a JWT token with custom payloads successfully.
Now while i am going to parse
it, I need Map<String, Object>
object which has all those custom payloads which are added at the time of creation, but unfortunately i am unable to complete it.
I am using following code to parse it,
JwtParser parser = Jwts.parser();
Claims claims = parser
.setSigningKey(DatatypeConverter.parseBase64Binary(SIGN_KEY))
.parseClaimsJws(jwt).getBody();
Now, I have io.jsonwebtoken.Claims
, but don't know how to convert this io.jsonwebtoken.Claims
to java.util.Map<String,Object>
However I try with this to know(almost looks similar which i want) :-
System.out.println(claims.toString()); -> this is correctly prints whole custom payloads.
But i need Map<String,Object>
Any help will be appreciate..!!