Read JWT strings, used to convert them into a JWT object representing the expanded JWT.
Javascript example:
try {
var jws = 'eyJhbGciOiJIUzI1NiJ9.SGVsbG8gV29ybGQhIQ.0AuRfme3iRhk-sAjSQpdKUG81STuSB0xJFd3xZA2E0I';
var SECRET_KEY = "This is my very secret key that is at least 32 bytes long!!";
var key = system.securityManager.getKeyManager().generateHMACSecretKey(KeyManager.SIGNATURE_HS256, SECRET_KEY);
var parsedJWS = system.securityManager.jwtManager.parseJWS(jws);
if(parsedJWS.verifyHMAC(key))
{
var payload = parsedJWS.getPayload();
log("Payload: " + payload); //Outputs Hello World!!
}
else
{
throw 'JWS Signature is not verified!';
}
}
catch (e) {
event.getOwner().addErrorMessage("Error parsing JWS: " + e);
}
Javascript example: