@vsaas/loopback 12.2.5 → 12.3.1

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.
@@ -253,6 +253,21 @@ var require_application = /* @__PURE__ */ require_runtime.__commonJSMin(((export
253
253
  */
254
254
  app.dataSources = app.datasources = {};
255
255
  /**
256
+ * Decide whether the caller of a remote invocation is authenticated.
257
+ *
258
+ * An ACL denial for an authenticated caller uses `aclErrorStatus`; an
259
+ * anonymous caller is always denied with 401. By default only a LoopBack
260
+ * access token authenticates. Applications that authenticate callers by other
261
+ * means (API keys, device tokens, server keys) override this method so their
262
+ * denials are reported as the configured status instead of 401.
263
+ *
264
+ * @param {Object} ctx The remoting context.
265
+ * @returns {boolean}
266
+ */
267
+ app.isRequestAuthenticated = function(ctx) {
268
+ return Boolean(ctx.req && ctx.req.accessToken);
269
+ };
270
+ /**
256
271
  * Enable app wide authentication.
257
272
  */
258
273
  app.enableAuth = function(options) {
@@ -291,7 +306,7 @@ var require_application = /* @__PURE__ */ require_runtime.__commonJSMin(((export
291
306
  const modelId = modelInstance && modelInstance.id || (req.params && req.params.id !== void 0 ? req.params.id : req.body && req.body.id !== void 0 ? req.body.id : req.query && req.query.id !== void 0 ? req.query.id : void 0);
292
307
  const modelName = Model.modelName;
293
308
  let errStatusCode = (Model.settings || {}).aclErrorStatus || app.get("aclErrorStatus") || 401;
294
- if (!req.accessToken) errStatusCode = 401;
309
+ if (!app.isRequestAuthenticated(ctx)) errStatusCode = 401;
295
310
  if (Model.checkAccess) utils.invokeWithCallback(Model.checkAccess, Model, [
296
311
  req.accessToken,
297
312
  modelId,
package/dist/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  var require_package = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__commonJSMin(((exports, module) => {
3
3
  module.exports = {
4
4
  "name": "@vsaas/loopback",
5
- "version": "12.2.5",
5
+ "version": "12.3.1",
6
6
  "description": "Fork of LoopBack 3 framework for building APIs and microservices in Node.js",
7
7
  "keywords": [
8
8
  "StrongLoop",
@@ -117,7 +117,7 @@ var require_package = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs"
117
117
  "express": "catalog:",
118
118
  "isemail": "^3.2.0",
119
119
  "loopback-filters": "^1.1.1",
120
- "nodemailer": "^9.0.5",
120
+ "nodemailer": "catalog:",
121
121
  "otplib": "catalog:",
122
122
  "serve-favicon": "^2.5.1"
123
123
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vsaas/loopback",
3
- "version": "12.2.5",
3
+ "version": "12.3.1",
4
4
  "description": "Fork of LoopBack 3 framework for building APIs and microservices in Node.js",
5
5
  "keywords": [
6
6
  "StrongLoop",
@@ -98,15 +98,15 @@
98
98
  "debug": "^2.6.9",
99
99
  "depd": "^1.1.2",
100
100
  "ejs": "5.0.1",
101
- "express": "4.22.2",
101
+ "express": "4.22.3",
102
102
  "isemail": "^3.2.0",
103
103
  "loopback-filters": "^1.1.1",
104
- "nodemailer": "^9.0.5",
104
+ "nodemailer": "^9.1.1",
105
105
  "otplib": "13.4.1",
106
106
  "serve-favicon": "^2.5.1",
107
- "@vsaas/loopback-connector-remote": "^12.0.2",
108
- "@vsaas/remoting": "^13.0.1",
109
- "@vsaas/loopback-datasource-juggler": "^13.0.1"
107
+ "@vsaas/remoting": "^13.0.2",
108
+ "@vsaas/loopback-datasource-juggler": "^13.0.3",
109
+ "@vsaas/loopback-connector-remote": "^12.0.2"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@types/node": "25.5.0",
@@ -124,8 +124,8 @@
124
124
  "tsdown": "0.22.14",
125
125
  "typescript": "6.0.2",
126
126
  "vitest": "4.1.11",
127
- "@vsaas/error-handler": "^12.0.1",
128
- "@vsaas/loopback-boot": "^12.0.2"
127
+ "@vsaas/loopback-boot": "^12.0.2",
128
+ "@vsaas/error-handler": "^12.0.1"
129
129
  },
130
130
  "engines": {
131
131
  "node": ">=24"