Global Security Forum

Security Global Forum

Our mission is to provide clients with an online user community of industry peers and IBM experts, to exchange tips and tricks, best practices, and product knowledge. We hope the information you find here helps you maximize the value of your IBM Security solutions.

 View Only
  • 1.  OAuth preToken Mapping Rule endsWith issue

    Posted 08/13/18 09:08 AM
    Hi everyone,

    In preToken Mappin Rule there is the code, that seams not to be working:

    // Essential claim - set the value to 'n/a' or boolean 'false' if not exist
    if (value == null && isEssential) {
    value = claimName.endsWith("_verified") ? "false" : "n/a";

    .endsWith seams not to be supported. I tried following:

    1)
    IDMappingExtUtils.traceString("myxxdeb: "+ "teststr".endsWith("_verified"));
    2)
    var str=new String("teststr");
    IDMappingExtUtils.traceString("myxxdeb: "+ str.endsWith("_verified"));

    But I always get the exception
    Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot find function endsWith in object teststr. (oidcPreTokenGeneration#811)

    I'm really confused. Do I something wrong or IBM uses code, that doesn't work?

    ------------------------------
    Ivan Yartsev
    ------------------------------


  • 2.  RE: OAuth preToken Mapping Rule endsWith issue
    Best Answer

    Posted 08/14/18 05:36 AM
    Hi Ivan,

    I think this post is more suited to the IAM group  - rather than the generic security group - but no big deal.

    I can confirm that this code *does* work; I have used it in an OAuth scenario very recently.

    Looking over the code in the pre-token mapping rule, I can see that the endsWith() method is being run against an object which is generated from a context attribute using the getName() method. This method returns a java.lang.String object.

    I can see that JavaScript string also has the .endsWith() method but perhaps not supported by the version of JavaScript interpreter used in Access Manager?

    Cheers... Jon.


    ------------------------------
    Jon Harry
    Consulting IT Security Specialist
    IBM
    ------------------------------