Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleExample
Example of the validateJwt function with optional values for claims and algorithm populated.
Code Block
string token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyIsImtpZCI6Im5PbzeyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBpZGFjciI6IjIiLCJhdWQiOiJhZTQ3ZThmZC1iMmJlLTQ2MjYtYTdiNS0xOWQyODk2MWJhMWUiLCJjbGllbnRfaWQiOiIxMjM0LTEyMzQtMTIzNC0xMjM0In0.plstF-xhshrrLKi3Q8J1c5FUSoUImSoYLIs5aaQ-3mvjyVpCtoqnty-Tm5zNWCj_mIRo3aQvnq5IDLUF7VsBc9l-y6vlbcXHdAT3xs3R8x_Lw72tN_t_btyt9Haof7_1DgyxKoQMf7QiwsRX6S8XHk5sWKxJ96zxOLGJdO_HvEPfJKA2eFlK3Tvm715_Bfzp_gOMMyEY1PX5ZKvD9sGsb3kZLpv9Tk8uvaWvU9AFx59paDEAAEbEOo-M27zP9rR_qecSymuDMspHl7zWmBG9kbmrJY-pMScMaHRJiGzORMCs59Nd29Kn-_w0OPPmMV6RTdWbvrgTTU_EUB9JY44rlw";
map<string, any> claimsToValidate = mapCreate(string, any);
mapSet(claimsToValidate, "appidacr", "2");
mapSet(claimsToValidate, "aud", "ae47e8fd-b2be-4626-a7b5-19d28961ba1e");
string error_message = JwtValidation.validateJwt("https://10.60.10.30/endpoint", token, claimsToValidate, "RSA512");


...

Info
titleExample
Example of the validateAndDecodeJwt function with optional values for claims and algorithm populated.
Code Block
import ultra.JwtValidation;

string token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Im5PbzNaRHJPRFhFSzFqS1doWHNsSFJfS1hFZyIsImtpZCI6Im5PbzeyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBpZGFjciI6IjIiLCJhdWQiOiJhZTQ3ZThmZC1iMmJlLTQ2MjYtYTdiNS0xOWQyODk2MWJhMWUiLCJjbGllbnRfaWQiOiIxMjM0LTEyMzQtMTIzNC0xMjM0In0.plstF-xhshrrLKi3Q8J1c5FUSoUImSoYLIs5aaQ-3mvjyVpCtoqnty-Tm5zNWCj_mIRo3aQvnq5IDLUF7VsBc9l-y6vlbcXHdAT3xs3R8x_Lw72tN_t_btyt9Haof7_1DgyxKoQMf7QiwsRX6S8XHk5sWKxJ96zxOLGJdO_HvEPfJKA2eFlK3Tvm715_Bfzp_gOMMyEY1PX5ZKvD9sGsb3kZLpv9Tk8uvaWvU9AFx59paDEAAEbEOo-M27zP9rR_qecSymuDMspHl7zWmBG9kbmrJY-pMScMaHRJiGzORMCs59Nd29Kn-_w0OPPmMV6RTdWbvrgTTU_EUB9JY44rlw";
map<string, any> claimsToValidate = mapCreate(string, any);
mapSet(claimsToValidate, "appidacr", "2");
mapSet(claimsToValidate, "aud", "ae47e8fd-b2be-4626-a7b5-19d28961ba1e");

JwtValidationResult result = (JwtValidationResult) JwtValidation.validateAndDecodeJwt("https://10.60.10.30/endpoint", token, claimsToValidate, "RSA512");

// To get the decoded payloads
map<string, any> claimsMap = result.claims;
debug(mapGet(claimsMap, "client_id"));

// To get the error message
debug(result.errorMessage);


...