Event authentication
Orchestration Engine uses CloudEvents specifically with HTTP Protocol Binding and Binary Content Mode, where currently we support application/json only as a content-type for the data payload.
To learn more about CloudEvents, see:
Configuring the connection between the event and Orchestration Engine
To establish the connection between the event-receiver endpoint and Orchestration Engine:
Go to Orchestration Engine → Admin → Settings.
Provide the Source and Secret values.
Source - the attribute that defines the endpoint that will be used for sending an event to Orchestration Engine. It’s unique for every tenant If the endpoint is: https://signals.emporix.io/e/{{src}}, copy your src value to the source field in Orchestration Engine.
Secret - an HMAC (keyed-Hash Message Authentication Code) secret; an HMAC is a type of authentication technique that uses a hash function and a secret key. You can use it to sign a request with a shared secret. It verifies if data is correct and authentic.
The signature has to be added in the request that is sent. You can use the following sample to see how to generate the signature.
The request.data is the payload. Orchestration Engine is schemaless, the payload can be empty or it can be in any valid JSON format.
The secret is the one that you need to copy from the Management Dashboard admin settings.
Request examples
Here's an example of a request to generate a signature:
var sha256digest = CryptoJS.HmacSHA256(request.data, ’the-secret-from-management-dashboard'); var base64sha256 = CryptoJS.enc.Base64.stringify( sha256digest);
Here's an example of a postman environment:
{
"id": "0c29dar5-13er-4766-82f8-91e87a45ghy6",
"name": "devenv",
"values": [{
"key": "src",
"value": "src_w34a44rft567",
"type": "default",
"enabled": true
}, {
"key": "secret",
"value": "<replace with secret from Orchestration Engine ->Admin -> Events in Management Dashboard>",
"type": "secret",
"enabled": true
}, {
"key": "hmac",
"value": "",
"type": "any",
"enabled": true
}],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2023-04-19T07:26:28.294Z",
"_postman_exported_using": "Postman/10.10.4"
}
Here's an example of a postman collection
{ "info": { "_postman_id": "d5ce7aff-7f71-4261-b369-7cd673313e8w", "name": "Examples", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "12223042" }, "item": [{ "name": "say-hello", "event": [{ "listen": "prerequest", "script": { "exec": ["var sha256digest = CryptoJS.HmacSHA256(request.data, postman.getEnvironmentVariable(\"secret\"));", "var base64sha256 = CryptoJS.enc.Base64.stringify( sha256digest);", "postman.setEnvironmentVariable(\"hmac\", base64sha256);"], "type": "text/javascript" } }], "request": { "method": "POST", "header": [{ "key": "ce-source", "value": "postman", "type": "text" }, { "key": "ce-type", "value": "acr/hello", "type": "text" }, { "key": "ce-specversion", "value": "1.0", "type": "text" }, { "key": "ce-id", "value": "{{$guid}}", "type": "text" }, { "key": "x-emporix-hmac", "value": "{{hmac}}", "type": "text" }], "body": { "mode": "raw", "raw": "{\n \"hello\" : \"world\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://signals.emporix.io/e/{{src}}", "protocol": "https", "host": ["signals", "emporix", "io"], "path": ["e", "{{src}}"] } }, "response": [] }] }
Creating a new event
To create a new event:
Go to Orchestration Engine > Admin > Events.
Choose Create New Event.
Specify the Display and Event names.
Display name is the name that is visible in the UI when you create an process, for example: Order Created.
Event name is the name of the registered event, for example: emporix/dcp/order.created.
Save your changes.