...
Excerpt |
---|
Starting with version 4.1.5 we support multiple LDAP servers. |
Ao define and query those servers acce.
LDAP Configuration
To define and query those servers access the configuration page from LDAP Configuration link available in cPrime apps menu. After the page is rendered click the Add LDAP button.
...
Webhooks. |
Webhooks gives the user the possibility to run existing SIL scripts, from outside of the JIRA instance, by using a REST/HTTP client, and retrieve the results of the script run.
In order for this to be possible, we need 2 things:
- Create a SIL script.
- Configure a webhook to run that SIL script.
Creating a SIL script
Almost any SIL script can be used, but the two Webhooks specific SIL routines make this feature powerful (getWebhookPayload, appendToWebhookResponse).
Example 1 - Getting the Webhooks payload from the calling client and returning custom results and HTTP response code:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
//getting the REST/HTTP call input parameters:
WebhookPayload httpRequestPayload = getWebhookPayload();
//getting the used HTTP method:
string httpMethod = httpRequestPayload.httpMethod;//This can be something like "GET", "POST", "PUT" etc.
//getting the http request payload (body):
string httpPayload = httpRequestPayload.payload;
//getting the http query parameters:
WebhookParam[] httpQueryParams = httpRequestPayload.queryParams;
string firstQueryParamName = httpQueryParams[0].name;
string firstQueryParamValue = httpQueryParams[0].values[0];
//sending the response back to the caller:
appendToWebhookResponse("http method:");
appendToWebhookResponse(httpMethod);
appendToWebhookResponse("payload:");
appendToWebhookResponse(httpPayload);
appendToWebhookResponse("firstQueryParamName:");
appendToWebhookResponse(firstQueryParamName);
appendToWebhookResponse("firstQueryParamValue:");
appendToWebhookResponse(firstQueryParamValue);
//returning a custom HTTP status code:
return true, 1234; |
The format for the return line, if used, should be return <
true
|false
>[
, <Custom HTTP status code>];
The first argument can only have the values true or false. True means that the script run was correctly, and false means that the script encountered a problem when it was run.
Webhooks Configuration
To define what URI and HTTP method will be used to invoke a specific SIL script, the SIL Webhooks Configuration should be used. The page is located under Add-ons -> CPRIME PLUGINS CONFIGURATION.
To create a Webhook entry, click the "Add webhook".
Fill the form with the desired Webhook name, the HTTP Method that will be used to trigger this webhook, the path to the desired script to be invoked, and weather or not the invocation should be Synchronous or not.
NOTE: The difference between creating a synchronous and asynchronous is that the asynchronous Webhook SIL call can't return any results or custom HTTP codes to the caller. This happens because the SIL script run task is added to a list of future tasks to be run, and the HTTP call ends. With the synchronous option, the call will block until the SIL script is run, and the results will be returned to the caller.
Parameters:
- Directory - the directory type. Only MS Active Directory is supported at the moment. If you have other LDAP type, ask for support.
- Name - the LDAP configuration name, unique.
- Base DN - the base DN, used as a root for that LDAP.
- User / Password - the LDAP user and the password (it is not usually a single word, but a string like shown above).
...