A script transformer action transforms the input attribute names and values. The script transformer allows for any transformations imaginable as the incoming attributes is transformed programmatically through custom script procedures.
A procedure is basically a function providing a scripting context in which the incoming attributes are contained. These attributes may be transformed in any possible way, either statically or even by looking up data in external data sources or whatever other helpers are provided in the context.
Like other actions, this one is also able exclude certain attributes if so configured (see below).
Note
See the Common Procedure Objects page for some pointers on what’s made available in procedure contexts.
In its simplest form, a script transformer action procedure looks like the following:
1 2 3 4 5 6 7
function result(transformationContext) { var attributes = transformationContext.attributeMap; // .. do something with the incoming attributes here before returning them return attributes; }
In the previous example, the source of the attributes in transformationContext.attributeMap and the destination for the returned attributes is defined by the attributes-location configuration setting. By default the location is the subject attributes, contained inside the authentication attributes. The other two possible locations are the context attributes, also contained inside the authentication attributes, and the action attributes.
transformationContext.attributeMap
attributes-location
The procedure used by a Script Transformer Action also has access to the complete subject attributes, context attributes, and action attributes, via the following additional properties on the transformation script context.
subjectAttributeMap
SubjectAttributes
contextAttributeMap
ContextAttributes
actionAttributeMap
AuthenticationActionAttributes
These extra properties contain the full non-filtered attributes, represented as maps. Any changes made to these maps are not reflected in the action’s output attributes. Only the script’s return is used to change the action’s output attributes, controlled by the attributes-location configuration setting.
Adding script procedures is easily done from the Admin UI. Simply click to add a new script transformer and then choose to reference an existing one or create a new one with the help of the provided editor.
The following configuration options are available:
transformation-procedure
excluded-attributes
subject-attributes
context-attributes
action-attributes