Application scripts

  • Most of Trustelem applications allow to set up a script in order to change the default behavior.

  • With this script, it is possible to change the SAML or OpenID Connect attributes sent to an application.

  • The language used is TypeScript.

Add a script

  • Edit your app

  • Click on Custom claims for OpenID Connect / Custom scripting for SAML

  • Enter your script

script

Some examples for SAML applications

Add a constant attribute

msg.setAttr("attribute","value");   

Add an attribute containing Trustelem groups

for(let g in groups)
    msg.addAttr("Groups",g);
}

Change the user email

if (user.email == 'john.doe@contoso.fr') {
    msg.setAttr("email","isabelle.doe@contoso.fr"); 
}

Some examples for OpenID Connect applications

Add a constant attribute

claims["attribute"] = "value"; 

Send a user attribute

claims["Profile"] = user.getAttr("profile");

Add an attribute containing Trustelem groups

claims["Groups"] = JSON.stringify(groups);