@meru2802/aux-server 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/authMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,QAAQ,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"authMiddleware.d.ts","sourceRoot":"","sources":["../../src/middleware/authMiddleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,qBAAa,cAAe,SAAQ,cAAc;gBACpC,gBAAgB,CAAC,EAAE,iBAAiB;IAIzC,QAAQ,GAAI,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,UAgLhE;IAEK,WAAW,GAChB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAAC,CAmFd;CACH"}
|
|
@@ -45,10 +45,13 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
|
|
|
45
45
|
constructor(serviceContainer) {
|
|
46
46
|
super(serviceContainer);
|
|
47
47
|
this.hmacAuth = (req, res, next) => {
|
|
48
|
+
var _a;
|
|
48
49
|
try {
|
|
49
50
|
const signature = req.headers["x-hmac-signature"];
|
|
50
51
|
const timestamp = req.headers["x-hmac-timestamp"];
|
|
51
52
|
const nonce = req.headers["x-hmac-nonce"];
|
|
53
|
+
const hostname = ((_a = req.headers.host) === null || _a === void 0 ? void 0 : _a.trim()) || req.hostname.trim();
|
|
54
|
+
console.log(`Request hostname: ${hostname}`);
|
|
52
55
|
if (!signature || !timestamp || !nonce) {
|
|
53
56
|
const unauthorizedResponse = {
|
|
54
57
|
error: "UnauthorizedException",
|
|
@@ -134,7 +137,7 @@ class AuthMiddleware extends BaseMiddleware_1.BaseMiddleware {
|
|
|
134
137
|
req.originalUrl,
|
|
135
138
|
timestamp,
|
|
136
139
|
nonce,
|
|
137
|
-
`content-type:application/json;host:${
|
|
140
|
+
`content-type:application/json;host:${hostname}`,
|
|
138
141
|
bodyHash,
|
|
139
142
|
].join("\n");
|
|
140
143
|
console.log(`HMAC Message: ${message}`);
|