The description outline is as follows:
This file contains some generic functions that could be commonly used for all applications.
Method Summary:
| Method and description | Input parameters | Return type |
|---|---|---|
| openApiValidatorOptions This is a constant variable contains Options for express-openapi-validator middleware. |
validateRequests true if the incoming request shall be schematically validated. validateResponses true if the responses shall be schematically validated. validateSecurity This function contains following handlers for validating security. 1. apiKeyAuth: this validates operationkey when the service is defined with apiKeyAuth in specification 2. basicAuth: this validates the authorization code with external authorizing application when a service is defined with basicAuth in specification. |
|
| setupExpressApp Setup an express application with settings common for all applications. |
{object} app express Application | |
| validateOperationKey Function compares "operation-key" from request header to operation-key from load file.The function is meant as a handler for validateSecurity option from express-openapi-validator. |
{object} request express request {string[]} scopes security scopes {object} schema SecuritySchemeObject |
{Promise} Promise is true when operation keys are equal. |
| validateBasicAuth Function asks AdministratorAdministration application to validate "authorization" header from a request. The function is meant as a handler for validateSecurity option from express-openapi-validator. |
{object} request express request {string[]} scopes security scopes {object} schema SecuritySchemeObject |
{Promise} Promise Promise is true when authentication is successful. If not , then a JSON object with the status code will be sent. |
| loggingErrorHandler Express error handler function which records request/response to ExecutionAndTraceLog or OamLog application. It is used as last middleware in express application. |
{object} err express error {object} req express request {object} res express response {function} next express next middleware function. |
|
| performApplicationRegistration Function to initiates application registration. Register-yourself basic service will be triggered to the own application with no requestbody. |
||
| getRegisterYourselfOperationServerUuid Function to get the operation-server uuid of the register-yourself API |
||
| formulateAndSendRequest Function to formulate and initiate REST Request |
{string} registrationOperationServerUuid operation-server uuid of the register-yourself service |