OICP Server Endpoint https changes
MODIFY
src/assets/config-template-http.json
src/assets/config-template-http.json
"protocol": "http",
"host": "localhost",
"port": 9080,
+ "ssl-key": "src/assets/server/oicp/ssl/key.pem",
+ "ssl-cert": "src/assets/server/oicp/ssl/cert.pem",
"debug": false,
"externalProtocol": "http"
},

MODIFY
src/assets/config-template-https.json
src/assets/config-template-https.json
"OICPService": {
"protocol": "https",
"host": "localhost",
- "port": 9080,
- "ssl-key": "",
- "ssl-cert": "",
+ "port": 8443,
+ "ssl-key": "src/assets/server/oicp/ssl/key.pem",
+ "ssl-cert": "src/assets/server/oicp/ssl/cert.pem",
"ssl-ca": [],
"debug": false,
"externalProtocol": "https"

MODIFY
src/server/ExpressTools.ts
src/server/ExpressTools.ts
@@ -97,6 +97,8 @@ export default class ExpressTools {
// Set the keys
options.key = fs.readFileSync(serverConfig['ssl-key']);
options.cert = fs.readFileSync(serverConfig['ssl-cert']);
+ // Options.requestCert = true; // Tbd: Test on QA System: Reject incoming requests without valid certificate (OICP: accept only requests from Hubject)
+ // options.rejectUnauthorized = true; // Tbd: Test on QA System
// Intermediate cert?
if (serverConfig['ssl-ca']) {
// Array?

MODIFY
src/server/oicp/OICPServer.ts
src/server/oicp/OICPServer.ts
-import { Application, NextFunction, Request, Response } from 'express';
+import { Application, NextFunction, Response } from 'express';
import ExpressTools from '../ExpressTools';
import OICPServiceConfiguration from '../../types/configuration/OICPServiceConfiguration';
@@ -35,7 +35,7 @@ export default class OICPServer {
}
// Start the server
- start(): void {
+ async start(): Promise<void> {
ExpressTools.startServer(this.oicpRestConfig, ExpressTools.createHttpServer(this.oicpRestConfig, this.expressApplication), 'OICP', MODULE_NAME);
}
}

MODIFY
src/types/configuration/OICPServiceConfiguration.ts
src/types/configuration/OICPServiceConfiguration.ts
@@ -4,4 +4,6 @@ export default interface OICPServiceConfiguration {
host: string;
port: number;
debug: boolean;
+ key: string;
+ cert: string;
}

OICP Server Endpoint https changes