@nocobase/plugin-idp-oauth 2.1.0-alpha.19 → 2.1.0-alpha.20

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.
@@ -11,10 +11,10 @@ module.exports = {
11
11
  "antd": "5.24.2",
12
12
  "react": "18.2.0",
13
13
  "react-router-dom": "6.30.1",
14
- "@nocobase/client": "2.1.0-alpha.19",
15
- "@nocobase/flow-engine": "2.1.0-alpha.19",
16
- "@nocobase/server": "2.1.0-alpha.19",
17
- "@nocobase/cache": "2.1.0-alpha.19",
18
- "@nocobase/utils": "2.1.0-alpha.19",
19
- "@nocobase/database": "2.1.0-alpha.19"
14
+ "@nocobase/client": "2.1.0-alpha.20",
15
+ "@nocobase/flow-engine": "2.1.0-alpha.20",
16
+ "@nocobase/server": "2.1.0-alpha.20",
17
+ "@nocobase/cache": "2.1.0-alpha.20",
18
+ "@nocobase/utils": "2.1.0-alpha.20",
19
+ "@nocobase/database": "2.1.0-alpha.20"
20
20
  };
@@ -1 +1 @@
1
- {"name":"light-my-request","version":"6.6.0","description":"Fake HTTP injection library","main":"index.js","type":"commonjs","types":"types/index.d.ts","dependencies":{"cookie":"^1.0.1","process-warning":"^4.0.0","set-cookie-parser":"^2.6.0"},"devDependencies":{"@fastify/ajv-compiler":"^4.0.0","@fastify/pre-commit":"^2.1.0","@types/node":"^22.7.7","c8":"^10.1.2","end-of-stream":"^1.4.4","eslint":"^9.17.0","express":"^4.19.2","form-auto-content":"^3.2.1","form-data":"^4.0.0","formdata-node":"^6.0.3","multer":"^1.4.5-lts.1","neostandard":"^0.12.0","tinybench":"^3.0.0","tsd":"^0.31.0","undici":"^7.0.0"},"scripts":{"benchmark":"node benchmark/benchmark.js","coverage":"npm run unit -- --cov --coverage-report=html","lint":"eslint","lint:fix":"eslint --fix","test":"npm run lint && npm run test:unit && npm run test:typescript","test:typescript":"tsd","test:unit":"c8 --100 node --test"},"repository":{"type":"git","url":"git+https://github.com/fastify/light-my-request.git"},"keywords":["http","inject","fake","request","server"],"author":"Tomas Della Vedova - @delvedor (http://delved.org)","contributors":[{"name":"Matteo Collina","email":"hello@matteocollina.com"},{"name":"Manuel Spigolon","email":"behemoth89@gmail.com"},{"name":"Aras Abbasi","email":"aras.abbasi@gmail.com"},{"name":"Frazer Smith","email":"frazer.dev@icloud.com","url":"https://github.com/fdawgs"}],"license":"BSD-3-Clause","bugs":{"url":"https://github.com/fastify/light-my-request/issues"},"homepage":"https://github.com/fastify/light-my-request#readme","funding":[{"type":"github","url":"https://github.com/sponsors/fastify"},{"type":"opencollective","url":"https://opencollective.com/fastify"}],"_lastModified":"2026-04-19T04:12:08.762Z"}
1
+ {"name":"light-my-request","version":"6.6.0","description":"Fake HTTP injection library","main":"index.js","type":"commonjs","types":"types/index.d.ts","dependencies":{"cookie":"^1.0.1","process-warning":"^4.0.0","set-cookie-parser":"^2.6.0"},"devDependencies":{"@fastify/ajv-compiler":"^4.0.0","@fastify/pre-commit":"^2.1.0","@types/node":"^22.7.7","c8":"^10.1.2","end-of-stream":"^1.4.4","eslint":"^9.17.0","express":"^4.19.2","form-auto-content":"^3.2.1","form-data":"^4.0.0","formdata-node":"^6.0.3","multer":"^1.4.5-lts.1","neostandard":"^0.12.0","tinybench":"^3.0.0","tsd":"^0.31.0","undici":"^7.0.0"},"scripts":{"benchmark":"node benchmark/benchmark.js","coverage":"npm run unit -- --cov --coverage-report=html","lint":"eslint","lint:fix":"eslint --fix","test":"npm run lint && npm run test:unit && npm run test:typescript","test:typescript":"tsd","test:unit":"c8 --100 node --test"},"repository":{"type":"git","url":"git+https://github.com/fastify/light-my-request.git"},"keywords":["http","inject","fake","request","server"],"author":"Tomas Della Vedova - @delvedor (http://delved.org)","contributors":[{"name":"Matteo Collina","email":"hello@matteocollina.com"},{"name":"Manuel Spigolon","email":"behemoth89@gmail.com"},{"name":"Aras Abbasi","email":"aras.abbasi@gmail.com"},{"name":"Frazer Smith","email":"frazer.dev@icloud.com","url":"https://github.com/fdawgs"}],"license":"BSD-3-Clause","bugs":{"url":"https://github.com/fastify/light-my-request/issues"},"homepage":"https://github.com/fastify/light-my-request#readme","funding":[{"type":"github","url":"https://github.com/sponsors/fastify"},{"type":"opencollective","url":"https://opencollective.com/fastify"}],"_lastModified":"2026-04-20T10:42:57.367Z"}
@@ -217,6 +217,8 @@ class IdpOauthService {
217
217
  }
