@muze-nl/metro-oidc 0.5.5 → 0.5.6
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/browser.js +259 -400
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +4 -4
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -147,9 +147,9 @@
|
|
|
147
147
|
return new Client(...deepClone(options));
|
|
148
148
|
}
|
|
149
149
|
function getRequestParams(req, current) {
|
|
150
|
-
let
|
|
151
|
-
if (!
|
|
152
|
-
|
|
150
|
+
let params = current || {};
|
|
151
|
+
if (!params.url && current.url) {
|
|
152
|
+
params.url = current.url;
|
|
153
153
|
}
|
|
154
154
|
for (let prop of [
|
|
155
155
|
"method",
|
|
@@ -175,27 +175,27 @@
|
|
|
175
175
|
value = value[Symbol.metroSource];
|
|
176
176
|
}
|
|
177
177
|
if (typeof value == "function") {
|
|
178
|
-
|
|
178
|
+
params[prop] = value(params[prop], params);
|
|
179
179
|
} else {
|
|
180
180
|
if (prop == "url") {
|
|
181
|
-
|
|
181
|
+
params.url = url(params.url, value);
|
|
182
182
|
} else if (prop == "headers") {
|
|
183
|
-
|
|
183
|
+
params.headers = new Headers(current.headers);
|
|
184
184
|
if (!(value instanceof Headers)) {
|
|
185
185
|
value = new Headers(req.headers);
|
|
186
186
|
}
|
|
187
187
|
for (let [key, val] of value.entries()) {
|
|
188
|
-
|
|
188
|
+
params.headers.set(key, val);
|
|
189
189
|
}
|
|
190
190
|
} else {
|
|
191
|
-
|
|
191
|
+
params[prop] = value;
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
if (req instanceof Request && req.data) {
|
|
196
|
-
|
|
196
|
+
params.body = req.data;
|
|
197
197
|
}
|
|
198
|
-
return
|
|
198
|
+
return params;
|
|
199
199
|
}
|
|
200
200
|
function request(...options) {
|
|
201
201
|
let requestParams = {
|
|
@@ -259,9 +259,9 @@
|
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
261
|
function getResponseParams(res, current) {
|
|
262
|
-
let
|
|
263
|
-
if (!
|
|
264
|
-
|
|
262
|
+
let params = current || {};
|
|
263
|
+
if (!params.url && current.url) {
|
|
264
|
+
params.url = current.url;
|
|
265
265
|
}
|
|
266
266
|
for (let prop of ["status", "statusText", "headers", "body", "url", "type", "redirected"]) {
|
|
267
267
|
let value = res[prop];
|
|
@@ -272,19 +272,19 @@
|
|
|
272
272
|
value = value[Symbol.metroSource];
|
|
273
273
|
}
|
|
274
274
|
if (typeof value == "function") {
|
|
275
|
-
|
|
275
|
+
params[prop] = value(params[prop], params);
|
|
276
276
|
} else {
|
|
277
277
|
if (prop == "url") {
|
|
278
|
-
|
|
278
|
+
params.url = new URL(value, params.url || "https://localhost/");
|
|
279
279
|
} else {
|
|
280
|
-
|
|
280
|
+
params[prop] = value;
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
if (res instanceof Response && res.data) {
|
|
285
|
-
|
|
285
|
+
params.body = res.data;
|
|
286
286
|
}
|
|
287
|
-
return
|
|
287
|
+
return params;
|
|
288
288
|
}
|
|
289
289
|
function response(...options) {
|
|
290
290
|
let responseParams = {};
|
|
@@ -343,12 +343,12 @@
|
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
function appendSearchParams(url2,
|
|
347
|
-
if (typeof
|
|
348
|
-
|
|
346
|
+
function appendSearchParams(url2, params) {
|
|
347
|
+
if (typeof params == "function") {
|
|
348
|
+
params(url2.searchParams, url2);
|
|
349
349
|
} else {
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
params = new URLSearchParams(params);
|
|
351
|
+
params.forEach((value, key) => {
|
|
352
352
|
url2.searchParams.append(key, value);
|
|
353
353
|
});
|
|
354
354
|
}
|
|
@@ -467,31 +467,31 @@
|
|
|
467
467
|
});
|
|
468
468
|
}
|
|
469
469
|
function formdata(...options) {
|
|
470
|
-
var
|
|
470
|
+
var params = new FormData();
|
|
471
471
|
for (let option of options) {
|
|
472
472
|
if (option instanceof HTMLFormElement) {
|
|
473
473
|
option = new FormData(option);
|
|
474
474
|
}
|
|
475
475
|
if (option instanceof FormData) {
|
|
476
476
|
for (let entry of option.entries()) {
|
|
477
|
-
|
|
477
|
+
params.append(entry[0], entry[1]);
|
|
478
478
|
}
|
|
479
479
|
} else if (option && typeof option == "object") {
|
|
480
480
|
for (let entry of Object.entries(option)) {
|
|
481
481
|
if (Array.isArray(entry[1])) {
|
|
482
482
|
for (let value of entry[1]) {
|
|
483
|
-
|
|
483
|
+
params.append(entry[0], value);
|
|
484
484
|
}
|
|
485
485
|
} else {
|
|
486
|
-
|
|
486
|
+
params.append(entry[0], entry[1]);
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
} else {
|
|
490
490
|
throw new metroError("metro.formdata: unknown option type " + metroURL + "formdata/unknown-option-value/", option);
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
Object.freeze(
|
|
494
|
-
return new Proxy(
|
|
493
|
+
Object.freeze(params);
|
|
494
|
+
return new Proxy(params, {
|
|
495
495
|
get(target, prop) {
|
|
496
496
|
let result;
|
|
497
497
|
switch (prop) {
|
|
@@ -737,8 +737,14 @@
|
|
|
737
737
|
}
|
|
738
738
|
var everything_default = metro;
|
|
739
739
|
|
|
740
|
-
// node_modules/@muze-nl/
|
|
740
|
+
// node_modules/@muze-nl/assert/src/assert.mjs
|
|
741
741
|
globalThis.assertEnabled = false;
|
|
742
|
+
function enable() {
|
|
743
|
+
globalThis.assertEnabled = true;
|
|
744
|
+
}
|
|
745
|
+
function disable() {
|
|
746
|
+
globalThis.assertEnabled = false;
|
|
747
|
+
}
|
|
742
748
|
function assert(source, test) {
|
|
743
749
|
if (globalThis.assertEnabled) {
|
|
744
750
|
let problems = fails(source, test);
|
|
@@ -768,6 +774,51 @@
|
|
|
768
774
|
}
|
|
769
775
|
};
|
|
770
776
|
}
|
|
777
|
+
function Recommended(pattern) {
|
|
778
|
+
return function _Recommended(data, root, path) {
|
|
779
|
+
if (data == null || typeof data == "undefined") {
|
|
780
|
+
warn("data does not contain recommended value", data, pattern, path);
|
|
781
|
+
return false;
|
|
782
|
+
} else {
|
|
783
|
+
return fails(data, pattern, root, path);
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
function oneOf(...patterns) {
|
|
788
|
+
return function _oneOf(data, root, path) {
|
|
789
|
+
for (let pattern of patterns) {
|
|
790
|
+
if (!fails(data, pattern, root, path)) {
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return error("data does not match oneOf patterns", data, patterns, path);
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function anyOf(...patterns) {
|
|
798
|
+
return function _anyOf(data, root, path) {
|
|
799
|
+
if (!Array.isArray(data)) {
|
|
800
|
+
return error("data is not an array", data, "anyOf", path);
|
|
801
|
+
}
|
|
802
|
+
for (let value of data) {
|
|
803
|
+
if (oneOf(...patterns)(value)) {
|
|
804
|
+
return error("data does not match anyOf patterns", value, patterns, path);
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return false;
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
function allOf(...patterns) {
|
|
811
|
+
return function _allOf(data, root, path) {
|
|
812
|
+
let problems = [];
|
|
813
|
+
for (let pattern of patterns) {
|
|
814
|
+
problems = problems.concat(fails(data, pattern, root, path));
|
|
815
|
+
}
|
|
816
|
+
problems = problems.filter(Boolean);
|
|
817
|
+
if (problems.length) {
|
|
818
|
+
return error("data does not match all given patterns", data, patterns, path, problems);
|
|
819
|
+
}
|
|
820
|
+
};
|
|
821
|
+
}
|
|
771
822
|
function validURL(data, root, path) {
|
|
772
823
|
try {
|
|
773
824
|
if (data instanceof URL) {
|
|
@@ -783,6 +834,25 @@
|
|
|
783
834
|
return error("data is not a valid url", data, "validURL", path);
|
|
784
835
|
}
|
|
785
836
|
}
|
|
837
|
+
function validEmail(data, root, path) {
|
|
838
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data)) {
|
|
839
|
+
return error("data is not a valid email", data, "validEmail", path);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
function instanceOf(constructor) {
|
|
843
|
+
return function _instanceOf(data, root, path) {
|
|
844
|
+
if (!(data instanceof constructor)) {
|
|
845
|
+
return error("data is not an instanceof pattern", data, constructor, path);
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
function not(pattern) {
|
|
850
|
+
return function _not(data, root, path) {
|
|
851
|
+
if (!fails(data, pattern, root, path)) {
|
|
852
|
+
return error("data matches pattern, when required not to", data, pattern, path);
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
}
|
|
786
856
|
function fails(data, pattern, root, path = "") {
|
|
787
857
|
if (!root) {
|
|
788
858
|
root = data;
|
|
@@ -885,6 +955,27 @@
|
|
|
885
955
|
}
|
|
886
956
|
return result;
|
|
887
957
|
}
|
|
958
|
+
function warn(message, data, pattern, path) {
|
|
959
|
+
console.warn("\u{1F170}\uFE0F Assert: " + path, message, pattern, data);
|
|
960
|
+
}
|
|
961
|
+
globalThis.assert = {
|
|
962
|
+
warn,
|
|
963
|
+
error,
|
|
964
|
+
assert,
|
|
965
|
+
enable,
|
|
966
|
+
disable,
|
|
967
|
+
Required,
|
|
968
|
+
Recommended,
|
|
969
|
+
Optional,
|
|
970
|
+
oneOf,
|
|
971
|
+
anyOf,
|
|
972
|
+
allOf,
|
|
973
|
+
validURL,
|
|
974
|
+
validEmail,
|
|
975
|
+
instanceOf,
|
|
976
|
+
not,
|
|
977
|
+
fails
|
|
978
|
+
};
|
|
888
979
|
|
|
889
980
|
// node_modules/@muze-nl/metro-oauth2/src/tokenstore.mjs
|
|
890
981
|
function tokenStore(site) {
|
|
@@ -1035,20 +1126,20 @@
|
|
|
1035
1126
|
function getTokensFromLocation() {
|
|
1036
1127
|
if (typeof window !== "undefined" && window?.location) {
|
|
1037
1128
|
let url2 = url(window.location);
|
|
1038
|
-
let code, state,
|
|
1129
|
+
let code, state, params;
|
|
1039
1130
|
if (url2.searchParams.has("code")) {
|
|
1040
|
-
|
|
1131
|
+
params = url2.searchParams;
|
|
1041
1132
|
url2 = url2.with({ search: "" });
|
|
1042
1133
|
history.pushState({}, "", url2.href);
|
|
1043
1134
|
} else if (url2.hash) {
|
|
1044
1135
|
let query = url2.hash.substr(1);
|
|
1045
|
-
|
|
1136
|
+
params = new URLSearchParams("?" + query);
|
|
1046
1137
|
url2 = url2.with({ hash: "" });
|
|
1047
1138
|
history.pushState({}, "", url2.href);
|
|
1048
1139
|
}
|
|
1049
|
-
if (
|
|
1050
|
-
code =
|
|
1051
|
-
state =
|
|
1140
|
+
if (params) {
|
|
1141
|
+
code = params.get("code");
|
|
1142
|
+
state = params.get("state");
|
|
1052
1143
|
let storedState = options.state.get("metro/state");
|
|
1053
1144
|
if (!state || state !== storedState) {
|
|
1054
1145
|
return;
|
|
@@ -1076,7 +1167,7 @@
|
|
|
1076
1167
|
let response2 = await options.client.post(tokenReq);
|
|
1077
1168
|
if (!response2.ok) {
|
|
1078
1169
|
let msg = await response2.text();
|
|
1079
|
-
throw metroError("OAuth2mw: fetch access_token: " + response2.status + ": " + response2.statusText, { cause: tokenReq });
|
|
1170
|
+
throw metroError("OAuth2mw: fetch access_token: " + response2.status + ": " + response2.statusText + " (" + msg + ")", { cause: tokenReq });
|
|
1080
1171
|
}
|
|
1081
1172
|
let data = await response2.json();
|
|
1082
1173
|
options.tokens.set("access_token", {
|
|
@@ -1167,36 +1258,35 @@
|
|
|
1167
1258
|
throw metroError("oauth2mw: Missing options.endpoints.token url");
|
|
1168
1259
|
}
|
|
1169
1260
|
let url2 = url(oauth2.token_endpoint, { hash: "" });
|
|
1170
|
-
let
|
|
1261
|
+
let params = {
|
|
1171
1262
|
grant_type: grant_type || oauth2.grant_type,
|
|
1172
1263
|
client_id: oauth2.client_id
|
|
1173
1264
|
};
|
|
1174
1265
|
if (oauth2.client_secret) {
|
|
1175
|
-
|
|
1266
|
+
params.client_secret = oauth2.client_secret;
|
|
1176
1267
|
}
|
|
1177
1268
|
if (oauth2.scope) {
|
|
1178
|
-
|
|
1269
|
+
params.scope = oauth2.scope;
|
|
1179
1270
|
}
|
|
1180
|
-
switch (
|
|
1271
|
+
switch (params.grant_type) {
|
|
1181
1272
|
case "authorization_code":
|
|
1182
|
-
|
|
1183
|
-
|
|
1273
|
+
params.redirect_uri = oauth2.redirect_uri;
|
|
1274
|
+
params.code = options.tokens.get("authorization_code");
|
|
1184
1275
|
const code_verifier = options.tokens.get("code_verifier");
|
|
1185
1276
|
if (code_verifier) {
|
|
1186
|
-
|
|
1277
|
+
params.code_verifier = code_verifier;
|
|
1187
1278
|
}
|
|
1188
1279
|
break;
|
|
1189
1280
|
case "client_credentials":
|
|
1190
1281
|
break;
|
|
1191
1282
|
case "refresh_token":
|
|
1192
|
-
|
|
1193
|
-
params2.refresh_token = refreshToken.value;
|
|
1283
|
+
params.refresh_token = options.tokens.get("refresh_token");
|
|
1194
1284
|
break;
|
|
1195
1285
|
default:
|
|
1196
1286
|
throw new Error("Unknown grant_type: ".oauth2.grant_type);
|
|
1197
1287
|
break;
|
|
1198
1288
|
}
|
|
1199
|
-
return request(url2, { method: "POST", body: new URLSearchParams(
|
|
1289
|
+
return request(url2, { method: "POST", body: new URLSearchParams(params) });
|
|
1200
1290
|
}
|
|
1201
1291
|
}
|
|
1202
1292
|
function isExpired(token) {
|
|
@@ -1248,7 +1338,7 @@
|
|
|
1248
1338
|
if (!url2.searchParams.has("code")) {
|
|
1249
1339
|
if (url2.hash) {
|
|
1250
1340
|
let query = url2.hash.substr(1);
|
|
1251
|
-
params = new URLSearchParams("?" + query);
|
|
1341
|
+
const params = new URLSearchParams("?" + query);
|
|
1252
1342
|
if (params.has("code")) {
|
|
1253
1343
|
return true;
|
|
1254
1344
|
}
|
|
@@ -1349,35 +1439,44 @@
|
|
|
1349
1439
|
const signature = b64u(await crypto.subtle.sign(subtleAlgorithm(key), key, buf(input)));
|
|
1350
1440
|
return `${input}.${signature}`;
|
|
1351
1441
|
}
|
|
1352
|
-
var
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
input
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1442
|
+
var encodeBase64Url;
|
|
1443
|
+
if (Uint8Array.prototype.toBase64) {
|
|
1444
|
+
encodeBase64Url = (input) => {
|
|
1445
|
+
if (input instanceof ArrayBuffer) {
|
|
1446
|
+
input = new Uint8Array(input);
|
|
1447
|
+
}
|
|
1448
|
+
return input.toBase64({ alphabet: "base64url", omitPadding: true });
|
|
1449
|
+
};
|
|
1450
|
+
} else {
|
|
1451
|
+
const CHUNK_SIZE = 32768;
|
|
1452
|
+
encodeBase64Url = (input) => {
|
|
1453
|
+
if (input instanceof ArrayBuffer) {
|
|
1454
|
+
input = new Uint8Array(input);
|
|
1455
|
+
}
|
|
1456
|
+
const arr = [];
|
|
1457
|
+
for (let i = 0; i < input.byteLength; i += CHUNK_SIZE) {
|
|
1458
|
+
arr.push(String.fromCharCode.apply(null, input.subarray(i, i + CHUNK_SIZE)));
|
|
1459
|
+
}
|
|
1460
|
+
return btoa(arr.join("")).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
1461
|
+
};
|
|
1362
1462
|
}
|
|
1363
1463
|
function b64u(input) {
|
|
1364
1464
|
return encodeBase64Url(input);
|
|
1365
1465
|
}
|
|
1366
|
-
function randomBytes() {
|
|
1367
|
-
return b64u(crypto.getRandomValues(new Uint8Array(32)));
|
|
1368
|
-
}
|
|
1369
1466
|
var UnsupportedOperationError = class extends Error {
|
|
1370
1467
|
constructor(message) {
|
|
1371
|
-
|
|
1468
|
+
var _a;
|
|
1469
|
+
super(message !== null && message !== void 0 ? message : "operation not supported");
|
|
1372
1470
|
this.name = this.constructor.name;
|
|
1373
|
-
Error.captureStackTrace
|
|
1471
|
+
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
|
1374
1472
|
}
|
|
1375
1473
|
};
|
|
1376
1474
|
var OperationProcessingError = class extends Error {
|
|
1377
1475
|
constructor(message) {
|
|
1476
|
+
var _a;
|
|
1378
1477
|
super(message);
|
|
1379
1478
|
this.name = this.constructor.name;
|
|
1380
|
-
Error.captureStackTrace
|
|
1479
|
+
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
|
1381
1480
|
}
|
|
1382
1481
|
};
|
|
1383
1482
|
function psAlg(key) {
|
|
@@ -1413,7 +1512,7 @@
|
|
|
1413
1512
|
case "ECDSA":
|
|
1414
1513
|
return esAlg(key);
|
|
1415
1514
|
case "Ed25519":
|
|
1416
|
-
return "
|
|
1515
|
+
return "Ed25519";
|
|
1417
1516
|
default:
|
|
1418
1517
|
throw new UnsupportedOperationError("unsupported CryptoKey algorithm name");
|
|
1419
1518
|
}
|
|
@@ -1430,9 +1529,9 @@
|
|
|
1430
1529
|
function epochTime() {
|
|
1431
1530
|
return Math.floor(Date.now() / 1e3);
|
|
1432
1531
|
}
|
|
1433
|
-
async function
|
|
1434
|
-
const privateKey = keypair
|
|
1435
|
-
const publicKey = keypair
|
|
1532
|
+
async function generateProof(keypair, htu, htm, nonce, accessToken, additional) {
|
|
1533
|
+
const privateKey = keypair === null || keypair === void 0 ? void 0 : keypair.privateKey;
|
|
1534
|
+
const publicKey = keypair === null || keypair === void 0 ? void 0 : keypair.publicKey;
|
|
1436
1535
|
if (!isPrivateKey(privateKey)) {
|
|
1437
1536
|
throw new TypeError('"keypair.privateKey" must be a private CryptoKey');
|
|
1438
1537
|
}
|
|
@@ -1461,21 +1560,21 @@
|
|
|
1461
1560
|
alg: determineJWSAlgorithm(privateKey),
|
|
1462
1561
|
typ: "dpop+jwt",
|
|
1463
1562
|
jwk: await publicJwk(publicKey)
|
|
1464
|
-
}, {
|
|
1465
|
-
...additional,
|
|
1563
|
+
}, Object.assign(Object.assign({}, additional), {
|
|
1466
1564
|
iat: epochTime(),
|
|
1467
|
-
jti:
|
|
1565
|
+
jti: crypto.randomUUID(),
|
|
1468
1566
|
htm,
|
|
1469
1567
|
nonce,
|
|
1470
1568
|
htu,
|
|
1471
1569
|
ath: accessToken ? b64u(await crypto.subtle.digest("SHA-256", buf(accessToken))) : void 0
|
|
1472
|
-
}, privateKey);
|
|
1570
|
+
}), privateKey);
|
|
1473
1571
|
}
|
|
1474
1572
|
async function publicJwk(key) {
|
|
1475
1573
|
const { kty, e, n, x, y, crv } = await crypto.subtle.exportKey("jwk", key);
|
|
1476
1574
|
return { kty, crv, e, n, x, y };
|
|
1477
1575
|
}
|
|
1478
1576
|
async function generateKeyPair(alg, options) {
|
|
1577
|
+
var _a;
|
|
1479
1578
|
let algorithm;
|
|
1480
1579
|
if (typeof alg !== "string" || alg.length === 0) {
|
|
1481
1580
|
throw new TypeError('"alg" must be a non-empty string');
|
|
@@ -1485,7 +1584,7 @@
|
|
|
1485
1584
|
algorithm = {
|
|
1486
1585
|
name: "RSA-PSS",
|
|
1487
1586
|
hash: "SHA-256",
|
|
1488
|
-
modulusLength:
|
|
1587
|
+
modulusLength: 2048,
|
|
1489
1588
|
publicExponent: new Uint8Array([1, 0, 1])
|
|
1490
1589
|
};
|
|
1491
1590
|
break;
|
|
@@ -1493,20 +1592,20 @@
|
|
|
1493
1592
|
algorithm = {
|
|
1494
1593
|
name: "RSASSA-PKCS1-v1_5",
|
|
1495
1594
|
hash: "SHA-256",
|
|
1496
|
-
modulusLength:
|
|
1595
|
+
modulusLength: 2048,
|
|
1497
1596
|
publicExponent: new Uint8Array([1, 0, 1])
|
|
1498
1597
|
};
|
|
1499
1598
|
break;
|
|
1500
1599
|
case "ES256":
|
|
1501
1600
|
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
1502
1601
|
break;
|
|
1503
|
-
case "
|
|
1602
|
+
case "Ed25519":
|
|
1504
1603
|
algorithm = { name: "Ed25519" };
|
|
1505
1604
|
break;
|
|
1506
1605
|
default:
|
|
1507
1606
|
throw new UnsupportedOperationError();
|
|
1508
1607
|
}
|
|
1509
|
-
return crypto.subtle.generateKey(algorithm, options
|
|
1608
|
+
return crypto.subtle.generateKey(algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, ["sign", "verify"]);
|
|
1510
1609
|
}
|
|
1511
1610
|
|
|
1512
1611
|
// node_modules/@muze-nl/metro-oauth2/src/oauth2.dpop.mjs
|
|
@@ -1528,14 +1627,14 @@
|
|
|
1528
1627
|
}
|
|
1529
1628
|
const url2 = everything_default.url(req.url);
|
|
1530
1629
|
if (req.url.startsWith(options.authorization_endpoint)) {
|
|
1531
|
-
let
|
|
1532
|
-
if (
|
|
1533
|
-
|
|
1630
|
+
let params = req.body;
|
|
1631
|
+
if (params instanceof URLSearchParams || params instanceof FormData) {
|
|
1632
|
+
params.set("dpop_jkt", keyInfo.keyPair.publicKey);
|
|
1534
1633
|
} else {
|
|
1535
|
-
|
|
1634
|
+
params.dpop_jkt = keyInfo.keyPair.publicKey;
|
|
1536
1635
|
}
|
|
1537
1636
|
} else if (req.url.startsWith(options.token_endpoint)) {
|
|
1538
|
-
const dpopHeader = await
|
|
1637
|
+
const dpopHeader = await generateProof(keyInfo.keyPair, req.url, req.method);
|
|
1539
1638
|
req = req.with({
|
|
1540
1639
|
headers: {
|
|
1541
1640
|
"DPoP": dpopHeader
|
|
@@ -1544,7 +1643,7 @@
|
|
|
1544
1643
|
} else if (req.headers.has("Authorization")) {
|
|
1545
1644
|
const nonce = localStorage.getItem(url2.host + ":nonce") || void 0;
|
|
1546
1645
|
const accessToken = req.headers.get("Authorization").split(" ")[1];
|
|
1547
|
-
const dpopHeader = await
|
|
1646
|
+
const dpopHeader = await generateProof(keyInfo.keyPair, req.url, req.method, nonce, accessToken);
|
|
1548
1647
|
req = req.with({
|
|
1549
1648
|
headers: {
|
|
1550
1649
|
"Authorization": "DPoP " + accessToken,
|
|
@@ -1560,258 +1659,18 @@
|
|
|
1560
1659
|
};
|
|
1561
1660
|
}
|
|
1562
1661
|
|
|
1563
|
-
// node_modules/@muze-nl/assert/src/assert.mjs
|
|
1564
|
-
globalThis.assertEnabled = false;
|
|
1565
|
-
function enable() {
|
|
1566
|
-
globalThis.assertEnabled = true;
|
|
1567
|
-
}
|
|
1568
|
-
function disable() {
|
|
1569
|
-
globalThis.assertEnabled = false;
|
|
1570
|
-
}
|
|
1571
|
-
function assert2(source, test) {
|
|
1572
|
-
if (globalThis.assertEnabled) {
|
|
1573
|
-
let problems = fails2(source, test);
|
|
1574
|
-
if (problems) {
|
|
1575
|
-
console.error("\u{1F170}\uFE0F Assertions failed because of:", problems, "in this source:", source);
|
|
1576
|
-
throw new Error("Assertions failed", {
|
|
1577
|
-
cause: { problems, source }
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
function Optional2(pattern) {
|
|
1583
|
-
return function _Optional(data, root, path) {
|
|
1584
|
-
if (typeof data != "undefined" && data != null && typeof pattern != "undefined") {
|
|
1585
|
-
return fails2(data, pattern, root, path);
|
|
1586
|
-
}
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
function Required2(pattern) {
|
|
1590
|
-
return function _Required(data, root, path) {
|
|
1591
|
-
if (data == null || typeof data == "undefined") {
|
|
1592
|
-
return error2("data is required", data, pattern || "any value", path);
|
|
1593
|
-
} else if (typeof pattern != "undefined") {
|
|
1594
|
-
return fails2(data, pattern, root, path);
|
|
1595
|
-
} else {
|
|
1596
|
-
return false;
|
|
1597
|
-
}
|
|
1598
|
-
};
|
|
1599
|
-
}
|
|
1600
|
-
function Recommended(pattern) {
|
|
1601
|
-
return function _Recommended(data, root, path) {
|
|
1602
|
-
if (data == null || typeof data == "undefined") {
|
|
1603
|
-
warn("data does not contain recommended value", data, pattern, path);
|
|
1604
|
-
return false;
|
|
1605
|
-
} else {
|
|
1606
|
-
return fails2(data, pattern, root, path);
|
|
1607
|
-
}
|
|
1608
|
-
};
|
|
1609
|
-
}
|
|
1610
|
-
function oneOf(...patterns) {
|
|
1611
|
-
return function _oneOf(data, root, path) {
|
|
1612
|
-
for (let pattern of patterns) {
|
|
1613
|
-
if (!fails2(data, pattern, root, path)) {
|
|
1614
|
-
return false;
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
return error2("data does not match oneOf patterns", data, patterns, path);
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
function anyOf(...patterns) {
|
|
1621
|
-
return function _anyOf(data, root, path) {
|
|
1622
|
-
if (!Array.isArray(data)) {
|
|
1623
|
-
return error2("data is not an array", data, "anyOf", path);
|
|
1624
|
-
}
|
|
1625
|
-
for (let value of data) {
|
|
1626
|
-
if (oneOf(...patterns)(value)) {
|
|
1627
|
-
return error2("data does not match anyOf patterns", value, patterns, path);
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
return false;
|
|
1631
|
-
};
|
|
1632
|
-
}
|
|
1633
|
-
function allOf(...patterns) {
|
|
1634
|
-
return function _allOf(data, root, path) {
|
|
1635
|
-
let problems = [];
|
|
1636
|
-
for (let pattern of patterns) {
|
|
1637
|
-
problems = problems.concat(fails2(data, pattern, root, path));
|
|
1638
|
-
}
|
|
1639
|
-
problems = problems.filter(Boolean);
|
|
1640
|
-
if (problems.length) {
|
|
1641
|
-
return error2("data does not match all given patterns", data, patterns, path, problems);
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
}
|
|
1645
|
-
function validURL2(data, root, path) {
|
|
1646
|
-
try {
|
|
1647
|
-
if (data instanceof URL) {
|
|
1648
|
-
data = data.href;
|
|
1649
|
-
}
|
|
1650
|
-
let url2 = new URL(data);
|
|
1651
|
-
if (url2.href != data) {
|
|
1652
|
-
if (!(url2.href + "/" == data || url2.href == data + "/")) {
|
|
1653
|
-
return error2("data is not a valid url", data, "validURL", path);
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
} catch (e) {
|
|
1657
|
-
return error2("data is not a valid url", data, "validURL", path);
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
function validEmail(data, root, path) {
|
|
1661
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data)) {
|
|
1662
|
-
return error2("data is not a valid email", data, "validEmail", path);
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
function instanceOf(constructor) {
|
|
1666
|
-
return function _instanceOf(data, root, path) {
|
|
1667
|
-
if (!(data instanceof constructor)) {
|
|
1668
|
-
return error2("data is not an instanceof pattern", data, constructor, path);
|
|
1669
|
-
}
|
|
1670
|
-
};
|
|
1671
|
-
}
|
|
1672
|
-
function not(pattern) {
|
|
1673
|
-
return function _not(data, root, path) {
|
|
1674
|
-
if (!fails2(data, pattern, root, path)) {
|
|
1675
|
-
return error2("data matches pattern, when required not to", data, pattern, path);
|
|
1676
|
-
}
|
|
1677
|
-
};
|
|
1678
|
-
}
|
|
1679
|
-
function fails2(data, pattern, root, path = "") {
|
|
1680
|
-
if (!root) {
|
|
1681
|
-
root = data;
|
|
1682
|
-
}
|
|
1683
|
-
let problems = [];
|
|
1684
|
-
if (pattern === Boolean) {
|
|
1685
|
-
if (typeof data != "boolean" && !(data instanceof Boolean)) {
|
|
1686
|
-
problems.push(error2("data is not a boolean", data, pattern, path));
|
|
1687
|
-
}
|
|
1688
|
-
} else if (pattern === Number) {
|
|
1689
|
-
if (typeof data != "number" && !(data instanceof Number)) {
|
|
1690
|
-
problems.push(error2("data is not a number", data, pattern, path));
|
|
1691
|
-
}
|
|
1692
|
-
} else if (pattern === String) {
|
|
1693
|
-
if (typeof data != "string" && !(data instanceof String)) {
|
|
1694
|
-
problems.push(error2("data is not a string", data, pattern, path));
|
|
1695
|
-
}
|
|
1696
|
-
if (data == "") {
|
|
1697
|
-
problems.push(error2("data is an empty string, which is not allowed", data, pattern, path));
|
|
1698
|
-
}
|
|
1699
|
-
} else if (pattern instanceof RegExp) {
|
|
1700
|
-
if (Array.isArray(data)) {
|
|
1701
|
-
let index = data.findIndex((element, index2) => fails2(element, pattern, root, path + "[" + index2 + "]"));
|
|
1702
|
-
if (index > -1) {
|
|
1703
|
-
problems.push(error2("data[" + index + "] does not match pattern", data[index], pattern, path + "[" + index + "]"));
|
|
1704
|
-
}
|
|
1705
|
-
} else if (typeof data == "undefined") {
|
|
1706
|
-
problems.push(error2("data is undefined, should match pattern", data, pattern, path));
|
|
1707
|
-
} else if (!pattern.test(data)) {
|
|
1708
|
-
problems.push(error2("data does not match pattern", data, pattern, path));
|
|
1709
|
-
}
|
|
1710
|
-
} else if (pattern instanceof Function) {
|
|
1711
|
-
let problem = pattern(data, root, path);
|
|
1712
|
-
if (problem) {
|
|
1713
|
-
if (Array.isArray(problem)) {
|
|
1714
|
-
problems = problems.concat(problem);
|
|
1715
|
-
} else {
|
|
1716
|
-
problems.push(problem);
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
} else if (Array.isArray(pattern)) {
|
|
1720
|
-
if (!Array.isArray(data)) {
|
|
1721
|
-
problems.push(error2("data is not an array", data, [], path));
|
|
1722
|
-
}
|
|
1723
|
-
for (let p of pattern) {
|
|
1724
|
-
for (let index of data.keys()) {
|
|
1725
|
-
let problem = fails2(data[index], p, root, path + "[" + index + "]");
|
|
1726
|
-
if (Array.isArray(problem)) {
|
|
1727
|
-
problems = problems.concat(problem);
|
|
1728
|
-
} else if (problem) {
|
|
1729
|
-
problems.push(problem);
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
}
|
|
1733
|
-
} else if (pattern && typeof pattern == "object") {
|
|
1734
|
-
if (Array.isArray(data)) {
|
|
1735
|
-
let index = data.findIndex((element, index2) => fails2(element, pattern, root, path + "[" + index2 + "]"));
|
|
1736
|
-
if (index > -1) {
|
|
1737
|
-
problems.push(error2("data[" + index + "] does not match pattern", data[index], pattern, path + "[" + index + "]"));
|
|
1738
|
-
}
|
|
1739
|
-
} else if (!data || typeof data != "object") {
|
|
1740
|
-
problems.push(error2("data is not an object, pattern is", data, pattern, path));
|
|
1741
|
-
} else {
|
|
1742
|
-
if (data instanceof URLSearchParams) {
|
|
1743
|
-
data = Object.fromEntries(data);
|
|
1744
|
-
}
|
|
1745
|
-
if (pattern instanceof Function) {
|
|
1746
|
-
let result = fails2(data, pattern, root, path);
|
|
1747
|
-
if (result) {
|
|
1748
|
-
problems = problems.concat(result);
|
|
1749
|
-
}
|
|
1750
|
-
} else {
|
|
1751
|
-
for (const [patternKey, subpattern] of Object.entries(pattern)) {
|
|
1752
|
-
let result = fails2(data[patternKey], subpattern, root, path + "." + patternKey);
|
|
1753
|
-
if (result) {
|
|
1754
|
-
problems = problems.concat(result);
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
} else {
|
|
1760
|
-
if (pattern != data) {
|
|
1761
|
-
problems.push(error2("data and pattern are not equal", data, pattern, path));
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
if (problems.length) {
|
|
1765
|
-
return problems;
|
|
1766
|
-
}
|
|
1767
|
-
return false;
|
|
1768
|
-
}
|
|
1769
|
-
function error2(message, found, expected, path, problems) {
|
|
1770
|
-
let result = {
|
|
1771
|
-
path,
|
|
1772
|
-
message,
|
|
1773
|
-
found,
|
|
1774
|
-
expected
|
|
1775
|
-
};
|
|
1776
|
-
if (problems) {
|
|
1777
|
-
result.problems = problems;
|
|
1778
|
-
}
|
|
1779
|
-
return result;
|
|
1780
|
-
}
|
|
1781
|
-
function warn(message, data, pattern, path) {
|
|
1782
|
-
console.warn("\u{1F170}\uFE0F Assert: " + path, message, pattern, data);
|
|
1783
|
-
}
|
|
1784
|
-
globalThis.assert = {
|
|
1785
|
-
warn,
|
|
1786
|
-
error: error2,
|
|
1787
|
-
assert: assert2,
|
|
1788
|
-
enable,
|
|
1789
|
-
disable,
|
|
1790
|
-
Required: Required2,
|
|
1791
|
-
Recommended,
|
|
1792
|
-
Optional: Optional2,
|
|
1793
|
-
oneOf,
|
|
1794
|
-
anyOf,
|
|
1795
|
-
allOf,
|
|
1796
|
-
validURL: validURL2,
|
|
1797
|
-
validEmail,
|
|
1798
|
-
instanceOf,
|
|
1799
|
-
not,
|
|
1800
|
-
fails: fails2
|
|
1801
|
-
};
|
|
1802
|
-
|
|
1803
1662
|
// src/oidc.util.mjs
|
|
1804
1663
|
var MustHave = (...options) => (value, root) => {
|
|
1805
1664
|
if (options.filter((o) => root.hasOwnKey(o)).length > 0) {
|
|
1806
1665
|
return false;
|
|
1807
1666
|
}
|
|
1808
|
-
return
|
|
1667
|
+
return error("root data must have all of", root, options);
|
|
1809
1668
|
};
|
|
1810
1669
|
var MustInclude = (...options) => (value) => {
|
|
1811
1670
|
if (Array.isArray(value) && options.filter((o) => !value.includes(o)).length == 0) {
|
|
1812
1671
|
return false;
|
|
1813
1672
|
} else {
|
|
1814
|
-
return
|
|
1673
|
+
return error("data must be an array which includes", value, options);
|
|
1815
1674
|
}
|
|
1816
1675
|
};
|
|
1817
1676
|
var validJWA = [
|
|
@@ -1834,9 +1693,9 @@
|
|
|
1834
1693
|
|
|
1835
1694
|
// src/oidc.discovery.mjs
|
|
1836
1695
|
async function oidcDiscovery(options = {}) {
|
|
1837
|
-
|
|
1838
|
-
client:
|
|
1839
|
-
issuer:
|
|
1696
|
+
assert(options, {
|
|
1697
|
+
client: Optional(instanceOf(everything_default.client().constructor)),
|
|
1698
|
+
issuer: Required(validURL)
|
|
1840
1699
|
});
|
|
1841
1700
|
const defaultOptions = {
|
|
1842
1701
|
client: everything_default.client().with(throwermw()).with(jsonmw()),
|
|
@@ -1848,42 +1707,42 @@
|
|
|
1848
1707
|
return TestSucceeded;
|
|
1849
1708
|
}
|
|
1850
1709
|
const openid_provider_metadata = {
|
|
1851
|
-
issuer:
|
|
1852
|
-
authorization_endpoint:
|
|
1853
|
-
token_endpoint:
|
|
1854
|
-
userinfo_endpoint: Recommended(
|
|
1710
|
+
issuer: Required(allOf(options.issuer, MustUseHTTPS)),
|
|
1711
|
+
authorization_endpoint: Required(validURL),
|
|
1712
|
+
token_endpoint: Required(validURL),
|
|
1713
|
+
userinfo_endpoint: Recommended(validURL),
|
|
1855
1714
|
// todo: test for https protocol
|
|
1856
|
-
jwks_uri:
|
|
1857
|
-
registration_endpoint: options.requireDynamicRegistration ?
|
|
1715
|
+
jwks_uri: Required(validURL),
|
|
1716
|
+
registration_endpoint: options.requireDynamicRegistration ? Required(validURL) : Recommended(validURL),
|
|
1858
1717
|
scopes_supported: Recommended(MustInclude("openid")),
|
|
1859
|
-
response_types_supported: options.requireDynamicRegistration ?
|
|
1860
|
-
response_modes_supported:
|
|
1861
|
-
grant_types_supported: options.requireDynamicRegistration ?
|
|
1862
|
-
acr_values_supported:
|
|
1863
|
-
subject_types_supported:
|
|
1864
|
-
id_token_signing_alg_values_supported:
|
|
1865
|
-
id_token_encryption_alg_values_supported:
|
|
1866
|
-
id_token_encryption_enc_values_supported:
|
|
1867
|
-
userinfo_signing_alg_values_supported:
|
|
1868
|
-
userinfo_encryption_alg_values_supported:
|
|
1869
|
-
userinfo_encryption_enc_values_supported:
|
|
1870
|
-
request_object_signing_alg_values_supported:
|
|
1718
|
+
response_types_supported: options.requireDynamicRegistration ? Required(MustInclude("code", "id_token", "id_token token")) : Required([]),
|
|
1719
|
+
response_modes_supported: Optional([]),
|
|
1720
|
+
grant_types_supported: options.requireDynamicRegistration ? Optional(MustInclude("authorization_code")) : Optional([]),
|
|
1721
|
+
acr_values_supported: Optional([]),
|
|
1722
|
+
subject_types_supported: Required([]),
|
|
1723
|
+
id_token_signing_alg_values_supported: Required(MustInclude("RS256")),
|
|
1724
|
+
id_token_encryption_alg_values_supported: Optional([]),
|
|
1725
|
+
id_token_encryption_enc_values_supported: Optional([]),
|
|
1726
|
+
userinfo_signing_alg_values_supported: Optional([]),
|
|
1727
|
+
userinfo_encryption_alg_values_supported: Optional([]),
|
|
1728
|
+
userinfo_encryption_enc_values_supported: Optional([]),
|
|
1729
|
+
request_object_signing_alg_values_supported: Optional(MustInclude("RS256")),
|
|
1871
1730
|
// not testing for 'none'
|
|
1872
|
-
request_object_encryption_alg_values_supported:
|
|
1873
|
-
request_object_encryption_enc_values_supported:
|
|
1874
|
-
token_endpoint_auth_methods_supported:
|
|
1875
|
-
token_endpoint_auth_signing_alg_values_supported:
|
|
1876
|
-
display_values_supported:
|
|
1877
|
-
claim_types_supported:
|
|
1731
|
+
request_object_encryption_alg_values_supported: Optional([]),
|
|
1732
|
+
request_object_encryption_enc_values_supported: Optional([]),
|
|
1733
|
+
token_endpoint_auth_methods_supported: Optional(anyOf(...validAuthMethods)),
|
|
1734
|
+
token_endpoint_auth_signing_alg_values_supported: Optional(MustInclude("RS256"), not(MustInclude("none"))),
|
|
1735
|
+
display_values_supported: Optional(anyOf("page", "popup", "touch", "wap")),
|
|
1736
|
+
claim_types_supported: Optional(anyOf("normal", "aggregated", "distributed")),
|
|
1878
1737
|
claims_supported: Recommended([]),
|
|
1879
|
-
service_documentation:
|
|
1880
|
-
claims_locales_supported:
|
|
1881
|
-
ui_locales_supported:
|
|
1882
|
-
claims_parameter_supported:
|
|
1883
|
-
request_parameter_supported:
|
|
1884
|
-
request_uri_parameter_supported:
|
|
1885
|
-
op_policy_uri:
|
|
1886
|
-
op_tos_uri:
|
|
1738
|
+
service_documentation: Optional(validURL),
|
|
1739
|
+
claims_locales_supported: Optional([]),
|
|
1740
|
+
ui_locales_supported: Optional([]),
|
|
1741
|
+
claims_parameter_supported: Optional(Boolean),
|
|
1742
|
+
request_parameter_supported: Optional(Boolean),
|
|
1743
|
+
request_uri_parameter_supported: Optional(Boolean),
|
|
1744
|
+
op_policy_uri: Optional(validURL),
|
|
1745
|
+
op_tos_uri: Optional(validURL)
|
|
1887
1746
|
};
|
|
1888
1747
|
const configURL = everything_default.url(options.issuer, ".well-known/openid-configuration");
|
|
1889
1748
|
const response2 = await options.client.get(
|
|
@@ -1892,49 +1751,49 @@
|
|
|
1892
1751
|
configURL
|
|
1893
1752
|
);
|
|
1894
1753
|
const openid_config = response2.data;
|
|
1895
|
-
|
|
1896
|
-
|
|
1754
|
+
assert(openid_config, openid_provider_metadata);
|
|
1755
|
+
assert(openid_config.issuer, options.issuer);
|
|
1897
1756
|
return openid_config;
|
|
1898
1757
|
}
|
|
1899
1758
|
|
|
1900
1759
|
// src/oidc.register.mjs
|
|
1901
1760
|
async function register(options) {
|
|
1902
1761
|
const openid_client_metadata = {
|
|
1903
|
-
redirect_uris:
|
|
1904
|
-
response_types:
|
|
1905
|
-
grant_types:
|
|
1762
|
+
redirect_uris: Required([validURL]),
|
|
1763
|
+
response_types: Optional([]),
|
|
1764
|
+
grant_types: Optional(anyOf("authorization_code", "refresh_token")),
|
|
1906
1765
|
//TODO: match response_types with grant_types
|
|
1907
|
-
application_type:
|
|
1908
|
-
contacts:
|
|
1909
|
-
client_name:
|
|
1910
|
-
logo_uri:
|
|
1911
|
-
client_uri:
|
|
1912
|
-
policy_uri:
|
|
1913
|
-
tos_uri:
|
|
1914
|
-
jwks_uri:
|
|
1915
|
-
jwks:
|
|
1916
|
-
sector_identifier_uri:
|
|
1917
|
-
subject_type:
|
|
1918
|
-
id_token_signed_response_alg:
|
|
1919
|
-
id_token_encrypted_response_alg:
|
|
1920
|
-
id_token_encrypted_response_enc:
|
|
1921
|
-
userinfo_signed_response_alg:
|
|
1922
|
-
userinfo_encrypted_response_alg:
|
|
1923
|
-
userinfo_encrypted_response_enc:
|
|
1924
|
-
request_object_signing_alg:
|
|
1925
|
-
request_object_encryption_alg:
|
|
1926
|
-
request_object_encryption_enc:
|
|
1927
|
-
token_endpoint_auth_method:
|
|
1928
|
-
token_endpoint_auth_signing_alg:
|
|
1929
|
-
default_max_age:
|
|
1930
|
-
require_auth_time:
|
|
1931
|
-
default_acr_values:
|
|
1932
|
-
initiate_login_uri:
|
|
1933
|
-
request_uris:
|
|
1766
|
+
application_type: Optional(oneOf("native", "web")),
|
|
1767
|
+
contacts: Optional([validEmail]),
|
|
1768
|
+
client_name: Optional(String),
|
|
1769
|
+
logo_uri: Optional(validURL),
|
|
1770
|
+
client_uri: Optional(validURL),
|
|
1771
|
+
policy_uri: Optional(validURL),
|
|
1772
|
+
tos_uri: Optional(validURL),
|
|
1773
|
+
jwks_uri: Optional(validURL, not(MustHave("jwks"))),
|
|
1774
|
+
jwks: Optional(validURL, not(MustHave("jwks_uri"))),
|
|
1775
|
+
sector_identifier_uri: Optional(validURL),
|
|
1776
|
+
subject_type: Optional(String),
|
|
1777
|
+
id_token_signed_response_alg: Optional(oneOf(...validJWA)),
|
|
1778
|
+
id_token_encrypted_response_alg: Optional(oneOf(...validJWA)),
|
|
1779
|
+
id_token_encrypted_response_enc: Optional(oneOf(...validJWA), MustHave("id_token_encrypted_response_alg")),
|
|
1780
|
+
userinfo_signed_response_alg: Optional(oneOf(...validJWA)),
|
|
1781
|
+
userinfo_encrypted_response_alg: Optional(oneOf(...validJWA)),
|
|
1782
|
+
userinfo_encrypted_response_enc: Optional(oneOf(...validJWA), MustHave("userinfo_encrypted_response_alg")),
|
|
1783
|
+
request_object_signing_alg: Optional(oneOf(...validJWA)),
|
|
1784
|
+
request_object_encryption_alg: Optional(oneOf(...validJWA)),
|
|
1785
|
+
request_object_encryption_enc: Optional(oneOf(...validJWA)),
|
|
1786
|
+
token_endpoint_auth_method: Optional(oneOf(...validAuthMethods)),
|
|
1787
|
+
token_endpoint_auth_signing_alg: Optional(oneOf(...validJWA)),
|
|
1788
|
+
default_max_age: Optional(Number),
|
|
1789
|
+
require_auth_time: Optional(Boolean),
|
|
1790
|
+
default_acr_values: Optional([String]),
|
|
1791
|
+
initiate_login_uri: Optional([validURL]),
|
|
1792
|
+
request_uris: Optional([validURL])
|
|
1934
1793
|
};
|
|
1935
|
-
|
|
1936
|
-
client:
|
|
1937
|
-
registration_endpoint:
|
|
1794
|
+
assert(options, {
|
|
1795
|
+
client: Optional(instanceOf(everything_default.client().constructor)),
|
|
1796
|
+
registration_endpoint: validURL,
|
|
1938
1797
|
client_info: openid_client_metadata
|
|
1939
1798
|
});
|
|
1940
1799
|
const defaultOptions = {
|
|
@@ -1995,13 +1854,13 @@
|
|
|
1995
1854
|
}
|
|
1996
1855
|
};
|
|
1997
1856
|
options = Object.assign({}, defaultOptions, options);
|
|
1998
|
-
|
|
1999
|
-
client:
|
|
1857
|
+
assert(options, {
|
|
1858
|
+
client: Required(instanceOf(client().constructor)),
|
|
2000
1859
|
// required because it is set in defaultOptions
|
|
2001
|
-
client_info:
|
|
2002
|
-
issuer:
|
|
2003
|
-
oauth2:
|
|
2004
|
-
openid_configuration:
|
|
1860
|
+
client_info: Required(),
|
|
1861
|
+
issuer: Required(validURL),
|
|
1862
|
+
oauth2: Optional({}),
|
|
1863
|
+
openid_configuration: Optional()
|
|
2005
1864
|
});
|
|
2006
1865
|
if (!options.store) {
|
|
2007
1866
|
options.store = oidcStore(options.issuer);
|