@muze-nl/metro-oidc 0.3.6 → 0.4.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/dist/browser.js +150 -413
- 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 +5 -4
- package/src/oidcmw.mjs +0 -7
package/dist/browser.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
// node_modules/@muze-nl/metro/src/metro.mjs
|
|
9
9
|
var metro_exports = {};
|
|
10
10
|
__export(metro_exports, {
|
|
11
|
+
Client: () => Client,
|
|
11
12
|
client: () => client,
|
|
13
|
+
deepClone: () => deepClone,
|
|
12
14
|
formdata: () => formdata,
|
|
13
15
|
metroError: () => metroError,
|
|
14
16
|
request: () => request,
|
|
@@ -24,10 +26,10 @@
|
|
|
24
26
|
Symbol.metroSource = Symbol("source");
|
|
25
27
|
}
|
|
26
28
|
var Client = class _Client {
|
|
27
|
-
|
|
28
|
-
url: typeof window != "undefined" ? window.location : "https://localhost"
|
|
29
|
+
clientOptions = {
|
|
30
|
+
url: typeof window != "undefined" ? window.location : "https://localhost",
|
|
31
|
+
verbs: ["get", "post", "put", "delete", "patch", "head", "options", "query"]
|
|
29
32
|
};
|
|
30
|
-
#verbs = ["get", "post", "put", "delete", "patch", "head", "options", "query"];
|
|
31
33
|
static tracers = {};
|
|
32
34
|
/**
|
|
33
35
|
* @typedef {Object} ClientOptions
|
|
@@ -42,9 +44,7 @@
|
|
|
42
44
|
constructor(...options) {
|
|
43
45
|
for (let option of options) {
|
|
44
46
|
if (typeof option == "string" || option instanceof String) {
|
|
45
|
-
this
|
|
46
|
-
} else if (option instanceof _Client) {
|
|
47
|
-
Object.assign(this.#options, option.#options);
|
|
47
|
+
this.clientOptions.url = "" + option;
|
|
48
48
|
} else if (option instanceof Function) {
|
|
49
49
|
this.#addMiddlewares([option]);
|
|
50
50
|
} else if (option && typeof option == "object") {
|
|
@@ -52,27 +52,22 @@
|
|
|
52
52
|
if (param == "middlewares") {
|
|
53
53
|
this.#addMiddlewares(option[param]);
|
|
54
54
|
} else if (typeof option[param] == "function") {
|
|
55
|
-
this
|
|
55
|
+
this.clientOptions[param] = option[param](this.clientOptions[param], this.clientOptions);
|
|
56
56
|
} else {
|
|
57
|
-
this
|
|
57
|
+
this.clientOptions[param] = option[param];
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
this.#verbs = this.#options.verbs;
|
|
64
|
-
delete this.#options.verbs;
|
|
65
|
-
}
|
|
66
|
-
for (const verb of this.#verbs) {
|
|
62
|
+
for (const verb of this.clientOptions.verbs) {
|
|
67
63
|
this[verb] = async function(...options2) {
|
|
68
64
|
return this.fetch(request(
|
|
69
|
-
this
|
|
65
|
+
this.clientOptions,
|
|
70
66
|
...options2,
|
|
71
67
|
{ method: verb.toUpperCase() }
|
|
72
68
|
));
|
|
73
69
|
};
|
|
74
70
|
}
|
|
75
|
-
Object.freeze(this);
|
|
76
71
|
}
|
|
77
72
|
#addMiddlewares(middlewares) {
|
|
78
73
|
if (typeof middlewares == "function") {
|
|
@@ -82,10 +77,10 @@
|
|
|
82
77
|
if (index >= 0) {
|
|
83
78
|
throw metroError("metro.client: middlewares must be a function or an array of functions " + metroURL + "client/invalid-middlewares/", middlewares[index]);
|
|
84
79
|
}
|
|
85
|
-
if (!Array.isArray(this
|
|
86
|
-
this
|
|
80
|
+
if (!Array.isArray(this.clientOptions.middlewares)) {
|
|
81
|
+
this.clientOptions.middlewares = [];
|
|
87
82
|
}
|
|
88
|
-
this
|
|
83
|
+
this.clientOptions.middlewares = this.clientOptions.middlewares.concat(middlewares);
|
|
89
84
|
}
|
|
90
85
|
/**
|
|
91
86
|
* Mimics the standard browser fetch method, but uses any middleware installed through
|
|
@@ -112,8 +107,8 @@
|
|
|
112
107
|
const res = await fetch(req2);
|
|
113
108
|
return response(res);
|
|
114
109
|
};
|
|
115
|
-
let middlewares = [metrofetch].concat(this
|
|
116
|
-
options = Object.assign({}, this
|
|
110
|
+
let middlewares = [metrofetch].concat(this.clientOptions?.middlewares?.slice() || []);
|
|
111
|
+
options = Object.assign({}, this.clientOptions, options);
|
|
117
112
|
let next;
|
|
118
113
|
for (let middleware of middlewares) {
|
|
119
114
|
next = /* @__PURE__ */ function(next2, middleware2) {
|
|
@@ -138,11 +133,11 @@
|
|
|
138
133
|
return next(req);
|
|
139
134
|
}
|
|
140
135
|
with(...options) {
|
|
141
|
-
return new _Client(this, ...options);
|
|
136
|
+
return new _Client(deepClone(this.clientOptions), ...options);
|
|
142
137
|
}
|
|
143
138
|
};
|
|
144
139
|
function client(...options) {
|
|
145
|
-
return new Client(...options);
|
|
140
|
+
return new Client(...deepClone(options));
|
|
146
141
|
}
|
|
147
142
|
function getRequestParams(req, current) {
|
|
148
143
|
let params2 = current || {};
|
|
@@ -399,6 +394,7 @@
|
|
|
399
394
|
Object.freeze(u);
|
|
400
395
|
return new Proxy(u, {
|
|
401
396
|
get(target, prop, receiver) {
|
|
397
|
+
let result;
|
|
402
398
|
switch (prop) {
|
|
403
399
|
case Symbol.metroProxy:
|
|
404
400
|
return true;
|
|
@@ -417,6 +413,31 @@
|
|
|
417
413
|
case "folderpath":
|
|
418
414
|
return target.pathname.substring(0, target.pathname.lastIndexOf("\\") + 1);
|
|
419
415
|
break;
|
|
416
|
+
case "authority":
|
|
417
|
+
result = target.username ?? "";
|
|
418
|
+
result += target.password ? ":" + target.password : "";
|
|
419
|
+
result += result ? "@" : "";
|
|
420
|
+
result += target.hostname;
|
|
421
|
+
result += target.port ? ":" + target.port : "";
|
|
422
|
+
result += "/";
|
|
423
|
+
result = target.protocol + "//" + result;
|
|
424
|
+
return result;
|
|
425
|
+
break;
|
|
426
|
+
case "origin":
|
|
427
|
+
result = target.protocol + "//" + target.hostname;
|
|
428
|
+
result += target.port ? ":" + target.port : "";
|
|
429
|
+
result += "/";
|
|
430
|
+
return result;
|
|
431
|
+
break;
|
|
432
|
+
case "fragment":
|
|
433
|
+
return target.hash.substring(1);
|
|
434
|
+
break;
|
|
435
|
+
case "scheme":
|
|
436
|
+
if (target.protocol) {
|
|
437
|
+
return target.protocol.substring(0, target.protocol.length - 1);
|
|
438
|
+
}
|
|
439
|
+
return "";
|
|
440
|
+
break;
|
|
420
441
|
}
|
|
421
442
|
if (target[prop] instanceof Function) {
|
|
422
443
|
return target[prop].bind(target);
|
|
@@ -536,6 +557,23 @@
|
|
|
536
557
|
};
|
|
537
558
|
}
|
|
538
559
|
};
|
|
560
|
+
function deepClone(object) {
|
|
561
|
+
if (Array.isArray(object)) {
|
|
562
|
+
return object.slice().map(deepClone);
|
|
563
|
+
}
|
|
564
|
+
if (object && typeof object === "object") {
|
|
565
|
+
if (object.__proto__.constructor == Object || !object.__proto__) {
|
|
566
|
+
let result = Object.assign({}, object);
|
|
567
|
+
Object.keys(result).forEach((key) => {
|
|
568
|
+
result[key] = deepClone(object[key]);
|
|
569
|
+
});
|
|
570
|
+
return result;
|
|
571
|
+
} else {
|
|
572
|
+
return object;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return object;
|
|
576
|
+
}
|
|
539
577
|
|
|
540
578
|
// node_modules/@muze-nl/metro/src/mw/json.mjs
|
|
541
579
|
function jsonmw(options) {
|
|
@@ -545,7 +583,7 @@
|
|
|
545
583
|
replacer: null,
|
|
546
584
|
space: ""
|
|
547
585
|
}, options);
|
|
548
|
-
return async (req, next)
|
|
586
|
+
return async function json(req, next) {
|
|
549
587
|
if (!isJSON(req.headers.get("Accept"))) {
|
|
550
588
|
req = req.with({
|
|
551
589
|
headers: {
|
|
@@ -572,9 +610,9 @@
|
|
|
572
610
|
let tempRes = res.clone();
|
|
573
611
|
let body = await tempRes.text();
|
|
574
612
|
try {
|
|
575
|
-
let
|
|
613
|
+
let json2 = JSON.parse(body, options.reviver);
|
|
576
614
|
return res.with({
|
|
577
|
-
body:
|
|
615
|
+
body: json2
|
|
578
616
|
});
|
|
579
617
|
} catch (e) {
|
|
580
618
|
}
|
|
@@ -588,8 +626,8 @@
|
|
|
588
626
|
}
|
|
589
627
|
|
|
590
628
|
// node_modules/@muze-nl/metro/src/mw/thrower.mjs
|
|
591
|
-
function
|
|
592
|
-
return async (req, next)
|
|
629
|
+
function throwermw(options) {
|
|
630
|
+
return async function thrower(req, next) {
|
|
593
631
|
let res = await next(req);
|
|
594
632
|
if (!res.ok) {
|
|
595
633
|
if (options && typeof options[res.status] == "function") {
|
|
@@ -608,7 +646,7 @@
|
|
|
608
646
|
var metro = Object.assign({}, metro_exports, {
|
|
609
647
|
mw: {
|
|
610
648
|
jsonmw,
|
|
611
|
-
thrower
|
|
649
|
+
thrower: throwermw
|
|
612
650
|
}
|
|
613
651
|
});
|
|
614
652
|
if (!globalThis.metro) {
|
|
@@ -616,20 +654,6 @@
|
|
|
616
654
|
}
|
|
617
655
|
var everything_default = metro;
|
|
618
656
|
|
|
619
|
-
// node_modules/@muze-nl/metro-oauth2/src/oauth2.mjs
|
|
620
|
-
var oauth2_exports = {};
|
|
621
|
-
__export(oauth2_exports, {
|
|
622
|
-
base64url_encode: () => base64url_encode,
|
|
623
|
-
createState: () => createState,
|
|
624
|
-
default: () => oauth2mw,
|
|
625
|
-
generateCodeChallenge: () => generateCodeChallenge,
|
|
626
|
-
generateCodeVerifier: () => generateCodeVerifier,
|
|
627
|
-
getExpires: () => getExpires,
|
|
628
|
-
isAuthorized: () => isAuthorized,
|
|
629
|
-
isExpired: () => isExpired,
|
|
630
|
-
isRedirected: () => isRedirected
|
|
631
|
-
});
|
|
632
|
-
|
|
633
657
|
// node_modules/@muze-nl/assert/src/assert.mjs
|
|
634
658
|
globalThis.assertEnabled = false;
|
|
635
659
|
function assert(source, test) {
|
|
@@ -653,7 +677,7 @@
|
|
|
653
677
|
function Required(pattern) {
|
|
654
678
|
return function _Required(data, root, path) {
|
|
655
679
|
if (data == null || typeof data == "undefined") {
|
|
656
|
-
return
|
|
680
|
+
return error("data is required", data, pattern || "any value", path);
|
|
657
681
|
} else if (typeof pattern != "undefined") {
|
|
658
682
|
return fails(data, pattern, root, path);
|
|
659
683
|
} else {
|
|
@@ -664,7 +688,7 @@
|
|
|
664
688
|
function Recommended(pattern) {
|
|
665
689
|
return function _Recommended(data, root, path) {
|
|
666
690
|
if (data == null || typeof data == "undefined") {
|
|
667
|
-
|
|
691
|
+
warn("data does not contain recommended value", data, pattern, path);
|
|
668
692
|
return false;
|
|
669
693
|
} else {
|
|
670
694
|
return fails(data, pattern, root, path);
|
|
@@ -678,17 +702,17 @@
|
|
|
678
702
|
return false;
|
|
679
703
|
}
|
|
680
704
|
}
|
|
681
|
-
return
|
|
705
|
+
return error("data does not match oneOf patterns", data, patterns, path);
|
|
682
706
|
};
|
|
683
707
|
}
|
|
684
708
|
function anyOf(...patterns) {
|
|
685
709
|
return function _anyOf(data, root, path) {
|
|
686
710
|
if (!Array.isArray(data)) {
|
|
687
|
-
return
|
|
711
|
+
return error("data is not an array", data, "anyOf", path);
|
|
688
712
|
}
|
|
689
713
|
for (let value of data) {
|
|
690
714
|
if (oneOf(...patterns)(value)) {
|
|
691
|
-
return
|
|
715
|
+
return error("data does not match anyOf patterns", value, patterns, path);
|
|
692
716
|
}
|
|
693
717
|
}
|
|
694
718
|
return false;
|
|
@@ -702,7 +726,7 @@
|
|
|
702
726
|
}
|
|
703
727
|
problems = problems.filter(Boolean);
|
|
704
728
|
if (problems.length) {
|
|
705
|
-
return
|
|
729
|
+
return error("data does not match all given patterns", data, patterns, path, problems);
|
|
706
730
|
}
|
|
707
731
|
};
|
|
708
732
|
}
|
|
@@ -714,29 +738,29 @@
|
|
|
714
738
|
let url2 = new URL(data);
|
|
715
739
|
if (url2.href != data) {
|
|
716
740
|
if (!(url2.href + "/" == data || url2.href == data + "/")) {
|
|
717
|
-
return
|
|
741
|
+
return error("data is not a valid url", data, "validURL", path);
|
|
718
742
|
}
|
|
719
743
|
}
|
|
720
744
|
} catch (e) {
|
|
721
|
-
return
|
|
745
|
+
return error("data is not a valid url", data, "validURL", path);
|
|
722
746
|
}
|
|
723
747
|
}
|
|
724
748
|
function validEmail(data, root, path) {
|
|
725
749
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data)) {
|
|
726
|
-
return
|
|
750
|
+
return error("data is not a valid email", data, "validEmail", path);
|
|
727
751
|
}
|
|
728
752
|
}
|
|
729
753
|
function instanceOf(constructor) {
|
|
730
754
|
return function _instanceOf(data, root, path) {
|
|
731
755
|
if (!(data instanceof constructor)) {
|
|
732
|
-
return
|
|
756
|
+
return error("data is not an instanceof pattern", data, constructor, path);
|
|
733
757
|
}
|
|
734
758
|
};
|
|
735
759
|
}
|
|
736
760
|
function not(pattern) {
|
|
737
761
|
return function _not(data, root, path) {
|
|
738
762
|
if (!fails(data, pattern, root, path)) {
|
|
739
|
-
return
|
|
763
|
+
return error("data matches pattern, when required not to", data, pattern, path);
|
|
740
764
|
}
|
|
741
765
|
};
|
|
742
766
|
}
|
|
@@ -747,29 +771,29 @@
|
|
|
747
771
|
let problems = [];
|
|
748
772
|
if (pattern === Boolean) {
|
|
749
773
|
if (typeof data != "boolean" && !(data instanceof Boolean)) {
|
|
750
|
-
problems.push(
|
|
774
|
+
problems.push(error("data is not a boolean", data, pattern, path));
|
|
751
775
|
}
|
|
752
776
|
} else if (pattern === Number) {
|
|
753
777
|
if (typeof data != "number" && !(data instanceof Number)) {
|
|
754
|
-
problems.push(
|
|
778
|
+
problems.push(error("data is not a number", data, pattern, path));
|
|
755
779
|
}
|
|
756
780
|
} else if (pattern === String) {
|
|
757
781
|
if (typeof data != "string" && !(data instanceof String)) {
|
|
758
|
-
problems.push(
|
|
782
|
+
problems.push(error("data is not a string", data, pattern, path));
|
|
759
783
|
}
|
|
760
784
|
if (data == "") {
|
|
761
|
-
problems.push(
|
|
785
|
+
problems.push(error("data is an empty string, which is not allowed", data, pattern, path));
|
|
762
786
|
}
|
|
763
787
|
} else if (pattern instanceof RegExp) {
|
|
764
788
|
if (Array.isArray(data)) {
|
|
765
789
|
let index = data.findIndex((element, index2) => fails(element, pattern, root, path + "[" + index2 + "]"));
|
|
766
790
|
if (index > -1) {
|
|
767
|
-
problems.push(
|
|
791
|
+
problems.push(error("data[" + index + "] does not match pattern", data[index], pattern, path + "[" + index + "]"));
|
|
768
792
|
}
|
|
769
793
|
} else if (typeof data == "undefined") {
|
|
770
|
-
problems.push(
|
|
794
|
+
problems.push(error("data is undefined, should match pattern", data, pattern, path));
|
|
771
795
|
} else if (!pattern.test(data)) {
|
|
772
|
-
problems.push(
|
|
796
|
+
problems.push(error("data does not match pattern", data, pattern, path));
|
|
773
797
|
}
|
|
774
798
|
} else if (pattern instanceof Function) {
|
|
775
799
|
let problem = pattern(data, root, path);
|
|
@@ -782,7 +806,7 @@
|
|
|
782
806
|
}
|
|
783
807
|
} else if (Array.isArray(pattern)) {
|
|
784
808
|
if (!Array.isArray(data)) {
|
|
785
|
-
problems.push(
|
|
809
|
+
problems.push(error("data is not an array", data, [], path));
|
|
786
810
|
}
|
|
787
811
|
for (let p of pattern) {
|
|
788
812
|
for (let index of data.keys()) {
|
|
@@ -798,10 +822,10 @@
|
|
|
798
822
|
if (Array.isArray(data)) {
|
|
799
823
|
let index = data.findIndex((element, index2) => fails(element, pattern, root, path + "[" + index2 + "]"));
|
|
800
824
|
if (index > -1) {
|
|
801
|
-
problems.push(
|
|
825
|
+
problems.push(error("data[" + index + "] does not match pattern", data[index], pattern, path + "[" + index + "]"));
|
|
802
826
|
}
|
|
803
827
|
} else if (!data || typeof data != "object") {
|
|
804
|
-
problems.push(
|
|
828
|
+
problems.push(error("data is not an object, pattern is", data, pattern, path));
|
|
805
829
|
} else {
|
|
806
830
|
if (data instanceof URLSearchParams) {
|
|
807
831
|
data = Object.fromEntries(data);
|
|
@@ -812,8 +836,8 @@
|
|
|
812
836
|
problems = problems.concat(result);
|
|
813
837
|
}
|
|
814
838
|
} else {
|
|
815
|
-
for (const [
|
|
816
|
-
let result = fails(data[
|
|
839
|
+
for (const [patternKey, subpattern] of Object.entries(pattern)) {
|
|
840
|
+
let result = fails(data[patternKey], subpattern, root, path + "." + patternKey);
|
|
817
841
|
if (result) {
|
|
818
842
|
problems = problems.concat(result);
|
|
819
843
|
}
|
|
@@ -822,7 +846,7 @@
|
|
|
822
846
|
}
|
|
823
847
|
} else {
|
|
824
848
|
if (pattern != data) {
|
|
825
|
-
problems.push(
|
|
849
|
+
problems.push(error("data and pattern are not equal", data, pattern, path));
|
|
826
850
|
}
|
|
827
851
|
}
|
|
828
852
|
if (problems.length) {
|
|
@@ -830,18 +854,21 @@
|
|
|
830
854
|
}
|
|
831
855
|
return false;
|
|
832
856
|
}
|
|
833
|
-
function
|
|
857
|
+
function error(message, found, expected, path, problems) {
|
|
834
858
|
let result = {
|
|
859
|
+
path,
|
|
835
860
|
message,
|
|
836
861
|
found,
|
|
837
|
-
expected
|
|
838
|
-
path
|
|
862
|
+
expected
|
|
839
863
|
};
|
|
840
864
|
if (problems) {
|
|
841
865
|
result.problems = problems;
|
|
842
866
|
}
|
|
843
867
|
return result;
|
|
844
868
|
}
|
|
869
|
+
function warn(message, data, pattern, path) {
|
|
870
|
+
console.warn("\u{1F170}\uFE0F Assert: " + path, message, pattern, data);
|
|
871
|
+
}
|
|
845
872
|
|
|
846
873
|
// node_modules/@muze-nl/metro-oauth2/src/tokenstore.mjs
|
|
847
874
|
function tokenStore(site) {
|
|
@@ -893,9 +920,9 @@
|
|
|
893
920
|
}
|
|
894
921
|
};
|
|
895
922
|
assert(options, {});
|
|
896
|
-
const
|
|
923
|
+
const oauth2 = Object.assign({}, defaultOptions.oauth2_configuration, options?.oauth2_configuration);
|
|
897
924
|
options = Object.assign({}, defaultOptions, options);
|
|
898
|
-
options.oauth2_configuration =
|
|
925
|
+
options.oauth2_configuration = oauth2;
|
|
899
926
|
const store = tokenStore(options.site);
|
|
900
927
|
if (!options.tokens) {
|
|
901
928
|
options.tokens = store.tokens;
|
|
@@ -912,12 +939,12 @@
|
|
|
912
939
|
redirect_uri: Required(validURL)
|
|
913
940
|
}
|
|
914
941
|
});
|
|
915
|
-
for (let option in
|
|
942
|
+
for (let option in oauth2) {
|
|
916
943
|
switch (option) {
|
|
917
944
|
case "access_token":
|
|
918
945
|
case "authorization_code":
|
|
919
946
|
case "refresh_token":
|
|
920
|
-
options.tokens.set(option,
|
|
947
|
+
options.tokens.set(option, oauth2[option]);
|
|
921
948
|
break;
|
|
922
949
|
}
|
|
923
950
|
}
|
|
@@ -1012,7 +1039,7 @@
|
|
|
1012
1039
|
}
|
|
1013
1040
|
}
|
|
1014
1041
|
async function fetchAccessToken() {
|
|
1015
|
-
if (
|
|
1042
|
+
if (oauth2.grant_type === "authorization_code" && !options.tokens.has("authorization_code")) {
|
|
1016
1043
|
let authReqURL = await getAuthorizationCodeURL();
|
|
1017
1044
|
if (!options.authorize_callback || typeof options.authorize_callback !== "function") {
|
|
1018
1045
|
throw metroError("oauth2mw: oauth2 with grant_type:authorization_code requires a callback function in client options.authorize_callback");
|
|
@@ -1069,11 +1096,11 @@
|
|
|
1069
1096
|
return data;
|
|
1070
1097
|
}
|
|
1071
1098
|
async function getAuthorizationCodeURL() {
|
|
1072
|
-
if (!
|
|
1099
|
+
if (!oauth2.authorization_endpoint) {
|
|
1073
1100
|
throw metroError("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");
|
|
1074
1101
|
}
|
|
1075
|
-
let url2 = url(
|
|
1076
|
-
assert(
|
|
1102
|
+
let url2 = url(oauth2.authorization_endpoint, { hash: "" });
|
|
1103
|
+
assert(oauth2, {
|
|
1077
1104
|
client_id: /.+/,
|
|
1078
1105
|
redirect_uri: /.+/,
|
|
1079
1106
|
scope: /.*/
|
|
@@ -1081,64 +1108,64 @@
|
|
|
1081
1108
|
let search = {
|
|
1082
1109
|
response_type: "code",
|
|
1083
1110
|
// implicit flow uses 'token' here, but is not considered safe, so not supported
|
|
1084
|
-
client_id:
|
|
1085
|
-
redirect_uri:
|
|
1086
|
-
state:
|
|
1111
|
+
client_id: oauth2.client_id,
|
|
1112
|
+
redirect_uri: oauth2.redirect_uri,
|
|
1113
|
+
state: oauth2.state || createState(40)
|
|
1087
1114
|
// OAuth2.1 RFC says optional, but its a good idea to always add/check it
|
|
1088
1115
|
};
|
|
1089
|
-
if (
|
|
1090
|
-
search.response_type =
|
|
1116
|
+
if (oauth2.response_type) {
|
|
1117
|
+
search.response_type = oauth2.response_type;
|
|
1091
1118
|
}
|
|
1092
|
-
if (
|
|
1093
|
-
search.response_mode =
|
|
1119
|
+
if (oauth2.response_mode) {
|
|
1120
|
+
search.response_mode = oauth2.response_mode;
|
|
1094
1121
|
}
|
|
1095
1122
|
options.state.set(search.state);
|
|
1096
|
-
if (
|
|
1097
|
-
|
|
1098
|
-
|
|
1123
|
+
if (oauth2.client_secret) {
|
|
1124
|
+
search.client_secret = oauth2.client_secret;
|
|
1125
|
+
}
|
|
1126
|
+
if (oauth2.code_verifier) {
|
|
1127
|
+
search.code_challenge = await generateCodeChallenge(oauth2.code_verifier);
|
|
1099
1128
|
search.code_challenge_method = "S256";
|
|
1100
|
-
} else if (oauth22.client_secret) {
|
|
1101
|
-
search.client_secret = oauth22.client_secret;
|
|
1102
1129
|
}
|
|
1103
|
-
if (
|
|
1104
|
-
search.scope =
|
|
1130
|
+
if (oauth2.scope) {
|
|
1131
|
+
search.scope = oauth2.scope;
|
|
1105
1132
|
}
|
|
1106
|
-
if (
|
|
1107
|
-
search.prompt =
|
|
1133
|
+
if (oauth2.prompt) {
|
|
1134
|
+
search.prompt = oauth2.prompt;
|
|
1108
1135
|
}
|
|
1109
1136
|
return url(url2, { search });
|
|
1110
1137
|
}
|
|
1111
1138
|
function getAccessTokenRequest(grant_type = null) {
|
|
1112
|
-
assert(
|
|
1139
|
+
assert(oauth2, {
|
|
1113
1140
|
client_id: /.+/,
|
|
1114
1141
|
redirect_uri: /.+/
|
|
1115
1142
|
});
|
|
1116
|
-
if (!
|
|
1143
|
+
if (!oauth2.token_endpoint) {
|
|
1117
1144
|
throw metroError("oauth2mw: Missing options.endpoints.token url");
|
|
1118
1145
|
}
|
|
1119
|
-
let url2 = url(
|
|
1146
|
+
let url2 = url(oauth2.token_endpoint, { hash: "" });
|
|
1120
1147
|
let params2 = {
|
|
1121
|
-
grant_type: grant_type ||
|
|
1122
|
-
client_id:
|
|
1148
|
+
grant_type: grant_type || oauth2.grant_type,
|
|
1149
|
+
client_id: oauth2.client_id
|
|
1123
1150
|
};
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
params2.code_verifier = code_verifier;
|
|
1127
|
-
} else if (oauth22.client_secret) {
|
|
1128
|
-
params2.client_secret = oauth22.client_secret;
|
|
1151
|
+
if (oauth2.code_verifier) {
|
|
1152
|
+
params2.code_verifier = oauth2.code_verifier;
|
|
1129
1153
|
}
|
|
1130
|
-
if (
|
|
1131
|
-
params2.
|
|
1154
|
+
if (oauth2.client_secret) {
|
|
1155
|
+
params2.client_secret = oauth2.client_secret;
|
|
1132
1156
|
}
|
|
1133
|
-
|
|
1157
|
+
if (oauth2.scope) {
|
|
1158
|
+
params2.scope = oauth2.scope;
|
|
1159
|
+
}
|
|
1160
|
+
switch (oauth2.grant_type) {
|
|
1134
1161
|
case "authorization_code":
|
|
1135
|
-
params2.redirect_uri =
|
|
1162
|
+
params2.redirect_uri = oauth2.redirect_uri;
|
|
1136
1163
|
params2.code = options.tokens.get("authorization_code");
|
|
1137
1164
|
break;
|
|
1138
1165
|
case "client_credentials":
|
|
1139
1166
|
break;
|
|
1140
1167
|
case "refresh_token":
|
|
1141
|
-
params2.refresh_token =
|
|
1168
|
+
params2.refresh_token = oauth2.refresh_token;
|
|
1142
1169
|
break;
|
|
1143
1170
|
default:
|
|
1144
1171
|
throw new Error("Unknown grant_type: ".oauth2.grant_type);
|
|
@@ -1167,15 +1194,9 @@
|
|
|
1167
1194
|
throw new TypeError("Unknown expires type " + duration);
|
|
1168
1195
|
}
|
|
1169
1196
|
function generateCodeVerifier(size = 64) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
globalThis.crypto.getRandomValues(random);
|
|
1174
|
-
const code_verifier = Array.from(random).map((b) => {
|
|
1175
|
-
let c = allowed[b % allowed.length];
|
|
1176
|
-
return c;
|
|
1177
|
-
}).join("");
|
|
1178
|
-
return code_verifier;
|
|
1197
|
+
const code_verifier = new Uint8Array(size);
|
|
1198
|
+
globalThis.crypto.getRandomValues(code_verifier);
|
|
1199
|
+
return base64url_encode(code_verifier);
|
|
1179
1200
|
}
|
|
1180
1201
|
async function generateCodeChallenge(code_verifier) {
|
|
1181
1202
|
const encoder2 = new TextEncoder();
|
|
@@ -1211,280 +1232,17 @@
|
|
|
1211
1232
|
}
|
|
1212
1233
|
return true;
|
|
1213
1234
|
}
|
|
1214
|
-
function isAuthorized(tokens) {
|
|
1215
|
-
if (typeof tokens == "string") {
|
|
1216
|
-
tokens = tokenStore(tokens).tokens;
|
|
1217
|
-
}
|
|
1218
|
-
let accessToken = tokens.get("access_token");
|
|
1219
|
-
if (accessToken && !isExpired(accessToken)) {
|
|
1220
|
-
return true;
|
|
1221
|
-
}
|
|
1222
|
-
let refreshToken = tokens.get("refresh_token");
|
|
1223
|
-
if (refreshToken) {
|
|
1224
|
-
return true;
|
|
1225
|
-
}
|
|
1226
|
-
return false;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
// node_modules/@muze-nl/metro-oauth2/src/oauth2.mockserver.mjs
|
|
1230
|
-
var oauth2_mockserver_exports = {};
|
|
1231
|
-
__export(oauth2_mockserver_exports, {
|
|
1232
|
-
default: () => oauth2mockserver
|
|
1233
|
-
});
|
|
1234
|
-
var baseResponse = {
|
|
1235
|
-
status: 200,
|
|
1236
|
-
statusText: "OK",
|
|
1237
|
-
headers: {
|
|
1238
|
-
"Content-Type": "application/json"
|
|
1239
|
-
}
|
|
1240
|
-
};
|
|
1241
|
-
var badRequest = (error4) => {
|
|
1242
|
-
return {
|
|
1243
|
-
status: 400,
|
|
1244
|
-
statusText: "Bad Request",
|
|
1245
|
-
headers: {
|
|
1246
|
-
"Content-Type": "application/json"
|
|
1247
|
-
},
|
|
1248
|
-
body: JSON.stringify({
|
|
1249
|
-
error: "invalid_request",
|
|
1250
|
-
error_description: error4
|
|
1251
|
-
})
|
|
1252
|
-
};
|
|
1253
|
-
};
|
|
1254
|
-
var error3;
|
|
1255
|
-
var pkce = {};
|
|
1256
|
-
function oauth2mockserver(options = {}) {
|
|
1257
|
-
const defaultOptions = {
|
|
1258
|
-
"PKCE": false,
|
|
1259
|
-
"DPoP": false
|
|
1260
|
-
};
|
|
1261
|
-
options = Object.assign({}, defaultOptions, options);
|
|
1262
|
-
return async (req, next) => {
|
|
1263
|
-
let url2 = everything_default.url(req.url);
|
|
1264
|
-
switch (url2.pathname) {
|
|
1265
|
-
case "/authorize/":
|
|
1266
|
-
if (error3 = fails(url2.searchParams, {
|
|
1267
|
-
response_type: "code",
|
|
1268
|
-
client_id: "mockClientId",
|
|
1269
|
-
state: Optional(/.*/)
|
|
1270
|
-
})) {
|
|
1271
|
-
return everything_default.response(badRequest(error3));
|
|
1272
|
-
}
|
|
1273
|
-
if (url2.searchParams.has("code_challenge")) {
|
|
1274
|
-
if (!url2.searchParams.has("code_challenge_method")) {
|
|
1275
|
-
return everything_default.response(badRequest("missing code_challenge_method"));
|
|
1276
|
-
}
|
|
1277
|
-
pkce.code_challenge = url2.searchParams.get("code_challenge");
|
|
1278
|
-
pkce.code_challenge_method = url2.searchParams.get("code_challenge_method");
|
|
1279
|
-
}
|
|
1280
|
-
return everything_default.response(baseResponse, {
|
|
1281
|
-
body: JSON.stringify({
|
|
1282
|
-
code: "mockAuthorizeToken",
|
|
1283
|
-
state: url2.searchParams.get("state")
|
|
1284
|
-
})
|
|
1285
|
-
});
|
|
1286
|
-
break;
|
|
1287
|
-
case "/token/":
|
|
1288
|
-
if (req.data instanceof URLSearchParams) {
|
|
1289
|
-
let body = {};
|
|
1290
|
-
req.data.forEach((value, key) => body[key] = value);
|
|
1291
|
-
req = req.with({ body });
|
|
1292
|
-
}
|
|
1293
|
-
if (error3 = fails(req, {
|
|
1294
|
-
method: "POST",
|
|
1295
|
-
data: {
|
|
1296
|
-
grant_type: oneOf("refresh_token", "authorization_code")
|
|
1297
|
-
}
|
|
1298
|
-
})) {
|
|
1299
|
-
return everything_default.response(badRequest(error3));
|
|
1300
|
-
}
|
|
1301
|
-
switch (req.data.grant_type) {
|
|
1302
|
-
case "refresh_token":
|
|
1303
|
-
if (error3 = fails(req.data, oneOf({
|
|
1304
|
-
refresh_token: "mockRefreshToken",
|
|
1305
|
-
client_id: "mockClientId",
|
|
1306
|
-
client_secret: "mockClientSecret"
|
|
1307
|
-
}, {
|
|
1308
|
-
refresh_token: "mockRefreshToken",
|
|
1309
|
-
client_id: "mockClientId",
|
|
1310
|
-
code_verifier: /.+/
|
|
1311
|
-
}))) {
|
|
1312
|
-
return everything_default.response(badRequest(error3));
|
|
1313
|
-
}
|
|
1314
|
-
break;
|
|
1315
|
-
case "access_token":
|
|
1316
|
-
if (error3 = fails(req.data, oneOf({
|
|
1317
|
-
client_id: "mockClientId",
|
|
1318
|
-
client_secret: "mockClientSecret"
|
|
1319
|
-
}, {
|
|
1320
|
-
client_id: "mockClientId",
|
|
1321
|
-
code_challenge: /.*/,
|
|
1322
|
-
//FIXME: check that this matches code_verifier
|
|
1323
|
-
code_challenge_method: "S256"
|
|
1324
|
-
}))) {
|
|
1325
|
-
return everything_default.response(badRequest(error3));
|
|
1326
|
-
}
|
|
1327
|
-
break;
|
|
1328
|
-
}
|
|
1329
|
-
return everything_default.response(baseResponse, {
|
|
1330
|
-
body: JSON.stringify({
|
|
1331
|
-
access_token: "mockAccessToken",
|
|
1332
|
-
token_type: "mockExample",
|
|
1333
|
-
expires_in: 3600,
|
|
1334
|
-
refresh_token: "mockRefreshToken",
|
|
1335
|
-
example_parameter: "mockExampleValue"
|
|
1336
|
-
})
|
|
1337
|
-
});
|
|
1338
|
-
break;
|
|
1339
|
-
case "/protected/":
|
|
1340
|
-
let auth = req.headers.get("Authorization");
|
|
1341
|
-
let [type, token] = auth ? auth.split(" ") : [];
|
|
1342
|
-
if (!token || token !== "mockAccessToken") {
|
|
1343
|
-
return everything_default.response({
|
|
1344
|
-
status: 401,
|
|
1345
|
-
statusText: "Forbidden",
|
|
1346
|
-
body: "401 Forbidden"
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
return everything_default.response(baseResponse, {
|
|
1350
|
-
body: JSON.stringify({
|
|
1351
|
-
result: "Success"
|
|
1352
|
-
})
|
|
1353
|
-
});
|
|
1354
|
-
break;
|
|
1355
|
-
case "/public/":
|
|
1356
|
-
return everything_default.response(baseResponse, {
|
|
1357
|
-
body: JSON.stringify({
|
|
1358
|
-
result: "Success"
|
|
1359
|
-
})
|
|
1360
|
-
});
|
|
1361
|
-
break;
|
|
1362
|
-
default:
|
|
1363
|
-
return everything_default.response({
|
|
1364
|
-
status: 404,
|
|
1365
|
-
statusText: "not found",
|
|
1366
|
-
body: "404 Not Found " + url2
|
|
1367
|
-
});
|
|
1368
|
-
break;
|
|
1369
|
-
}
|
|
1370
|
-
};
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
// node_modules/@muze-nl/metro-oauth2/src/oauth2.discovery.mjs
|
|
1374
|
-
var oauth2_discovery_exports = {};
|
|
1375
|
-
__export(oauth2_discovery_exports, {
|
|
1376
|
-
default: () => makeClient
|
|
1377
|
-
});
|
|
1378
|
-
var validAlgorithms = [
|
|
1379
|
-
"HS256",
|
|
1380
|
-
"HS384",
|
|
1381
|
-
"HS512",
|
|
1382
|
-
"RS256",
|
|
1383
|
-
"RS384",
|
|
1384
|
-
"RS512",
|
|
1385
|
-
"ES256",
|
|
1386
|
-
"ES384",
|
|
1387
|
-
"ES512"
|
|
1388
|
-
];
|
|
1389
|
-
var validAuthMethods = [
|
|
1390
|
-
"client_secret_post",
|
|
1391
|
-
"client_secret_base",
|
|
1392
|
-
"client_secret_jwt",
|
|
1393
|
-
"private_key_jwt"
|
|
1394
|
-
];
|
|
1395
|
-
var oauth_authorization_server_metadata = {
|
|
1396
|
-
issuer: Required(validURL),
|
|
1397
|
-
authorization_endpoint: Required(validURL),
|
|
1398
|
-
token_endpoint: Required(validURL),
|
|
1399
|
-
jwks_uri: Optional(validURL),
|
|
1400
|
-
registration_endpoint: Optional(validURL),
|
|
1401
|
-
scopes_supported: Recommended([]),
|
|
1402
|
-
response_types_supported: Required(anyOf("code", "token")),
|
|
1403
|
-
response_modes_supported: Optional([]),
|
|
1404
|
-
grant_types_supported: Optional([]),
|
|
1405
|
-
token_endpoint_auth_methods_supported: Optional([]),
|
|
1406
|
-
token_endpoint_auth_signing_alg_values_supported: Optional([]),
|
|
1407
|
-
service_documentation: Optional(validURL),
|
|
1408
|
-
ui_locales_supported: Optional([]),
|
|
1409
|
-
op_policy_uri: Optional(validURL),
|
|
1410
|
-
op_tos_uri: Optional(validURL),
|
|
1411
|
-
revocation_endpoint: Optional(validURL),
|
|
1412
|
-
revocation_endpoint_auth_methods_supported: Optional(validAuthMethods),
|
|
1413
|
-
revocation_endpoint_auth_signing_alg_values_supported: Optional(validAlgorithms),
|
|
1414
|
-
introspection_endpoint: Optional(validURL),
|
|
1415
|
-
introspection_endpoint_auth_methods_supported: Optional(validAuthMethods),
|
|
1416
|
-
introspection_endpoint_auth_signing_alg_values_supported: Optional(validAlgorithms),
|
|
1417
|
-
code_challendge_methods_supported: Optional([])
|
|
1418
|
-
};
|
|
1419
|
-
function makeClient(options = {}) {
|
|
1420
|
-
const defaultOptions = {
|
|
1421
|
-
client: everything_default.client()
|
|
1422
|
-
};
|
|
1423
|
-
options = Object.assign({}, defaultOptions, options);
|
|
1424
|
-
assert(options, {
|
|
1425
|
-
issuer: Required(validURL)
|
|
1426
|
-
});
|
|
1427
|
-
const oauth_authorization_server_configuration = fetchWellknownOauthAuthorizationServer(options.issuer);
|
|
1428
|
-
let client2 = options.client.with(options.issuer);
|
|
1429
|
-
}
|
|
1430
|
-
async function fetchWellknownOauthAuthorizationServer(issuer, client2) {
|
|
1431
|
-
let res = client2.get(everything_default.url(issuer, ".wellknown/oauth_authorization_server"));
|
|
1432
|
-
if (res.ok) {
|
|
1433
|
-
assert(res.headers.get("Content-Type"), /application\/json.*/);
|
|
1434
|
-
let configuration = await res.json();
|
|
1435
|
-
assert(configuration, oauth_authorization_server_metadata);
|
|
1436
|
-
return configuration;
|
|
1437
|
-
}
|
|
1438
|
-
throw everything_default.metroError("metro.oidcmw: Error while fetching " + issuer + ".wellknown/oauth_authorization_server", res);
|
|
1439
|
-
}
|
|
1440
|
-
|
|
1441
|
-
// node_modules/@muze-nl/metro-oauth2/src/oauth2.popup.mjs
|
|
1442
|
-
function handleRedirect() {
|
|
1443
|
-
let params2 = new URLSearchParams(window.location.search);
|
|
1444
|
-
if (!params2.has("code") && window.location.hash) {
|
|
1445
|
-
let query = window.location.hash.substr(1);
|
|
1446
|
-
params2 = new URLSearchParams("?" + query);
|
|
1447
|
-
}
|
|
1448
|
-
let parent = window.parent ? window.parent : window.opener;
|
|
1449
|
-
if (params2.has("code")) {
|
|
1450
|
-
parent.postMessage({
|
|
1451
|
-
authorization_code: params2.get("code")
|
|
1452
|
-
}, window.location.origin);
|
|
1453
|
-
} else if (params2.has("error")) {
|
|
1454
|
-
parent.postMessage({
|
|
1455
|
-
error
|
|
1456
|
-
}, window.location.origin);
|
|
1457
|
-
} else {
|
|
1458
|
-
parent.postMessage({
|
|
1459
|
-
error: "Could not find an authorization_code"
|
|
1460
|
-
}, window.location.origin);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
function authorizePopup(authorizationCodeURL) {
|
|
1464
|
-
return new Promise((resolve, reject) => {
|
|
1465
|
-
addEventListener("message", (evt) => {
|
|
1466
|
-
if (event.data.authorization_code) {
|
|
1467
|
-
resolve(event.data.authorization_code);
|
|
1468
|
-
} else if (event.data.error) {
|
|
1469
|
-
reject(event.data.error);
|
|
1470
|
-
} else {
|
|
1471
|
-
reject("Unknown authorization error");
|
|
1472
|
-
}
|
|
1473
|
-
}, { once: true });
|
|
1474
|
-
window.open(authorizationCodeURL);
|
|
1475
|
-
});
|
|
1476
|
-
}
|
|
1477
1235
|
|
|
1478
1236
|
// node_modules/@muze-nl/metro-oauth2/src/keysstore.mjs
|
|
1479
1237
|
function keysStore() {
|
|
1480
1238
|
return new Promise((resolve, reject) => {
|
|
1481
1239
|
const request2 = globalThis.indexedDB.open("metro", 1);
|
|
1482
1240
|
request2.onupgradeneeded = () => request2.result.createObjectStore("keyPairs", { keyPath: "domain" });
|
|
1483
|
-
request2.onerror = (
|
|
1484
|
-
reject(
|
|
1241
|
+
request2.onerror = (event) => {
|
|
1242
|
+
reject(event);
|
|
1485
1243
|
};
|
|
1486
|
-
request2.onsuccess = (
|
|
1487
|
-
const db =
|
|
1244
|
+
request2.onsuccess = (event) => {
|
|
1245
|
+
const db = event.target.result;
|
|
1488
1246
|
resolve({
|
|
1489
1247
|
set: function(value, key) {
|
|
1490
1248
|
return new Promise((resolve2, reject2) => {
|
|
@@ -1777,33 +1535,18 @@
|
|
|
1777
1535
|
};
|
|
1778
1536
|
}
|
|
1779
1537
|
|
|
1780
|
-
// node_modules/@muze-nl/metro-oauth2/src/browser.mjs
|
|
1781
|
-
var oauth2 = Object.assign({}, oauth2_exports, {
|
|
1782
|
-
oauth2mw,
|
|
1783
|
-
mockserver: oauth2_mockserver_exports,
|
|
1784
|
-
discover: oauth2_discovery_exports,
|
|
1785
|
-
tokenstore: tokenStore,
|
|
1786
|
-
dpopmw,
|
|
1787
|
-
keysstore: keysStore,
|
|
1788
|
-
authorizePopup,
|
|
1789
|
-
popupHandleRedirect: handleRedirect
|
|
1790
|
-
});
|
|
1791
|
-
if (!globalThis.metro.oauth2) {
|
|
1792
|
-
globalThis.metro.oauth2 = oauth2;
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
1538
|
// src/oidc.util.mjs
|
|
1796
1539
|
var MustHave = (...options) => (value, root) => {
|
|
1797
1540
|
if (options.filter((o) => root.hasOwnKey(o)).length > 0) {
|
|
1798
1541
|
return false;
|
|
1799
1542
|
}
|
|
1800
|
-
return
|
|
1543
|
+
return error("root data must have all of", root, options);
|
|
1801
1544
|
};
|
|
1802
1545
|
var MustInclude = (...options) => (value) => {
|
|
1803
1546
|
if (Array.isArray(value) && options.filter((o) => !value.includes(o)).length == 0) {
|
|
1804
1547
|
return false;
|
|
1805
1548
|
} else {
|
|
1806
|
-
return
|
|
1549
|
+
return error("data must be an array which includes", value, options);
|
|
1807
1550
|
}
|
|
1808
1551
|
};
|
|
1809
1552
|
var validJWA = [
|
|
@@ -1817,7 +1560,7 @@
|
|
|
1817
1560
|
"ES384",
|
|
1818
1561
|
"ES512"
|
|
1819
1562
|
];
|
|
1820
|
-
var
|
|
1563
|
+
var validAuthMethods = [
|
|
1821
1564
|
"client_secret_post",
|
|
1822
1565
|
"client_secret_basic",
|
|
1823
1566
|
"client_secret_jwt",
|
|
@@ -1831,7 +1574,7 @@
|
|
|
1831
1574
|
issuer: Required(validURL)
|
|
1832
1575
|
});
|
|
1833
1576
|
const defaultOptions = {
|
|
1834
|
-
client: everything_default.client().with(
|
|
1577
|
+
client: everything_default.client().with(throwermw()).with(jsonmw()),
|
|
1835
1578
|
requireDynamicRegistration: false
|
|
1836
1579
|
};
|
|
1837
1580
|
options = Object.assign({}, defaultOptions, options);
|
|
@@ -1863,7 +1606,7 @@
|
|
|
1863
1606
|
// not testing for 'none'
|
|
1864
1607
|
request_object_encryption_alg_values_supported: Optional([]),
|
|
1865
1608
|
request_object_encryption_enc_values_supported: Optional([]),
|
|
1866
|
-
token_endpoint_auth_methods_supported: Optional(anyOf(...
|
|
1609
|
+
token_endpoint_auth_methods_supported: Optional(anyOf(...validAuthMethods)),
|
|
1867
1610
|
token_endpoint_auth_signing_alg_values_supported: Optional(MustInclude("RS256"), not(MustInclude("none"))),
|
|
1868
1611
|
display_values_supported: Optional(anyOf("page", "popup", "touch", "wap")),
|
|
1869
1612
|
claim_types_supported: Optional(anyOf("normal", "aggregated", "distributed")),
|
|
@@ -1916,7 +1659,7 @@
|
|
|
1916
1659
|
request_object_signing_alg: Optional(oneOf(...validJWA)),
|
|
1917
1660
|
request_object_encryption_alg: Optional(oneOf(...validJWA)),
|
|
1918
1661
|
request_object_encryption_enc: Optional(oneOf(...validJWA)),
|
|
1919
|
-
token_endpoint_auth_method: Optional(oneOf(...
|
|
1662
|
+
token_endpoint_auth_method: Optional(oneOf(...validAuthMethods)),
|
|
1920
1663
|
token_endpoint_auth_signing_alg: Optional(oneOf(...validJWA)),
|
|
1921
1664
|
default_max_age: Optional(Number),
|
|
1922
1665
|
require_auth_time: Optional(Boolean),
|
|
@@ -1930,7 +1673,7 @@
|
|
|
1930
1673
|
client_info: openid_client_metadata
|
|
1931
1674
|
});
|
|
1932
1675
|
const defaultOptions = {
|
|
1933
|
-
client: everything_default.client().with(
|
|
1676
|
+
client: everything_default.client().with(throwermw()).with(jsonmw())
|
|
1934
1677
|
};
|
|
1935
1678
|
options = Object.assign({}, defaultOptions, options);
|
|
1936
1679
|
let response2 = await options.client.post(options.registration_endpoint, {
|
|
@@ -2048,12 +1791,6 @@
|
|
|
2048
1791
|
}
|
|
2049
1792
|
//...
|
|
2050
1793
|
);
|
|
2051
|
-
const pkceSupported = options.openid_configuration.code_challenge_methods_supported.length;
|
|
2052
|
-
if (pkceSupported) {
|
|
2053
|
-
delete oauth2Options.oauth2_configuration.client_secret;
|
|
2054
|
-
} else {
|
|
2055
|
-
oauth2Options.oauth2_configuration.code_verifier = false;
|
|
2056
|
-
}
|
|
2057
1794
|
const storeIdToken = async (req2, next2) => {
|
|
2058
1795
|
const res2 = await next2(req2);
|
|
2059
1796
|
const contentType = res2.headers.get("content-type");
|
|
@@ -2115,6 +1852,6 @@
|
|
|
2115
1852
|
if (!globalThis.metro.oidc) {
|
|
2116
1853
|
globalThis.metro.oidc = oidc;
|
|
2117
1854
|
}
|
|
2118
|
-
var
|
|
1855
|
+
var browser_default = oidc;
|
|
2119
1856
|
})();
|
|
2120
1857
|
//# sourceMappingURL=browser.js.map
|