218
218
  getRequestResourceConfig(ctx) {
219
219
  const requestPath = (0, import_utils2.normalizeBasePath)(ctx.path || this.getRequestPath(ctx) || "/");
220
+ let matchedConfig;
221
+ let matchedPathLength = -1;
220
222
  for (const config of this.resourceServers.values()) {
221
223
  const resourcePath = this.getResourcePath(config);
222
224
  if (!resourcePath) {
@@ -226,10 +228,13 @@ class IdpOauthService {
226
228
  const isRootResource = normalizedResourcePath === (0, import_utils2.normalizeBasePath)(`${this.getApiBasePath()}/`);
227
229
  const matches = requestPath === normalizedResourcePath || requestPath.startsWith(`${normalizedResourcePath}/`) || isRootResource && requestPath.startsWith(`${this.getApiBasePath()}/`);
228
230
  if (matches) {
229
- return config;
231
+ if (normalizedResourcePath.length > matchedPathLength) {
232
+ matchedConfig = config;
233
+ matchedPathLength = normalizedResourcePath.length;
234
+ }
230
235
  }
231
236
  }
232
- return void 0;
237
+ return matchedConfig;
233
238
  }
234
239
  async getProviderJwks(provider) {
235
240
  if (this.resourceJwks.has(provider.issuer)) {
@@ -445,7 +450,10 @@ class IdpOauthService {
445
450
  }
446
451
  const authorizationHeader = `Bearer ${internalToken}`;
447
452
  ctx.req.headers.authorization = authorizationHeader;
453
+ ctx.request.headers.authorization = authorizationHeader;
454
+ ctx.getBearerToken = () => internalToken;
448
455
  ctx.req.headers["x-authenticator"] = "basic";
456
+ ctx.request.headers["x-authenticator"] = "basic";
449
457
  ctx.state.currentUser = user;
450
458
  ctx.auth = ctx.auth || {};
451
459
  ctx.auth.user = user;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-idp-oauth",
3
- "version": "2.1.0-alpha.19",
3
+ "version": "2.1.0-alpha.20",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "IdP: OAuth",
6
6
  "displayName.zh-CN": "IdP: OAuth",
@@ -20,5 +20,5 @@
20
20
  "keywords": [
21
21
  "Authentication"
22
22
  ],
23
- "gitHead": "3d13700360eac1c0f9dbf6a5f167ed396a294a3c"
23
+ "gitHead": "3d1535db6bf93ca23257faf474afee0d565f54c6"
24
24
  }