@routr/simpleauth 2.0.31 → 2.0.34

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/envs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const BIND_ADDR: string;
2
- export declare const WHITELIST: string[];
2
+ export declare const ALLOWLIST: string[];
3
3
  export declare const METHODS: string[];
4
4
  export declare const PATH_TO_AUTH: string;
package/dist/envs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a, _b, _c, _d, _e;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PATH_TO_AUTH = exports.METHODS = exports.WHITELIST = exports.BIND_ADDR = void 0;
4
+ exports.PATH_TO_AUTH = exports.METHODS = exports.ALLOWLIST = exports.BIND_ADDR = void 0;
5
5
  /*
6
6
  * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
7
7
  * http://github.com/fonoster
@@ -23,6 +23,6 @@ exports.PATH_TO_AUTH = exports.METHODS = exports.WHITELIST = exports.BIND_ADDR =
23
23
  const common_1 = require("@routr/common");
24
24
  common_1.Assertions.assertEnvsAreSet(["PATH_TO_AUTH", "METHODS"]);
25
25
  exports.BIND_ADDR = (_a = process.env.BIND_ADDR) !== null && _a !== void 0 ? _a : "0.0.0.0:51903";
26
- exports.WHITELIST = (_c = (_b = process.env.WHITELIST) === null || _b === void 0 ? void 0 : _b.split(",")) !== null && _c !== void 0 ? _c : [];
26
+ exports.ALLOWLIST = (_c = (_b = process.env.ALLOWLIST) === null || _b === void 0 ? void 0 : _b.split(",")) !== null && _c !== void 0 ? _c : [];
27
27
  exports.METHODS = (_e = (_d = process.env.METHODS) === null || _d === void 0 ? void 0 : _d.split(",")) !== null && _e !== void 0 ? _e : [];
28
28
  exports.PATH_TO_AUTH = process.env.PATH_TO_AUTH;
package/dist/runner.js CHANGED
@@ -34,7 +34,7 @@ try {
34
34
  (0, service_1.default)({
35
35
  users,
36
36
  bindAddr: envs_1.BIND_ADDR,
37
- whiteList: envs_1.WHITELIST,
37
+ allowlist: envs_1.ALLOWLIST,
38
38
  methods: envs_1.METHODS
39
39
  });
40
40
  }
package/dist/service.d.ts CHANGED
@@ -2,16 +2,16 @@
2
2
  import { User } from "./types";
3
3
  /**
4
4
  * A simple authentication middleware that authenticates users based on a list of users
5
- * or whitelisted endpoints paths.
5
+ * or allowlist endpoints paths.
6
6
  *
7
7
  * @param {MiddlewareConfig} config - configuration for the middleware
8
8
  * @param {string} config.bindAddr - address to bind to
9
9
  * @param {User[]} config.users - list of users
10
- * @param {string[]} config.whiteList - list of path that required no authentication
10
+ * @param {string[]} config.allowlist - list of path that required no authentication
11
11
  */
12
12
  export default function simpleAuthMiddleware(config: {
13
13
  bindAddr: string;
14
14
  users: User[];
15
- whiteList: string[];
15
+ allowlist: string[];
16
16
  methods: string[];
17
17
  }): void;
package/dist/service.js CHANGED
@@ -29,15 +29,15 @@ const logger_1 = require("@fonoster/logger");
29
29
  const logger = (0, logger_1.getLogger)({ service: "simpledata", filePath: __filename });
30
30
  /**
31
31
  * A simple authentication middleware that authenticates users based on a list of users
32
- * or whitelisted endpoints paths.
32
+ * or allowlist endpoints paths.
33
33
  *
34
34
  * @param {MiddlewareConfig} config - configuration for the middleware
35
35
  * @param {string} config.bindAddr - address to bind to
36
36
  * @param {User[]} config.users - list of users
37
- * @param {string[]} config.whiteList - list of path that required no authentication
37
+ * @param {string[]} config.allowlist - list of path that required no authentication
38
38
  */
39
39
  function simpleAuthMiddleware(config) {
40
- const { bindAddr, users, whiteList, methods } = config;
40
+ const { bindAddr, users, allowlist, methods } = config;
41
41
  new processor_1.default({ bindAddr, name: "simpleauth" }).listen((req, res) => {
42
42
  const tracer = api_1.default.trace.getTracer("routr-tracer");
43
43
  const currentSpan = api_1.default.trace.getSpan(api_1.default.context.active());
@@ -48,7 +48,7 @@ function simpleAuthMiddleware(config) {
48
48
  if (!methods.includes(req.method)) {
49
49
  return res.send(req);
50
50
  }
51
- if (whiteList.includes(req.message.from.address.uri.user)) {
51
+ if (allowlist.includes(req.message.from.address.uri.user)) {
52
52
  span.addEvent(`authenticated ${req.message.from.address.uri.user} from whitelist`);
53
53
  span.end();
54
54
  return res.send(req);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/simpleauth",
3
- "version": "2.0.31",
3
+ "version": "2.0.34",
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",
@@ -46,5 +46,5 @@
46
46
  "bugs": {
47
47
  "url": "https://github.com/fonoster/routr/issues"
48
48
  },
49
- "gitHead": "bef1839e53701906f0739c8116639a1371f69173"
49
+ "gitHead": "08d6e74366c68070d2b8812627eda6fbe61ee6fc"
50
50
  }