@frontmcp/auth 1.10.8 → 1.10.9-rc.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.
- package/esm/index.mjs +17 -1
- package/esm/package.json +5 -5
- package/index.js +30 -4
- package/jwks/jose.loader.d.ts +5 -0
- package/jwks/jose.loader.d.ts.map +1 -0
- package/jwks/jwks.service.d.ts +1 -1
- package/jwks/jwks.service.d.ts.map +1 -1
- package/package.json +5 -5
package/esm/index.mjs
CHANGED
|
@@ -478,7 +478,6 @@ var init_cimd_cache = __esm({
|
|
|
478
478
|
});
|
|
479
479
|
|
|
480
480
|
// libs/auth/src/jwks/jwks.service.ts
|
|
481
|
-
import { createLocalJWKSet, decodeProtectedHeader, jwtVerify } from "jose";
|
|
482
481
|
import {
|
|
483
482
|
bytesToHex,
|
|
484
483
|
createKeyPersistence,
|
|
@@ -833,6 +832,22 @@ var noopAuthLogger = {
|
|
|
833
832
|
}
|
|
834
833
|
};
|
|
835
834
|
|
|
835
|
+
// libs/auth/src/jwks/jose.loader.ts
|
|
836
|
+
var jose;
|
|
837
|
+
function loadJose() {
|
|
838
|
+
jose ??= import("jose").catch((importError) => {
|
|
839
|
+
try {
|
|
840
|
+
return __require("jose");
|
|
841
|
+
} catch {
|
|
842
|
+
throw importError;
|
|
843
|
+
}
|
|
844
|
+
}).catch((error) => {
|
|
845
|
+
jose = void 0;
|
|
846
|
+
throw error;
|
|
847
|
+
});
|
|
848
|
+
return jose;
|
|
849
|
+
}
|
|
850
|
+
|
|
836
851
|
// libs/auth/src/jwks/jwks.utils.ts
|
|
837
852
|
function trimSlash(s) {
|
|
838
853
|
const str = s ?? "";
|
|
@@ -949,6 +964,7 @@ var JwksService = class {
|
|
|
949
964
|
*/
|
|
950
965
|
async verifyTransparentToken(token, candidates) {
|
|
951
966
|
if (!candidates?.length) return { ok: false, error: "no_providers" };
|
|
967
|
+
const { createLocalJWKSet, decodeProtectedHeader, jwtVerify } = await loadJose();
|
|
952
968
|
let kid;
|
|
953
969
|
try {
|
|
954
970
|
const header = decodeProtectedHeader(token);
|
package/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/auth",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9-rc.1",
|
|
4
4
|
"description": "Authentication and authorization for FrontMCP servers: auth modes, OAuth 2.1 (local and remote), JWT and session checks, authorities and the credential vault",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://frontmcp.dev/reference/auth",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"node": ">=24.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@frontmcp/lazy-zod": "1.10.
|
|
56
|
-
"@frontmcp/storage-sqlite": "1.10.
|
|
55
|
+
"@frontmcp/lazy-zod": "1.10.9-rc.1",
|
|
56
|
+
"@frontmcp/storage-sqlite": "1.10.9-rc.1",
|
|
57
57
|
"@vercel/kv": "^3.0.0",
|
|
58
58
|
"ioredis": "^5.0.0"
|
|
59
59
|
},
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@frontmcp/di": "1.10.
|
|
73
|
-
"@frontmcp/utils": "1.10.
|
|
72
|
+
"@frontmcp/di": "1.10.9-rc.1",
|
|
73
|
+
"@frontmcp/utils": "1.10.9-rc.1",
|
|
74
74
|
"jose": "^6.0.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __esm = (fn, res, err) => function __init() {
|
|
7
9
|
if (err) throw err[0];
|
|
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
25
|
}
|
|
24
26
|
return to;
|
|
25
27
|
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
26
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
37
|
|
|
28
38
|
// libs/auth/src/cimd/cimd-redis.cache.ts
|
|
@@ -822,7 +832,6 @@ __export(index_exports, {
|
|
|
822
832
|
module.exports = __toCommonJS(index_exports);
|
|
823
833
|
|
|
824
834
|
// libs/auth/src/jwks/jwks.service.ts
|
|
825
|
-
var import_jose = require("jose");
|
|
826
835
|
var import_utils2 = require("@frontmcp/utils");
|
|
827
836
|
|
|
828
837
|
// libs/auth/src/cimd/cimd.validator.ts
|
|
@@ -1170,6 +1179,22 @@ var noopAuthLogger = {
|
|
|
1170
1179
|
}
|
|
1171
1180
|
};
|
|
1172
1181
|
|
|
1182
|
+
// libs/auth/src/jwks/jose.loader.ts
|
|
1183
|
+
var jose;
|
|
1184
|
+
function loadJose() {
|
|
1185
|
+
jose ??= import("jose").catch((importError) => {
|
|
1186
|
+
try {
|
|
1187
|
+
return require("jose");
|
|
1188
|
+
} catch {
|
|
1189
|
+
throw importError;
|
|
1190
|
+
}
|
|
1191
|
+
}).catch((error) => {
|
|
1192
|
+
jose = void 0;
|
|
1193
|
+
throw error;
|
|
1194
|
+
});
|
|
1195
|
+
return jose;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1173
1198
|
// libs/auth/src/jwks/jwks.utils.ts
|
|
1174
1199
|
function trimSlash(s) {
|
|
1175
1200
|
const str = s ?? "";
|
|
@@ -1286,9 +1311,10 @@ var JwksService = class {
|
|
|
1286
1311
|
*/
|
|
1287
1312
|
async verifyTransparentToken(token, candidates) {
|
|
1288
1313
|
if (!candidates?.length) return { ok: false, error: "no_providers" };
|
|
1314
|
+
const { createLocalJWKSet, decodeProtectedHeader, jwtVerify } = await loadJose();
|
|
1289
1315
|
let kid;
|
|
1290
1316
|
try {
|
|
1291
|
-
const header =
|
|
1317
|
+
const header = decodeProtectedHeader(token);
|
|
1292
1318
|
kid = typeof header?.kid === "string" ? header.kid : void 0;
|
|
1293
1319
|
} catch {
|
|
1294
1320
|
}
|
|
@@ -1301,9 +1327,9 @@ var JwksService = class {
|
|
|
1301
1327
|
jwks = await this.refetchForUnknownKid(p) ?? jwks;
|
|
1302
1328
|
}
|
|
1303
1329
|
if (!jwks?.keys?.length) continue;
|
|
1304
|
-
const JWKS =
|
|
1330
|
+
const JWKS = createLocalJWKSet(jwks);
|
|
1305
1331
|
const issuerConstraint = this.issuerConstraintFor(p);
|
|
1306
|
-
const { payload, protectedHeader } = await
|
|
1332
|
+
const { payload, protectedHeader } = await jwtVerify(token, JWKS, {
|
|
1307
1333
|
// Pin to asymmetric algorithms so a symmetric key in the provider JWKS
|
|
1308
1334
|
// can't be used to accept an HMAC-signed token, and `none` is refused.
|
|
1309
1335
|
algorithms: [...TRANSPARENT_JWT_ALGS],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jose.loader.d.ts","sourceRoot":"","sources":["../../src/jwks/jose.loader.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG,cAAc,MAAM,CAAC,CAAC;AAIlC,oHAAoH;AACpH,wBAAgB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAcxC"}
|
package/jwks/jwks.service.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwks.service.d.ts","sourceRoot":"","sources":["../../src/jwks/jwks.service.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"jwks.service.d.ts","sourceRoot":"","sources":["../../src/jwks/jwks.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAO,MAAM,MAAM,CAAC;AAe/C,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAmDlG,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+C;IAEpE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,eAAe,CAAqB;IAG5C,OAAO,CAAC,eAAe,CAKrB;IAGF,OAAO,CAAC,YAAY,CAAiE;IAGrF,OAAO,CAAC,mBAAmB,CAAsF;IAGjH,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,cAAc,CAA4B;IAElD,OAAO,CAAC,cAAc,CAAC,CAAiB;gBAE5B,IAAI,CAAC,EAAE,kBAAkB;IAcrC;;;OAGG;YACW,iBAAiB;IAc/B,mFAAmF;IAC7E,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC;IAQ7C;;;OAGG;IACG,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;IAuEnG;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,mBAAmB;IAe3B;;OAEG;IACH,OAAO,CAAC,cAAc;IAatB;;;OAGG;YACW,iBAAiB;IAwG/B;;OAEG;IACH,OAAO,CAAC,eAAe;IAuBvB,kEAAkE;IAClE,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAIvD;;;;;;;;;;OAUG;IACG,kBAAkB,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IA2BpF;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;OAIG;YACW,iBAAiB;IAwB/B,yEAAyE;IACnE,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC;IAKnD,wEAAwE;IAClE,yBAAyB,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,OAAO,aAAa,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;YAShG,YAAY;YAaZ,cAAc;YAQd,SAAS;YAgET,qBAAqB;YAyBrB,yBAAyB;IA+DvC,OAAO,CAAC,WAAW;CAgBpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/auth",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.9-rc.1",
|
|
4
4
|
"description": "Authentication and authorization for FrontMCP servers: auth modes, OAuth 2.1 (local and remote), JWT and session checks, authorities and the credential vault",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://frontmcp.dev/reference/auth",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"node": ">=24.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@frontmcp/lazy-zod": "1.10.
|
|
56
|
-
"@frontmcp/storage-sqlite": "1.10.
|
|
55
|
+
"@frontmcp/lazy-zod": "1.10.9-rc.1",
|
|
56
|
+
"@frontmcp/storage-sqlite": "1.10.9-rc.1",
|
|
57
57
|
"@vercel/kv": "^3.0.0",
|
|
58
58
|
"ioredis": "^5.0.0"
|
|
59
59
|
},
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@frontmcp/di": "1.10.
|
|
73
|
-
"@frontmcp/utils": "1.10.
|
|
72
|
+
"@frontmcp/di": "1.10.9-rc.1",
|
|
73
|
+
"@frontmcp/utils": "1.10.9-rc.1",
|
|
74
74
|
"jose": "^6.0.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|