@nocobase/plugin-idp-oauth 2.1.0-alpha.15 → 2.1.0-alpha.17
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/externalVersion.js
CHANGED
|
@@ -11,8 +11,8 @@ 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.
|
|
15
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
16
|
-
"@nocobase/cache": "2.1.0-alpha.
|
|
17
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
14
|
+
"@nocobase/client": "2.1.0-alpha.17",
|
|
15
|
+
"@nocobase/flow-engine": "2.1.0-alpha.17",
|
|
16
|
+
"@nocobase/cache": "2.1.0-alpha.17",
|
|
17
|
+
"@nocobase/server": "2.1.0-alpha.17"
|
|
18
18
|
};
|
|
@@ -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-
|
|
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-17T02:45:30.127Z"}
|
package/dist/server/plugin.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Plugin } from '@nocobase/server';
|
|
|
10
10
|
import { IdpOauthService } from './service';
|
|
11
11
|
export declare class PluginIdpOauthServer extends Plugin {
|
|
12
12
|
service: IdpOauthService;
|
|
13
|
+
private registerDefaultApiResource;
|
|
13
14
|
load(): Promise<void>;
|
|
14
15
|
remove(): Promise<void>;
|
|
15
16
|
}
|
package/dist/server/plugin.js
CHANGED
|
@@ -38,6 +38,16 @@ var import_service = require("./service");
|
|
|
38
38
|
var import_utils = require("./utils");
|
|
39
39
|
class PluginIdpOauthServer extends import_server.Plugin {
|
|
40
40
|
service;
|
|
41
|
+
registerDefaultApiResource() {
|
|
42
|
+
this.service.registerResourceServer("api", {
|
|
43
|
+
path: "/",
|
|
44
|
+
scope: "api",
|
|
45
|
+
accessTokenFormat: "jwt",
|
|
46
|
+
jwt: {
|
|
47
|
+
sign: { alg: "RS256" }
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
41
51
|
async load() {
|
|
42
52
|
const bridgeTokenCache = await this.app.cacheManager.createCache({
|
|
43
53
|
name: "idp-oauth-token",
|
|
@@ -45,6 +55,7 @@ class PluginIdpOauthServer extends import_server.Plugin {
|
|
|
45
55
|
store: "memory"
|
|
46
56
|
});
|
|
47
57
|
this.service = new import_service.IdpOauthService(this.app, bridgeTokenCache);
|
|
58
|
+
this.registerDefaultApiResource();
|
|
48
59
|
const paths = (0, import_paths.createIdpOauthPaths)();
|
|
49
60
|
this.app.use(
|
|
50
61
|
async (ctx, next) => {
|
|
@@ -99,6 +110,8 @@ class PluginIdpOauthServer extends import_server.Plugin {
|
|
|
99
110
|
);
|
|
100
111
|
}
|
|
101
112
|
async remove() {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
(_b = (_a = this.service) == null ? void 0 : _a.unregisterResourceServer) == null ? void 0 : _b.call(_a, "api");
|
|
102
115
|
}
|
|
103
116
|
}
|
|
104
117
|
var plugin_default = PluginIdpOauthServer;
|
package/dist/server/service.js
CHANGED
|
@@ -62,6 +62,7 @@ function getJoseModule() {
|
|
|
62
62
|
}
|
|
63
63
|
const defaultSupportedScopes = ["openid", "offline_access", "profile", "email"];
|
|
64
64
|
const envJwksKeys = ["IDP_OAUTH_JWKS", "OAUTH_JWKS"];
|
|
65
|
+
const MAX_CACHE_TTL_MS = 2147483647;
|
|
65
66
|
class IdpOauthService {
|
|
66
67
|
constructor(app, bridgeTokenCache) {
|
|
67
68
|
this.app = app;
|
|
@@ -214,9 +215,16 @@ class IdpOauthService {
|
|
|
214
215
|
return `${(0, import_utils.normalizeBasePath)(process.env.API_BASE_PATH || "/api")}${normalizedPath}`;
|
|
215
216
|
}
|
|
216
217
|
getRequestResourceConfig(ctx) {
|
|
218
|
+
const requestPath = (0, import_utils.normalizeBasePath)(ctx.path || this.getRequestPath(ctx) || "/");
|
|
217
219
|
for (const config of this.resourceServers.values()) {
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
+
const resourcePath = this.getResourcePath(config);
|
|
221
|
+
if (!resourcePath) {
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const normalizedResourcePath = (0, import_utils.normalizeBasePath)(resourcePath);
|
|
225
|
+
const isRootResource = normalizedResourcePath === (0, import_utils.normalizeBasePath)(`${this.getApiBasePath()}/`);
|
|
226
|
+
const matches = requestPath === normalizedResourcePath || requestPath.startsWith(`${normalizedResourcePath}/`) || isRootResource && requestPath.startsWith(`${this.getApiBasePath()}/`);
|
|
227
|
+
if (matches) {
|
|
220
228
|
return config;
|
|
221
229
|
}
|
|
222
230
|
}
|
|
@@ -432,7 +440,7 @@ class IdpOauthService {
|
|
|
432
440
|
const cachedInternalToken = await this.bridgeTokenCache.get(bridgeTokenCacheKey);
|
|
433
441
|
const internalToken = cachedInternalToken || await this.issueInternalToken(user.id, oauthExpiresInMs);
|
|
434
442
|
if (!cachedInternalToken && typeof oauthExpiresInMs === "number" && oauthExpiresInMs > 0) {
|
|
435
|
-
await this.bridgeTokenCache.set(bridgeTokenCacheKey, internalToken, oauthExpiresInMs);
|
|
443
|
+
await this.bridgeTokenCache.set(bridgeTokenCacheKey, internalToken, Math.min(oauthExpiresInMs, MAX_CACHE_TTL_MS));
|
|
436
444
|
}
|
|
437
445
|
const authorizationHeader = `Bearer ${internalToken}`;
|
|
438
446
|
ctx.req.headers.authorization = authorizationHeader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-idp-oauth",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.17",
|
|
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": "
|
|
23
|
+
"gitHead": "586cb00f56557e66168b9720d0e0193a1b752067"
|
|
24
24
|
}
|