@muze-nl/metro-oidc 0.5.4 → 0.5.5
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 +465 -209
- 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 +4 -4
package/dist/browser.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
var Client = class _Client {
|
|
29
29
|
clientOptions = {
|
|
30
|
-
url: typeof window != "undefined" ? window.location : "https://localhost",
|
|
30
|
+
url: typeof window != "undefined" ? url(window.location) : url("https://localhost"),
|
|
31
31
|
verbs: ["get", "post", "put", "delete", "patch", "head", "options", "query"]
|
|
32
32
|
};
|
|
33
33
|
static tracers = {};
|
|
@@ -44,13 +44,17 @@
|
|
|
44
44
|
constructor(...options) {
|
|
45
45
|
for (let option of options) {
|
|
46
46
|
if (typeof option == "string" || option instanceof String) {
|
|
47
|
-
this.clientOptions.url =
|
|
47
|
+
this.clientOptions.url = url(this.clientOptions.url.href, option);
|
|
48
|
+
} else if (option instanceof _Client) {
|
|
49
|
+
Object.assign(this.clientOptions, option.clientOptions);
|
|
48
50
|
} else if (option instanceof Function) {
|
|
49
51
|
this.#addMiddlewares([option]);
|
|
50
52
|
} else if (option && typeof option == "object") {
|
|
51
53
|
for (let param in option) {
|
|
52
54
|
if (param == "middlewares") {
|
|
53
55
|
this.#addMiddlewares(option[param]);
|
|
56
|
+
} else if (param == "url") {
|
|
57
|
+
this.clientOptions.url = url(this.clientOptions.url.href, option[param]);
|
|
54
58
|
} else if (typeof option[param] == "function") {
|
|
55
59
|
this.clientOptions[param] = option[param](this.clientOptions[param], this.clientOptions);
|
|
56
60
|
} else {
|
|
@@ -135,6 +139,9 @@
|
|
|
135
139
|
with(...options) {
|
|
136
140
|
return new _Client(deepClone(this.clientOptions), ...options);
|
|
137
141
|
}
|
|
142
|
+
get location() {
|
|
143
|
+
return this.clientOptions.url;
|
|
144
|
+
}
|
|
138
145
|
};
|
|
139
146
|
function client(...options) {
|
|
140
147
|
return new Client(...deepClone(options));
|
|
@@ -192,7 +199,7 @@
|
|
|
192
199
|
}
|
|
193
200
|
function request(...options) {
|
|
194
201
|
let requestParams = {
|
|
195
|
-
url: typeof window != "undefined" ? window.location : "https://localhost/",
|
|
202
|
+
url: typeof window != "undefined" ? url(window.location) : url("https://localhost/"),
|
|
196
203
|
duplex: "half"
|
|
197
204
|
// required when setting body to ReadableStream, just set it here by default already
|
|
198
205
|
};
|
|
@@ -208,7 +215,7 @@
|
|
|
208
215
|
let r = new Request(requestParams.url, requestParams);
|
|
209
216
|
let data = requestParams.body;
|
|
210
217
|
if (data) {
|
|
211
|
-
if (typeof data == "object" && !(data instanceof String) && !(data instanceof ReadableStream) && !(data instanceof Blob) && !(data instanceof ArrayBuffer) && !(data instanceof DataView) && !(data instanceof FormData) && !(data instanceof URLSearchParams) && (typeof TypedArray == "undefined" || !(data instanceof TypedArray))) {
|
|
218
|
+
if (typeof data == "object" && !(data instanceof String) && !(data instanceof ReadableStream) && !(data instanceof Blob) && !(data instanceof ArrayBuffer) && !(data instanceof DataView) && !(data instanceof FormData) && !(data instanceof URLSearchParams) && (typeof globalThis.TypedArray == "undefined" || !(data instanceof globalThis.TypedArray))) {
|
|
212
219
|
if (typeof data.toString == "function") {
|
|
213
220
|
requestParams.body = data.toString({ headers: r.headers });
|
|
214
221
|
r = new Request(requestParams.url, requestParams);
|
|
@@ -217,16 +224,17 @@
|
|
|
217
224
|
}
|
|
218
225
|
Object.freeze(r);
|
|
219
226
|
return new Proxy(r, {
|
|
220
|
-
get(target, prop
|
|
227
|
+
get(target, prop) {
|
|
228
|
+
let result;
|
|
221
229
|
switch (prop) {
|
|
222
230
|
case Symbol.metroSource:
|
|
223
|
-
|
|
231
|
+
result = target;
|
|
224
232
|
break;
|
|
225
233
|
case Symbol.metroProxy:
|
|
226
|
-
|
|
234
|
+
result = true;
|
|
227
235
|
break;
|
|
228
236
|
case "with":
|
|
229
|
-
|
|
237
|
+
result = function(...options2) {
|
|
230
238
|
if (data) {
|
|
231
239
|
options2.unshift({ body: data });
|
|
232
240
|
}
|
|
@@ -234,15 +242,19 @@
|
|
|
234
242
|
};
|
|
235
243
|
break;
|
|
236
244
|
case "data":
|
|
237
|
-
|
|
245
|
+
result = data;
|
|
246
|
+
break;
|
|
247
|
+
default:
|
|
248
|
+
if (target[prop] instanceof Function) {
|
|
249
|
+
if (prop === "clone") {
|
|
250
|
+
}
|
|
251
|
+
result = target[prop].bind(target);
|
|
252
|
+
} else {
|
|
253
|
+
result = target[prop];
|
|
254
|
+
}
|
|
238
255
|
break;
|
|
239
256
|
}
|
|
240
|
-
|
|
241
|
-
if (prop === "clone") {
|
|
242
|
-
}
|
|
243
|
-
return target[prop].bind(target);
|
|
244
|
-
}
|
|
245
|
-
return target[prop];
|
|
257
|
+
return result;
|
|
246
258
|
}
|
|
247
259
|
});
|
|
248
260
|
}
|
|
@@ -282,7 +294,7 @@
|
|
|
282
294
|
} else if (option instanceof Response) {
|
|
283
295
|
Object.assign(responseParams, getResponseParams(option, responseParams));
|
|
284
296
|
} else if (option && typeof option == "object") {
|
|
285
|
-
if (option instanceof FormData || option instanceof Blob || option instanceof ArrayBuffer || option instanceof DataView || option instanceof ReadableStream || option instanceof URLSearchParams || option instanceof String || typeof TypedArray != "undefined" && option instanceof TypedArray) {
|
|
297
|
+
if (option instanceof FormData || option instanceof Blob || option instanceof ArrayBuffer || option instanceof DataView || option instanceof ReadableStream || option instanceof URLSearchParams || option instanceof String || typeof globalThis.TypedArray != "undefined" && option instanceof globalThis.TypedArray) {
|
|
286
298
|
responseParams.body = option;
|
|
287
299
|
} else {
|
|
288
300
|
Object.assign(responseParams, getResponseParams(option, responseParams));
|
|
@@ -299,30 +311,35 @@
|
|
|
299
311
|
let r = new Response(responseParams.body, responseParams);
|
|
300
312
|
Object.freeze(r);
|
|
301
313
|
return new Proxy(r, {
|
|
302
|
-
get(target, prop
|
|
314
|
+
get(target, prop) {
|
|
315
|
+
let result;
|
|
303
316
|
switch (prop) {
|
|
304
317
|
case Symbol.metroProxy:
|
|
305
|
-
|
|
318
|
+
result = true;
|
|
306
319
|
break;
|
|
307
320
|
case Symbol.metroSource:
|
|
308
|
-
|
|
321
|
+
result = target;
|
|
309
322
|
break;
|
|
310
323
|
case "with":
|
|
311
|
-
|
|
324
|
+
result = function(...options2) {
|
|
312
325
|
return response(target, ...options2);
|
|
313
326
|
};
|
|
314
327
|
break;
|
|
315
328
|
case "data":
|
|
316
|
-
|
|
329
|
+
result = data;
|
|
317
330
|
break;
|
|
318
331
|
case "ok":
|
|
319
|
-
|
|
332
|
+
result = target.status >= 200 && target.status < 400;
|
|
333
|
+
break;
|
|
334
|
+
default:
|
|
335
|
+
if (typeof target[prop] == "function") {
|
|
336
|
+
result = target[prop].bind(target);
|
|
337
|
+
} else {
|
|
338
|
+
result = target[prop];
|
|
339
|
+
}
|
|
320
340
|
break;
|
|
321
341
|
}
|
|
322
|
-
|
|
323
|
-
return target[prop].bind(target);
|
|
324
|
-
}
|
|
325
|
-
return target[prop];
|
|
342
|
+
return result;
|
|
326
343
|
}
|
|
327
344
|
});
|
|
328
345
|
}
|
|
@@ -393,25 +410,25 @@
|
|
|
393
410
|
}
|
|
394
411
|
Object.freeze(u);
|
|
395
412
|
return new Proxy(u, {
|
|
396
|
-
get(target, prop
|
|
413
|
+
get(target, prop) {
|
|
397
414
|
let result;
|
|
398
415
|
switch (prop) {
|
|
399
416
|
case Symbol.metroProxy:
|
|
400
|
-
|
|
417
|
+
result = true;
|
|
401
418
|
break;
|
|
402
419
|
case Symbol.metroSource:
|
|
403
|
-
|
|
420
|
+
result = target;
|
|
404
421
|
break;
|
|
405
422
|
case "with":
|
|
406
|
-
|
|
423
|
+
result = function(...options2) {
|
|
407
424
|
return url(target, ...options2);
|
|
408
425
|
};
|
|
409
426
|
break;
|
|
410
427
|
case "filename":
|
|
411
|
-
|
|
428
|
+
result = target.pathname.split("/").pop();
|
|
412
429
|
break;
|
|
413
430
|
case "folderpath":
|
|
414
|
-
|
|
431
|
+
result = target.pathname.substring(0, target.pathname.lastIndexOf("\\") + 1);
|
|
415
432
|
break;
|
|
416
433
|
case "authority":
|
|
417
434
|
result = target.username ?? "";
|
|
@@ -421,28 +438,31 @@
|
|
|
421
438
|
result += target.port ? ":" + target.port : "";
|
|
422
439
|
result += "/";
|
|
423
440
|
result = target.protocol + "//" + result;
|
|
424
|
-
return result;
|
|
425
441
|
break;
|
|
426
442
|
case "origin":
|
|
427
443
|
result = target.protocol + "//" + target.hostname;
|
|
428
444
|
result += target.port ? ":" + target.port : "";
|
|
429
445
|
result += "/";
|
|
430
|
-
return result;
|
|
431
446
|
break;
|
|
432
447
|
case "fragment":
|
|
433
|
-
|
|
448
|
+
result = target.hash.substring(1);
|
|
434
449
|
break;
|
|
435
450
|
case "scheme":
|
|
436
451
|
if (target.protocol) {
|
|
437
|
-
|
|
452
|
+
result = target.protocol.substring(0, target.protocol.length - 1);
|
|
453
|
+
} else {
|
|
454
|
+
result = "";
|
|
455
|
+
}
|
|
456
|
+
break;
|
|
457
|
+
default:
|
|
458
|
+
if (target[prop] instanceof Function) {
|
|
459
|
+
result = target[prop].bind(target);
|
|
460
|
+
} else {
|
|
461
|
+
result = target[prop];
|
|
438
462
|
}
|
|
439
|
-
return "";
|
|
440
463
|
break;
|
|
441
464
|
}
|
|
442
|
-
|
|
443
|
-
return target[prop].bind(target);
|
|
444
|
-
}
|
|
445
|
-
return target[prop];
|
|
465
|
+
return result;
|
|
446
466
|
}
|
|
447
467
|
});
|
|
448
468
|
}
|
|
@@ -472,27 +492,32 @@
|
|
|
472
492
|
}
|
|
473
493
|
Object.freeze(params2);
|
|
474
494
|
return new Proxy(params2, {
|
|
475
|
-
get
|
|
495
|
+
get(target, prop) {
|
|
496
|
+
let result;
|
|
476
497
|
switch (prop) {
|
|
477
498
|
case Symbol.metroProxy:
|
|
478
|
-
|
|
499
|
+
result = true;
|
|
479
500
|
break;
|
|
480
501
|
case Symbol.metroSource:
|
|
481
|
-
|
|
502
|
+
result = target;
|
|
482
503
|
break;
|
|
483
504
|
//TODO: add toString() that can check
|
|
484
505
|
//headers param: toString({headers:request.headers})
|
|
485
506
|
//for the content-type
|
|
486
507
|
case "with":
|
|
487
|
-
|
|
508
|
+
result = function(...options2) {
|
|
488
509
|
return formdata(target, ...options2);
|
|
489
510
|
};
|
|
490
511
|
break;
|
|
512
|
+
default:
|
|
513
|
+
if (target[prop] instanceof Function) {
|
|
514
|
+
result = target[prop].bind(target);
|
|
515
|
+
} else {
|
|
516
|
+
result = target[prop];
|
|
517
|
+
}
|
|
518
|
+
break;
|
|
491
519
|
}
|
|
492
|
-
|
|
493
|
-
return target[prop].bind(target);
|
|
494
|
-
}
|
|
495
|
-
return target[prop];
|
|
520
|
+
return result;
|
|
496
521
|
}
|
|
497
522
|
});
|
|
498
523
|
}
|
|
@@ -578,35 +603,38 @@
|
|
|
578
603
|
// node_modules/@muze-nl/metro/src/mw/json.mjs
|
|
579
604
|
function jsonmw(options) {
|
|
580
605
|
options = Object.assign({
|
|
581
|
-
|
|
606
|
+
contentType: "application/json",
|
|
582
607
|
reviver: null,
|
|
583
608
|
replacer: null,
|
|
584
609
|
space: ""
|
|
585
610
|
}, options);
|
|
586
611
|
return async function json(req, next) {
|
|
587
|
-
if (!
|
|
612
|
+
if (!req.headers.get("Accept")) {
|
|
588
613
|
req = req.with({
|
|
589
614
|
headers: {
|
|
590
|
-
"Accept": options.
|
|
615
|
+
"Accept": options.accept ?? options.contentType
|
|
591
616
|
}
|
|
592
617
|
});
|
|
593
618
|
}
|
|
594
|
-
if (
|
|
619
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
595
620
|
if (req.data && typeof req.data == "object" && !(req.data instanceof ReadableStream)) {
|
|
596
|
-
|
|
621
|
+
const contentType = req.headers.get("Content-Type");
|
|
622
|
+
if (!contentType || isPlainText(contentType)) {
|
|
597
623
|
req = req.with({
|
|
598
624
|
headers: {
|
|
599
|
-
"Content-Type": options.
|
|
625
|
+
"Content-Type": options.contentType
|
|
600
626
|
}
|
|
601
627
|
});
|
|
602
628
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
629
|
+
if (isJSON(req.headers.get("Content-Type"))) {
|
|
630
|
+
req = req.with({
|
|
631
|
+
body: JSON.stringify(req.data, options.replacer, options.space)
|
|
632
|
+
});
|
|
633
|
+
}
|
|
606
634
|
}
|
|
607
635
|
}
|
|
608
636
|
let res = await next(req);
|
|
609
|
-
if (isJSON(res.headers
|
|
637
|
+
if (res && isJSON(res.headers?.get("Content-Type"))) {
|
|
610
638
|
let tempRes = res.clone();
|
|
611
639
|
let body = await tempRes.text();
|
|
612
640
|
try {
|
|
@@ -624,6 +652,9 @@
|
|
|
624
652
|
function isJSON(contentType) {
|
|
625
653
|
return jsonRE.exec(contentType);
|
|
626
654
|
}
|
|
655
|
+
function isPlainText(contentType) {
|
|
656
|
+
return /^text\/plain\b/.exec(contentType);
|
|
657
|
+
}
|
|
627
658
|
|
|
628
659
|
// node_modules/@muze-nl/metro/src/mw/thrower.mjs
|
|
629
660
|
function throwermw(options) {
|
|
@@ -642,19 +673,71 @@
|
|
|
642
673
|
};
|
|
643
674
|
}
|
|
644
675
|
|
|
676
|
+
// node_modules/@muze-nl/metro/src/mw/getdata.mjs
|
|
677
|
+
function getdatamw() {
|
|
678
|
+
return async function getdata(req, next) {
|
|
679
|
+
let res = await next(req);
|
|
680
|
+
if (res.ok && res.data) {
|
|
681
|
+
return res.data;
|
|
682
|
+
}
|
|
683
|
+
return res;
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// node_modules/@muze-nl/metro/src/api.mjs
|
|
688
|
+
var API = class extends Client {
|
|
689
|
+
constructor(base, methods, bind = null) {
|
|
690
|
+
if (base instanceof Client) {
|
|
691
|
+
super(base.clientOptions, throwermw(), getdatamw());
|
|
692
|
+
} else {
|
|
693
|
+
super(base, throwermw(), getdatamw());
|
|
694
|
+
}
|
|
695
|
+
if (!bind) {
|
|
696
|
+
bind = this;
|
|
697
|
+
}
|
|
698
|
+
for (const methodName in methods) {
|
|
699
|
+
if (typeof methods[methodName] == "function") {
|
|
700
|
+
this[methodName] = methods[methodName].bind(bind);
|
|
701
|
+
} else if (methods[methodName] && typeof methods[methodName] == "object") {
|
|
702
|
+
this[methodName] = new this.constructor(base, methods[methodName], bind);
|
|
703
|
+
} else {
|
|
704
|
+
this[methodName] = methods[methodName];
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
var JsonAPI = class extends API {
|
|
710
|
+
constructor(base, methods, bind = null) {
|
|
711
|
+
if (base instanceof Client) {
|
|
712
|
+
super(base.with(jsonmw()), methods, bind);
|
|
713
|
+
} else {
|
|
714
|
+
super(client(base, jsonmw()), methods, bind);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
function api(...options) {
|
|
719
|
+
return new API(...deepClone(options));
|
|
720
|
+
}
|
|
721
|
+
function jsonApi(...options) {
|
|
722
|
+
return new JsonAPI(...deepClone(options));
|
|
723
|
+
}
|
|
724
|
+
|
|
645
725
|
// node_modules/@muze-nl/metro/src/everything.mjs
|
|
646
726
|
var metro = Object.assign({}, metro_exports, {
|
|
647
727
|
mw: {
|
|
648
|
-
jsonmw,
|
|
649
|
-
thrower: throwermw
|
|
650
|
-
|
|
728
|
+
json: jsonmw,
|
|
729
|
+
thrower: throwermw,
|
|
730
|
+
getdata: getdatamw
|
|
731
|
+
},
|
|
732
|
+
api,
|
|
733
|
+
jsonApi
|
|
651
734
|
});
|
|
652
735
|
if (!globalThis.metro) {
|
|
653
736
|
globalThis.metro = metro;
|
|
654
737
|
}
|
|
655
738
|
var everything_default = metro;
|
|
656
739
|
|
|
657
|
-
// node_modules/@muze-nl/assert/src/assert.mjs
|
|
740
|
+
// node_modules/@muze-nl/metro-oauth2/node_modules/@muze-nl/assert/src/assert.mjs
|
|
658
741
|
globalThis.assertEnabled = false;
|
|
659
742
|
function assert(source, test) {
|
|
660
743
|
if (globalThis.assertEnabled) {
|
|
@@ -685,51 +768,6 @@
|
|
|
685
768
|
}
|
|
686
769
|
};
|
|
687
770
|
}
|
|
688
|
-
function Recommended(pattern) {
|
|
689
|
-
return function _Recommended(data, root, path) {
|
|
690
|
-
if (data == null || typeof data == "undefined") {
|
|
691
|
-
warn("data does not contain recommended value", data, pattern, path);
|
|
692
|
-
return false;
|
|
693
|
-
} else {
|
|
694
|
-
return fails(data, pattern, root, path);
|
|
695
|
-
}
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
function oneOf(...patterns) {
|
|
699
|
-
return function _oneOf(data, root, path) {
|
|
700
|
-
for (let pattern of patterns) {
|
|
701
|
-
if (!fails(data, pattern, root, path)) {
|
|
702
|
-
return false;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
return error("data does not match oneOf patterns", data, patterns, path);
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
function anyOf(...patterns) {
|
|
709
|
-
return function _anyOf(data, root, path) {
|
|
710
|
-
if (!Array.isArray(data)) {
|
|
711
|
-
return error("data is not an array", data, "anyOf", path);
|
|
712
|
-
}
|
|
713
|
-
for (let value of data) {
|
|
714
|
-
if (oneOf(...patterns)(value)) {
|
|
715
|
-
return error("data does not match anyOf patterns", value, patterns, path);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
return false;
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
function allOf(...patterns) {
|
|
722
|
-
return function _allOf(data, root, path) {
|
|
723
|
-
let problems = [];
|
|
724
|
-
for (let pattern of patterns) {
|
|
725
|
-
problems = problems.concat(fails(data, pattern, root, path));
|
|
726
|
-
}
|
|
727
|
-
problems = problems.filter(Boolean);
|
|
728
|
-
if (problems.length) {
|
|
729
|
-
return error("data does not match all given patterns", data, patterns, path, problems);
|
|
730
|
-
}
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
771
|
function validURL(data, root, path) {
|
|
734
772
|
try {
|
|
735
773
|
if (data instanceof URL) {
|
|
@@ -745,25 +783,6 @@
|
|
|
745
783
|
return error("data is not a valid url", data, "validURL", path);
|
|
746
784
|
}
|
|
747
785
|
}
|
|
748
|
-
function validEmail(data, root, path) {
|
|
749
|
-
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data)) {
|
|
750
|
-
return error("data is not a valid email", data, "validEmail", path);
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
function instanceOf(constructor) {
|
|
754
|
-
return function _instanceOf(data, root, path) {
|
|
755
|
-
if (!(data instanceof constructor)) {
|
|
756
|
-
return error("data is not an instanceof pattern", data, constructor, path);
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
function not(pattern) {
|
|
761
|
-
return function _not(data, root, path) {
|
|
762
|
-
if (!fails(data, pattern, root, path)) {
|
|
763
|
-
return error("data matches pattern, when required not to", data, pattern, path);
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
786
|
function fails(data, pattern, root, path = "") {
|
|
768
787
|
if (!root) {
|
|
769
788
|
root = data;
|
|
@@ -866,9 +885,6 @@
|
|
|
866
885
|
}
|
|
867
886
|
return result;
|
|
868
887
|
}
|
|
869
|
-
function warn(message, data, pattern, path) {
|
|
870
|
-
console.warn("\u{1F170}\uFE0F Assert: " + path, message, pattern, data);
|
|
871
|
-
}
|
|
872
888
|
|
|
873
889
|
// node_modules/@muze-nl/metro-oauth2/src/tokenstore.mjs
|
|
874
890
|
function tokenStore(site) {
|
|
@@ -962,7 +978,7 @@
|
|
|
962
978
|
return res;
|
|
963
979
|
}
|
|
964
980
|
} catch (err) {
|
|
965
|
-
switch (res
|
|
981
|
+
switch (res?.status) {
|
|
966
982
|
case 400:
|
|
967
983
|
// Oauth2.1 RFC 3.2.4
|
|
968
984
|
case 401:
|
|
@@ -1544,18 +1560,258 @@
|
|
|
1544
1560
|
};
|
|
1545
1561
|
}
|
|
1546
1562
|
|
|
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
|
+
|
|
1547
1803
|
// src/oidc.util.mjs
|
|
1548
1804
|
var MustHave = (...options) => (value, root) => {
|
|
1549
1805
|
if (options.filter((o) => root.hasOwnKey(o)).length > 0) {
|
|
1550
1806
|
return false;
|
|
1551
1807
|
}
|
|
1552
|
-
return
|
|
1808
|
+
return error2("root data must have all of", root, options);
|
|
1553
1809
|
};
|
|
1554
1810
|
var MustInclude = (...options) => (value) => {
|
|
1555
1811
|
if (Array.isArray(value) && options.filter((o) => !value.includes(o)).length == 0) {
|
|
1556
1812
|
return false;
|
|
1557
1813
|
} else {
|
|
1558
|
-
return
|
|
1814
|
+
return error2("data must be an array which includes", value, options);
|
|
1559
1815
|
}
|
|
1560
1816
|
};
|
|
1561
1817
|
var validJWA = [
|
|
@@ -1578,9 +1834,9 @@
|
|
|
1578
1834
|
|
|
1579
1835
|
// src/oidc.discovery.mjs
|
|
1580
1836
|
async function oidcDiscovery(options = {}) {
|
|
1581
|
-
|
|
1582
|
-
client:
|
|
1583
|
-
issuer:
|
|
1837
|
+
assert2(options, {
|
|
1838
|
+
client: Optional2(instanceOf(everything_default.client().constructor)),
|
|
1839
|
+
issuer: Required2(validURL2)
|
|
1584
1840
|
});
|
|
1585
1841
|
const defaultOptions = {
|
|
1586
1842
|
client: everything_default.client().with(throwermw()).with(jsonmw()),
|
|
@@ -1592,42 +1848,42 @@
|
|
|
1592
1848
|
return TestSucceeded;
|
|
1593
1849
|
}
|
|
1594
1850
|
const openid_provider_metadata = {
|
|
1595
|
-
issuer:
|
|
1596
|
-
authorization_endpoint:
|
|
1597
|
-
token_endpoint:
|
|
1598
|
-
userinfo_endpoint: Recommended(
|
|
1851
|
+
issuer: Required2(allOf(options.issuer, MustUseHTTPS)),
|
|
1852
|
+
authorization_endpoint: Required2(validURL2),
|
|
1853
|
+
token_endpoint: Required2(validURL2),
|
|
1854
|
+
userinfo_endpoint: Recommended(validURL2),
|
|
1599
1855
|
// todo: test for https protocol
|
|
1600
|
-
jwks_uri:
|
|
1601
|
-
registration_endpoint: options.requireDynamicRegistration ?
|
|
1856
|
+
jwks_uri: Required2(validURL2),
|
|
1857
|
+
registration_endpoint: options.requireDynamicRegistration ? Required2(validURL2) : Recommended(validURL2),
|
|
1602
1858
|
scopes_supported: Recommended(MustInclude("openid")),
|
|
1603
|
-
response_types_supported: options.requireDynamicRegistration ?
|
|
1604
|
-
response_modes_supported:
|
|
1605
|
-
grant_types_supported: options.requireDynamicRegistration ?
|
|
1606
|
-
acr_values_supported:
|
|
1607
|
-
subject_types_supported:
|
|
1608
|
-
id_token_signing_alg_values_supported:
|
|
1609
|
-
id_token_encryption_alg_values_supported:
|
|
1610
|
-
id_token_encryption_enc_values_supported:
|
|
1611
|
-
userinfo_signing_alg_values_supported:
|
|
1612
|
-
userinfo_encryption_alg_values_supported:
|
|
1613
|
-
userinfo_encryption_enc_values_supported:
|
|
1614
|
-
request_object_signing_alg_values_supported:
|
|
1859
|
+
response_types_supported: options.requireDynamicRegistration ? Required2(MustInclude("code", "id_token", "id_token token")) : Required2([]),
|
|
1860
|
+
response_modes_supported: Optional2([]),
|
|
1861
|
+
grant_types_supported: options.requireDynamicRegistration ? Optional2(MustInclude("authorization_code")) : Optional2([]),
|
|
1862
|
+
acr_values_supported: Optional2([]),
|
|
1863
|
+
subject_types_supported: Required2([]),
|
|
1864
|
+
id_token_signing_alg_values_supported: Required2(MustInclude("RS256")),
|
|
1865
|
+
id_token_encryption_alg_values_supported: Optional2([]),
|
|
1866
|
+
id_token_encryption_enc_values_supported: Optional2([]),
|
|
1867
|
+
userinfo_signing_alg_values_supported: Optional2([]),
|
|
1868
|
+
userinfo_encryption_alg_values_supported: Optional2([]),
|
|
1869
|
+
userinfo_encryption_enc_values_supported: Optional2([]),
|
|
1870
|
+
request_object_signing_alg_values_supported: Optional2(MustInclude("RS256")),
|
|
1615
1871
|
// not testing for 'none'
|
|
1616
|
-
request_object_encryption_alg_values_supported:
|
|
1617
|
-
request_object_encryption_enc_values_supported:
|
|
1618
|
-
token_endpoint_auth_methods_supported:
|
|
1619
|
-
token_endpoint_auth_signing_alg_values_supported:
|
|
1620
|
-
display_values_supported:
|
|
1621
|
-
claim_types_supported:
|
|
1872
|
+
request_object_encryption_alg_values_supported: Optional2([]),
|
|
1873
|
+
request_object_encryption_enc_values_supported: Optional2([]),
|
|
1874
|
+
token_endpoint_auth_methods_supported: Optional2(anyOf(...validAuthMethods)),
|
|
1875
|
+
token_endpoint_auth_signing_alg_values_supported: Optional2(MustInclude("RS256"), not(MustInclude("none"))),
|
|
1876
|
+
display_values_supported: Optional2(anyOf("page", "popup", "touch", "wap")),
|
|
1877
|
+
claim_types_supported: Optional2(anyOf("normal", "aggregated", "distributed")),
|
|
1622
1878
|
claims_supported: Recommended([]),
|
|
1623
|
-
service_documentation:
|
|
1624
|
-
claims_locales_supported:
|
|
1625
|
-
ui_locales_supported:
|
|
1626
|
-
claims_parameter_supported:
|
|
1627
|
-
request_parameter_supported:
|
|
1628
|
-
request_uri_parameter_supported:
|
|
1629
|
-
op_policy_uri:
|
|
1630
|
-
op_tos_uri:
|
|
1879
|
+
service_documentation: Optional2(validURL2),
|
|
1880
|
+
claims_locales_supported: Optional2([]),
|
|
1881
|
+
ui_locales_supported: Optional2([]),
|
|
1882
|
+
claims_parameter_supported: Optional2(Boolean),
|
|
1883
|
+
request_parameter_supported: Optional2(Boolean),
|
|
1884
|
+
request_uri_parameter_supported: Optional2(Boolean),
|
|
1885
|
+
op_policy_uri: Optional2(validURL2),
|
|
1886
|
+
op_tos_uri: Optional2(validURL2)
|
|
1631
1887
|
};
|
|
1632
1888
|
const configURL = everything_default.url(options.issuer, ".well-known/openid-configuration");
|
|
1633
1889
|
const response2 = await options.client.get(
|
|
@@ -1636,49 +1892,49 @@
|
|
|
1636
1892
|
configURL
|
|
1637
1893
|
);
|
|
1638
1894
|
const openid_config = response2.data;
|
|
1639
|
-
|
|
1640
|
-
|
|
1895
|
+
assert2(openid_config, openid_provider_metadata);
|
|
1896
|
+
assert2(openid_config.issuer, options.issuer);
|
|
1641
1897
|
return openid_config;
|
|
1642
1898
|
}
|
|
1643
1899
|
|
|
1644
1900
|
// src/oidc.register.mjs
|
|
1645
1901
|
async function register(options) {
|
|
1646
1902
|
const openid_client_metadata = {
|
|
1647
|
-
redirect_uris:
|
|
1648
|
-
response_types:
|
|
1649
|
-
grant_types:
|
|
1903
|
+
redirect_uris: Required2([validURL2]),
|
|
1904
|
+
response_types: Optional2([]),
|
|
1905
|
+
grant_types: Optional2(anyOf("authorization_code", "refresh_token")),
|
|
1650
1906
|
//TODO: match response_types with grant_types
|
|
1651
|
-
application_type:
|
|
1652
|
-
contacts:
|
|
1653
|
-
client_name:
|
|
1654
|
-
logo_uri:
|
|
1655
|
-
client_uri:
|
|
1656
|
-
policy_uri:
|
|
1657
|
-
tos_uri:
|
|
1658
|
-
jwks_uri:
|
|
1659
|
-
jwks:
|
|
1660
|
-
sector_identifier_uri:
|
|
1661
|
-
subject_type:
|
|
1662
|
-
id_token_signed_response_alg:
|
|
1663
|
-
id_token_encrypted_response_alg:
|
|
1664
|
-
id_token_encrypted_response_enc:
|
|
1665
|
-
userinfo_signed_response_alg:
|
|
1666
|
-
userinfo_encrypted_response_alg:
|
|
1667
|
-
userinfo_encrypted_response_enc:
|
|
1668
|
-
request_object_signing_alg:
|
|
1669
|
-
request_object_encryption_alg:
|
|
1670
|
-
request_object_encryption_enc:
|
|
1671
|
-
token_endpoint_auth_method:
|
|
1672
|
-
token_endpoint_auth_signing_alg:
|
|
1673
|
-
default_max_age:
|
|
1674
|
-
require_auth_time:
|
|
1675
|
-
default_acr_values:
|
|
1676
|
-
initiate_login_uri:
|
|
1677
|
-
request_uris:
|
|
1907
|
+
application_type: Optional2(oneOf("native", "web")),
|
|
1908
|
+
contacts: Optional2([validEmail]),
|
|
1909
|
+
client_name: Optional2(String),
|
|
1910
|
+
logo_uri: Optional2(validURL2),
|
|
1911
|
+
client_uri: Optional2(validURL2),
|
|
1912
|
+
policy_uri: Optional2(validURL2),
|
|
1913
|
+
tos_uri: Optional2(validURL2),
|
|
1914
|
+
jwks_uri: Optional2(validURL2, not(MustHave("jwks"))),
|
|
1915
|
+
jwks: Optional2(validURL2, not(MustHave("jwks_uri"))),
|
|
1916
|
+
sector_identifier_uri: Optional2(validURL2),
|
|
1917
|
+
subject_type: Optional2(String),
|
|
1918
|
+
id_token_signed_response_alg: Optional2(oneOf(...validJWA)),
|
|
1919
|
+
id_token_encrypted_response_alg: Optional2(oneOf(...validJWA)),
|
|
1920
|
+
id_token_encrypted_response_enc: Optional2(oneOf(...validJWA), MustHave("id_token_encrypted_response_alg")),
|
|
1921
|
+
userinfo_signed_response_alg: Optional2(oneOf(...validJWA)),
|
|
1922
|
+
userinfo_encrypted_response_alg: Optional2(oneOf(...validJWA)),
|
|
1923
|
+
userinfo_encrypted_response_enc: Optional2(oneOf(...validJWA), MustHave("userinfo_encrypted_response_alg")),
|
|
1924
|
+
request_object_signing_alg: Optional2(oneOf(...validJWA)),
|
|
1925
|
+
request_object_encryption_alg: Optional2(oneOf(...validJWA)),
|
|
1926
|
+
request_object_encryption_enc: Optional2(oneOf(...validJWA)),
|
|
1927
|
+
token_endpoint_auth_method: Optional2(oneOf(...validAuthMethods)),
|
|
1928
|
+
token_endpoint_auth_signing_alg: Optional2(oneOf(...validJWA)),
|
|
1929
|
+
default_max_age: Optional2(Number),
|
|
1930
|
+
require_auth_time: Optional2(Boolean),
|
|
1931
|
+
default_acr_values: Optional2([String]),
|
|
1932
|
+
initiate_login_uri: Optional2([validURL2]),
|
|
1933
|
+
request_uris: Optional2([validURL2])
|
|
1678
1934
|
};
|
|
1679
|
-
|
|
1680
|
-
client:
|
|
1681
|
-
registration_endpoint:
|
|
1935
|
+
assert2(options, {
|
|
1936
|
+
client: Optional2(instanceOf(everything_default.client().constructor)),
|
|
1937
|
+
registration_endpoint: validURL2,
|
|
1682
1938
|
client_info: openid_client_metadata
|
|
1683
1939
|
});
|
|
1684
1940
|
const defaultOptions = {
|
|
@@ -1739,13 +1995,13 @@
|
|
|
1739
1995
|
}
|
|
1740
1996
|
};
|
|
1741
1997
|
options = Object.assign({}, defaultOptions, options);
|
|
1742
|
-
|
|
1743
|
-
client:
|
|
1998
|
+
assert2(options, {
|
|
1999
|
+
client: Required2(instanceOf(client().constructor)),
|
|
1744
2000
|
// required because it is set in defaultOptions
|
|
1745
|
-
client_info:
|
|
1746
|
-
issuer:
|
|
1747
|
-
oauth2:
|
|
1748
|
-
openid_configuration:
|
|
2001
|
+
client_info: Required2(),
|
|
2002
|
+
issuer: Required2(validURL2),
|
|
2003
|
+
oauth2: Optional2({}),
|
|
2004
|
+
openid_configuration: Optional2()
|
|
1749
2005
|
});
|
|
1750
2006
|
if (!options.store) {
|
|
1751
2007
|
options.store = oidcStore(options.issuer);
|