Overview
SWF can either be used with the primary server (web UI), or with the automation REST API that will run alongside it. The automation API can be used to automate the creation of tasks, in order to create custom flows and integrate the functionality of SWF into your overall system.
Examples:
- Automate the flow of signing parking permits to citizens
- Automate the signing process of contracts
To enable this, set `automationApiEnabled` to `true`. The UI will be running on port `8080` and the automation API on `8081`. If you want to update these ports, you can do that by setting these parameters in your `config.json`:
{
"primaryServerPort": 8080,
"automationApiEnabled": true,
"automationApiPort": 8081
}
-
primaryServerPort
- The SWF frontend server port -
automationApiEnabled
- Whether the automation API is enabled -
automationApiPort
- The automation API server port
Both these endpoints use the same underlying infrastructure and functionality, but they are designed differently to support
different needs. The primary servers are there to support the SWF UI, and the automation API is there to support
other services in your overall infrastructure.
The SWF UI endpoints, available under the configured primaryServerPort
, are subject to change between versions, but the
current version of the UI API can be seen here.
Understanding the signature data flow
When signing a file, the data will flow from SWF to PAS, which will generate the signature and add it to the file. After the signature has been added, PAS will publish the file to SWF that will fetch it and store it in its database. The detailed flow works as follows:
- The user initiates the signature by pressing
View and Sign
in the UI. - The frontend will perform a POST request to the backend which will:
- Validate the user
- Upload the file to PAS. The uploaded file will be a base64-encoded JSON array. Each item in the array will look as follows:
-
id
- The SWF file ID -
fileName
- The name of the file -
toBeSigned
- Whether the file is to be signed -
content
- the base64 encoded byte array of the file
-
- Generate a JWT
- Place the JWT in a URL
- Redirect the user to PAS via the URL generated in the previous step
- The user gets redirected to PAS, that will:
- Authenticate using the JWT. The JWT will include the following parameters:
- id
- successURL
- failURL
- cancelURL
- tenantId
- userId
- userMobile
- userMail
- userSource
- Show a preview of the file using the
PrismFedSigning
module.
- Authenticate using the JWT. The JWT will include the following parameters:
- The user will review the file contents and when all is reviewed, press one of these buttons:
-
Cancel
- The user will be redirected to thecancelURL
found in the JWT -
Sign
- The user will call the authentication redirect URL (sign_auth_redirect_url
in thePrismFedSigning
config)- The user will sign/authenticate using the configured IdP
- When the IdP has signed/authenticated, the user will be redirected to the
/sign
endpoint in thePrismFedSigning
module - PAS runs the configured sign pipe. The signed file should replace the non-signed file in
content
in each item of the array uploaded from SWF. - PAS adds the signature ID to the URL and redirects the user back to SWF
-
- SWF receives the redirect request and uses the signature ID to download the file from PAS.
- If the file has been updated, and the file that was originally sent to PAS is the active file, the file is stored.
- SWF updates the users that should sign next
- The sign action is successful