@routr/simpleauth 2.0.5-alpha.6 → 2.0.5-alpha.7

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.
package/dist/runner.js CHANGED
@@ -30,7 +30,7 @@ if (!process.env.PATH_TO_AUTH) {
30
30
  }
31
31
  try {
32
32
  const users = require(process.env.PATH_TO_AUTH);
33
- service_1.default({ bindAddr: "", users });
33
+ service_1.default({ bindAddr: process.env.BIND_ADDR || "0.0.0.0:51903", users });
34
34
  }
35
35
  catch (e) {
36
36
  if (e.code === "MODULE_NOT_FOUND") {
package/dist/service.js CHANGED
@@ -30,21 +30,26 @@ function SimpleAuthProcessor(config) {
30
30
  const { bindAddr, users } = config;
31
31
  new processor_1.default({ bindAddr, name: "simpleauth" })
32
32
  .listen((req, res) => {
33
- logger_1.default.verbose(JSON.stringify(req, null, ' '));
33
+ //logger.verbose(JSON.stringify(req, null, ' '))
34
+ logger_1.default.verbose("dbg000");
34
35
  // Calculate and return challenge
35
36
  if (req.message.authorization) {
36
37
  const auth = Object.assign({}, req.message.authorization);
37
38
  auth.method = req.method;
38
39
  // Calculate response and compare with the one send by the endpoint
39
40
  const calcRes = common_1.calculateAuthResponse(auth, utils_1.getCredentials(auth.username, users));
41
+ logger_1.default.verbose("dbg001");
40
42
  if (calcRes !== auth.response) {
43
+ logger_1.default.verbose("dbg002");
41
44
  return res.send(utils_1.createUnauthorizedResponse(auth.realm));
42
45
  }
43
46
  }
44
47
  else {
45
- return res.send(utils_1.createUnauthorizedResponse(req.message.request_uri.host));
48
+ logger_1.default.verbose("dbg003");
49
+ return res.send(utils_1.createUnauthorizedResponse(req.message.requestUri.host));
46
50
  }
47
51
  // Forward request to next middleware
52
+ logger_1.default.verbose("yyy" + JSON.stringify(req, null, ' '));
48
53
  res.send(req);
49
54
  });
50
55
  }
package/dist/utils.d.ts CHANGED
@@ -5,8 +5,8 @@ export declare const createUnauthorizedResponse: (realm: string, params?: {
5
5
  algorithm: string;
6
6
  }) => {
7
7
  message: {
8
- response_type: number;
9
- www_authenticate: {
8
+ responseType: number;
9
+ wwwAuthenticate: {
10
10
  scheme: string;
11
11
  realm: string;
12
12
  qop: string;
package/dist/utils.js CHANGED
@@ -26,8 +26,8 @@ const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: "M
26
26
  return {
27
27
  message: {
28
28
  // UNAUTHORIZED CODE
29
- response_type: 17,
30
- www_authenticate: {
29
+ responseType: 17,
30
+ wwwAuthenticate: {
31
31
  scheme: 'Digest',
32
32
  realm: realm,
33
33
  qop: params.qop,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/simpleauth",
3
- "version": "2.0.5-alpha.6",
3
+ "version": "2.0.5-alpha.7",
4
4
  "description": "This middleware delegates authentication to an external service",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@fonoster/logger": "^0.3.3",
23
- "@routr/common": "^2.0.5-alpha.6",
24
- "@routr/processor": "^2.0.5-alpha.6"
23
+ "@routr/common": "^2.0.5-alpha.7",
24
+ "@routr/processor": "^2.0.5-alpha.7"
25
25
  },
26
26
  "files": [
27
27
  "dist"
@@ -36,5 +36,5 @@
36
36
  "bugs": {
37
37
  "url": "https://github.com/fonoster/routr/issues"
38
38
  },
39
- "gitHead": "ac4963e735fbc4ad3045379463796137e650509c"
39
+ "gitHead": "690b6fc677009c8c416c7c737b1cc5360b9ed7c7"
40
40
  }