ISAM JavaScript – Making Multi value Attributes

Received a question related to the ‘art’ of making an attribute that is multivalued for the purpose of a SAML Mapping rule, but this is still relevant when using Infomap, OAuth or even the AuthSvcCred mapping rules.

When we are writing the JavaScript mapping rules, the engine wants to make JavaScript objects, this is useful some of the time, but when we are interfacing with a number of our JavaScript incarnations of objects, this can be hazardous.

Take Attribute for example:


Constructor List for Attribute

We have ways to make the Attribute that includes single valued attributes as well as multi-valued attributes by way of a “List”, a “String Array” and “DOM Nodes”.

Assuming you had some groups:

  • group1
  • group2

That you wanted to put into an STSUU, you might think you can do this:

var groups = ["group1", "group2"];
var attr = new Attribute("groups", "", groups);

This will result in an error, not unlike this:

Caused by: org.mozilla.javascript.EvaluatorException: 
The choice of Java method
matching JavaScript argument types (string,string,object) is ambiguous; candidate methods are:


In order to do this correctly, follow the steps below:

1)  Source or create a Java String Array, and in JavaScript an easy way to do this, is using the following line of code:

var javaStringArray = java.lang.reflect.Array.newInstance(java.lang.String, 2);
This is sourced from here.
2) Now, we can use the javaStringArray – as we would the javascript one, to populate it with the desired values.
javaStringArray[0] = "group1";
javaStringArray[1] = "group2";
3) We should be able to add this to our new Attribute:
var rolesAttribute = new Attribute("group", "", javaStringArray);

2 thoughts on “ISAM JavaScript – Making Multi value Attributes

  1. Phil do you have a working mapping rule that I could use as an example with the multi value attribute. Have been trying to get this working for groups for awhile now with no success.


    1. Hi Tyron,

      The example is there:

      var javaStringArray = java.lang.reflect.Array.newInstance(java.lang.String, 2);
      javaStringArray[0] = "group1";
      javaStringArray[1] = "group2";
      var rolesAttribute = new Attribute("group", "", javaStringArray);

      You can then add it to the STSUU as you would for other flows?

      What are you finding that doesn’t work?


Comments are closed.

Website Built with

Up ↑

%d bloggers like this: