ISAM Mapping Rules – Accessing Server Connection Details

With the release of ISAM 9.0.2.1, it’s now possible to access connection details from an appliances Server connection in a JavaScript mapping rule:

Web Server connection dialog

This means you can now write more portable mapping rules, where the configuration details for an environment can be stored in appliance level configuration, rather than your mapping rules.

Accessing the values for these are fairly straightforward:

importClass(Packages.com.ibm.security.access.server_connections.ServerConnectionFactory);
importClass(Packages.com.tivoli.am.fim.trustserver.sts.utilities.OAuthMappingExtUtils);

//Web Server Connection Details
servername = "RESTEndpointServer";
var ws1 = ServerConnectionFactory.getWebConnectionByName(servername);
if (ws1 == null) {
    OAuthMappingExtUtils.throwSTSUserMessageException
        ("Couldn't get Web Server Connection "+ servername);
}

var restURL = ws1.getUrl();
var restUsername = ws1.getUser();
var restPassword = ws1.getPasswd();
var restisSsl= ws1.isSsl();
var restKeystore = ws1.getKeystore();
var restKeyLabel = ws1.getLabel();

These can then be fed into your HTTP callouts in your mapping rule.

Documented in the JavaScript Javadoc (From the file ISAM-javadoc.zip) in the appliance file downloads:

JavaScript JavaDoc documentation
com.ibm.security.access.common/index.html

Such that you would import these classes:

importClass(Packages.com.ibm.security.access.httpclient.HttpClient);
importClass(Packages.com.ibm.security.access.httpclient.HttpResponse);
importClass(Packages.com.ibm.security.access.httpclient.Headers);
importClass(Packages.com.ibm.security.access.httpclient.Parameters);

And use the parameters from your server connection to populate the parameters in your request:

httpPost(java.lang.String urlstr, Headers headers, Parameters params, java.lang.String httpsTrustStore, java.lang.String basicAuthUsername, java.lang.String basicAuthPassword, java.lang.String clientKeyStore, java.lang.String clientKeyAlias, java.lang.String protocol)

Additional server connection details classes are also available for LDAP,

var svr1 = ServerConnectionFactory.getLdapConnectionByName(servername);

Which becomes relevant for the new UserHelper classes also introduced in 9.0.2.1 for LDAP registry direct commands from mapping rules.

 

 

 

Comments are closed.

Website Built with WordPress.com.

Up ↑