Editing Custom Logic

Custom scripting logic can be specified for an application in the Admin Portal (e.g. to customize JWT creation for this application) by navigating to Apps, selecting the desired app, and then navigating to the Advanced tab.

This can also be done programmatically using the endpoints described below.

Before continuing, ensure you are familiar with:

The remainder of this document assumes that you have already authenticated the user and have obtained the authentication token necessary to invoke subsequent endpoints.

Note: before continuing ensure that you have the ID of the application for which you would like to retrieve the script for. You can invoke the get_applications stored procedure to get a list of applications and their IDs from your tenant.

Step 1. Get the Application's Script

Before modifying an application's script, you can obtain its existing script by invoking the get script endpoint and passing the application's ID via the appkey field in the body:

POST https://mytenant.centrify.com/saasManage/GetScript

{
	"appkey":"123470ba-c9..."
}

The Script field in the response contains the application's existing script, where line breaks are indicated with `\n':

{  
   "success":true,
   "Result":{  
      "Modified":true,
      "Script":"setIssuer(Issuer);\nsetSubjectName(UserIdentifier);\nsetAudience('box.net');\nsetRecipient('https://sso.services.box.net/sp/ACS.saml2');\nsetSignatureType('Response');\nsetServiceUrl('https://sso.services.box.net/sp/ACS.saml2');\nsetHttpDestination('https://sso.services.box.net/sp/ACS.saml2');\nsetAttribute('Email Address', UserIdentifier);"
   },
   "Message":null,
   "MessageID":null,
   "Exception":null,
   "ErrorID":null,
   "ErrorCode":null,
   "InnerExceptions":null
}

Step 2. Update the Application's Script

Construct a string containing the full script to update the application with. This could include some or all of the existing script and/or new script. Ensure that all newline characters are specified using \n.

Once this string is constructed, update the application by invoking the updateapplicationde endpoint and passing the script via the Script body parameter and the application's ID via the _RowKey parameter:

POST https://mytenant.centrify.com/saasManage/UpdateApplicationDE

{  
 "Script":"setIssuer(Issuer);\nsetSubjectName(UserIdentifier);\nsetAudience('box.net');\nsetRecipient('https://sso.services.box.net/sp/ACS.saml2');\nsetSignatureType('Response');\nsetServiceUrl('https://sso.services.box.net/sp/ACS.saml2');\nsetHttpDestination('https://sso.services.box.net/sp/ACS.saml2');\nsetAttribute('Email Address', UserIdentifier);\n",
   "IconUri":"/vfslow/lib/application/icons/oauth",
   "_RowKey":"123470ba-c9..."
}

The success field in the response indicates if the application was successfully updated with the new script:

{  
   "success":true,
   "Result":{  
      "State":0
   },
   "Message":null,
   "MessageID":null,
   "Exception":null,
   "ErrorID":null,
   "ErrorCode":null,
   "InnerExceptions":null
}