backtrace-service
Advanced tools
Comparing version 3.0.8-alpha to 3.0.8-alpha2
@@ -13,2 +13,3 @@ import { NextFunction, Request, Response } from 'express'; | ||
}; | ||
private registeredCoronerds; | ||
private logger; | ||
@@ -15,0 +16,0 @@ private httpsAgent; |
@@ -79,2 +79,7 @@ "use strict"; | ||
this.authenticated = {}; | ||
/* | ||
* Stores coronerd values stored at the register step, | ||
* to be attached during authRequest step. | ||
*/ | ||
this.registeredCoronerds = {}; | ||
this.logger = undefined; | ||
@@ -115,3 +120,3 @@ this.httpsAgent = this.descr.isOnPremise | ||
case 'register': | ||
var _a = request.body, url = _a.url, nonce = _a.nonce, hmac = _a.hmac; | ||
var _a = request.body, url = _a.url, nonce = _a.nonce, hmac = _a.hmac, service_to_coronerd_url = _a.service_to_coronerd_url; | ||
if (!url || !nonce || !hmac) { | ||
@@ -127,2 +132,7 @@ throw new apiError_1.ApiError("missing parameters\n " + (!url ? 'url' : '') + "\n " + (!nonce ? 'nonce' : '') + "\n " + (!hmac ? 'hmac' : ''), 400); | ||
} | ||
/* Track registered coronerds information. */ | ||
if (!_this.registeredCoronerds[url]) { | ||
_this.registeredCoronerds[url] = {}; | ||
} | ||
_this.registeredCoronerds[url].service_to_coronerd_url = service_to_coronerd_url; | ||
if (opts && opts.coronerdCallback) { | ||
@@ -176,2 +186,11 @@ opts.coronerdCallback(url); | ||
} | ||
/** | ||
* Append service_to_coronerd_url if available. | ||
* It comes from coronerds that have successfully registered | ||
* with the service and have cached their info. | ||
*/ | ||
if (authRequest && this.registeredCoronerds[url].service_to_coronerd_url) { | ||
authRequest.service_to_coronerd_url = this.registeredCoronerds[url] | ||
.service_to_coronerd_url; | ||
} | ||
next(); | ||
@@ -178,0 +197,0 @@ return [3 /*break*/, 4]; |
{ | ||
"name": "backtrace-service", | ||
"version": "3.0.8-alpha", | ||
"version": "3.0.8-alpha2", | ||
"description": "Common tools for Backtrace Node services", | ||
@@ -5,0 +5,0 @@ "author": "Backtrace", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157808
2191