Question

Use of inputPageName in pxGenerateJWT

I would like to find out more about the use of the inputPageName Parameter in the pxGenerateJWT. We wanted to use the inputPageName to populate custom claims that are dynamic.

I created a page of the Embed-Token-JsonWebToken-Generation class, and populated with a custom claim. However, I kept on getting a runtime NullPointerException.

I am on Pega 8.1.3. Can somebody show me how to set up a proper inputPageName for pxGenerateJWT?

Comments

Keep up to date on this post and subscribe to comments

July 18, 2019 - 5:22pm

The step 2 of the pxGenerateJWT is similar to this - you should be able to do a private checkout to debug where this NPE is coming from and act accordingly.

jwtGenerationPage = jwtInstancePage.getPage("pyJsonWebTokenGeneration");

if(jwtGenerationPage != null){

  if(contextPageName!=""&&contextPageName!=null){

ClipboardPage contextPage = tools.findPage(contextPageName);

if(contextPage != null){

      ClipboardProperty headersList = jwtGenerationPage.getIfPresent("pyHeaders");

      ClipboardProperty contextheadersList = contextPage.getIfPresent("pyHeaders");

      for (int i = 1; i <= contextheadersList.size(); i++) {

        ClipboardPage customHeaderpage = contextheadersList.getPageValue(i);

        ClipboardPage headerpage = headersList.getPageValue(ClipboardProperty.LIST_APPEND); 

        headerpage.putAll(customHeaderpage );

      }

      ClipboardProperty regClaimsList = jwtGenerationPage.getIfPresent("pyClaims");

      ClipboardProperty contextClaimsList = contextPage.getIfPresent("pyClaims");

      for (int i = 1; i <= contextClaimsList.size(); i++) {

        ClipboardPage customClaimpage = contextClaimsList.getPageValue(i);

        ClipboardPage claimPage = regClaimsList.getPageValue(ClipboardProperty.LIST_APPEND); 

        claimPage.putAll(customClaimpage );

      }

      ClipboardProperty customClaimsList = jwtGenerationPage.getIfPresent("pyCustomClaims");

      ClipboardProperty ctxCustomClaimsList = contextPage.getIfPresent("pyCustomClaims");

      for (int i = 1; i <= ctxCustomClaimsList.size(); i++) {

        ClipboardPage customClaimpage = ctxCustomClaimsList.getPageValue(i);

        ClipboardPage claimPage = customClaimsList.getPageValue(ClipboardProperty.LIST_APPEND); 

        claimPage.putAll(customClaimpage );

      }

    }

  }