@arkitektbedriftene/fe-lib 0.2.12 → 0.2.13
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/oidc.es.js +650 -658
- package/package.json +2 -2
package/dist/oidc.es.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { u as
|
|
1
|
+
import { j as se } from "./jsx-runtime-a0589023.js";
|
|
2
|
+
import { createContext as ue, useContext as ge, useMemo as _e, useEffect as F, useState as Ce, useRef as pe, useCallback as ae } from "react";
|
|
3
|
+
import { u as Re } from "./useLocalStorageState-b4fb2a60.js";
|
|
4
4
|
var N = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
|
-
function
|
|
6
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
|
-
}
|
|
8
|
-
function Pe(e) {
|
|
5
|
+
function Te(e) {
|
|
9
6
|
if (e.__esModule)
|
|
10
7
|
return e;
|
|
11
8
|
var t = e.default;
|
|
@@ -32,400 +29,124 @@ function Pe(e) {
|
|
|
32
29
|
});
|
|
33
30
|
}), s;
|
|
34
31
|
}
|
|
35
|
-
function
|
|
32
|
+
function Ie(e) {
|
|
36
33
|
throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
37
34
|
}
|
|
38
|
-
var
|
|
35
|
+
var H = {}, Ue = {
|
|
39
36
|
get exports() {
|
|
40
|
-
return
|
|
37
|
+
return H;
|
|
41
38
|
},
|
|
42
39
|
set exports(e) {
|
|
43
|
-
|
|
40
|
+
H = e;
|
|
44
41
|
}
|
|
45
42
|
};
|
|
46
|
-
const
|
|
43
|
+
const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
47
44
|
__proto__: null,
|
|
48
|
-
default:
|
|
49
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
50
|
-
|
|
51
|
-
function
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return n.getRandomValues(new Uint32Array(1))[0];
|
|
68
|
-
} catch {
|
|
69
|
-
}
|
|
70
|
-
if (typeof n.randomBytes == "function")
|
|
71
|
-
try {
|
|
72
|
-
return n.randomBytes(4).readInt32LE();
|
|
73
|
-
} catch {
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
77
|
-
}, c = Object.create || function() {
|
|
78
|
-
function a() {
|
|
79
|
-
}
|
|
80
|
-
return function(d) {
|
|
81
|
-
var p;
|
|
82
|
-
return a.prototype = d, p = new a(), a.prototype = null, p;
|
|
83
|
-
};
|
|
84
|
-
}(), l = {}, h = l.lib = {}, g = h.Base = function() {
|
|
85
|
-
return {
|
|
86
|
-
/**
|
|
87
|
-
* Creates a new object that inherits from this object.
|
|
88
|
-
*
|
|
89
|
-
* @param {Object} overrides Properties to copy into the new object.
|
|
90
|
-
*
|
|
91
|
-
* @return {Object} The new object.
|
|
92
|
-
*
|
|
93
|
-
* @static
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
*
|
|
97
|
-
* var MyType = CryptoJS.lib.Base.extend({
|
|
98
|
-
* field: 'value',
|
|
99
|
-
*
|
|
100
|
-
* method: function () {
|
|
101
|
-
* }
|
|
102
|
-
* });
|
|
103
|
-
*/
|
|
104
|
-
extend: function(a) {
|
|
105
|
-
var d = c(this);
|
|
106
|
-
return a && d.mixIn(a), (!d.hasOwnProperty("init") || this.init === d.init) && (d.init = function() {
|
|
107
|
-
d.$super.init.apply(this, arguments);
|
|
108
|
-
}), d.init.prototype = d, d.$super = this, d;
|
|
109
|
-
},
|
|
110
|
-
/**
|
|
111
|
-
* Extends this object and runs the init method.
|
|
112
|
-
* Arguments to create() will be passed to init().
|
|
113
|
-
*
|
|
114
|
-
* @return {Object} The new object.
|
|
115
|
-
*
|
|
116
|
-
* @static
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
*
|
|
120
|
-
* var instance = MyType.create();
|
|
121
|
-
*/
|
|
122
|
-
create: function() {
|
|
123
|
-
var a = this.extend();
|
|
124
|
-
return a.init.apply(a, arguments), a;
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* Initializes a newly created object.
|
|
128
|
-
* Override this method to add some logic when your objects are created.
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
*
|
|
132
|
-
* var MyType = CryptoJS.lib.Base.extend({
|
|
133
|
-
* init: function () {
|
|
134
|
-
* // ...
|
|
135
|
-
* }
|
|
136
|
-
* });
|
|
137
|
-
*/
|
|
138
|
-
init: function() {
|
|
139
|
-
},
|
|
140
|
-
/**
|
|
141
|
-
* Copies properties into this object.
|
|
142
|
-
*
|
|
143
|
-
* @param {Object} properties The properties to mix in.
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
*
|
|
147
|
-
* MyType.mixIn({
|
|
148
|
-
* field: 'value'
|
|
149
|
-
* });
|
|
150
|
-
*/
|
|
151
|
-
mixIn: function(a) {
|
|
152
|
-
for (var d in a)
|
|
153
|
-
a.hasOwnProperty(d) && (this[d] = a[d]);
|
|
154
|
-
a.hasOwnProperty("toString") && (this.toString = a.toString);
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Creates a copy of this object.
|
|
158
|
-
*
|
|
159
|
-
* @return {Object} The clone.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
*
|
|
163
|
-
* var clone = instance.clone();
|
|
164
|
-
*/
|
|
165
|
-
clone: function() {
|
|
166
|
-
return this.init.prototype.extend(this);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
}(), u = h.WordArray = g.extend({
|
|
170
|
-
/**
|
|
171
|
-
* Initializes a newly created word array.
|
|
172
|
-
*
|
|
173
|
-
* @param {Array} words (Optional) An array of 32-bit words.
|
|
174
|
-
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
*
|
|
178
|
-
* var wordArray = CryptoJS.lib.WordArray.create();
|
|
179
|
-
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
180
|
-
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
181
|
-
*/
|
|
182
|
-
init: function(a, d) {
|
|
183
|
-
a = this.words = a || [], d != i ? this.sigBytes = d : this.sigBytes = a.length * 4;
|
|
184
|
-
},
|
|
185
|
-
/**
|
|
186
|
-
* Converts this word array to a string.
|
|
187
|
-
*
|
|
188
|
-
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
|
|
189
|
-
*
|
|
190
|
-
* @return {string} The stringified word array.
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
*
|
|
194
|
-
* var string = wordArray + '';
|
|
195
|
-
* var string = wordArray.toString();
|
|
196
|
-
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
197
|
-
*/
|
|
198
|
-
toString: function(a) {
|
|
199
|
-
return (a || w).stringify(this);
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* Concatenates a word array to this word array.
|
|
203
|
-
*
|
|
204
|
-
* @param {WordArray} wordArray The word array to append.
|
|
205
|
-
*
|
|
206
|
-
* @return {WordArray} This word array.
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
*
|
|
210
|
-
* wordArray1.concat(wordArray2);
|
|
211
|
-
*/
|
|
212
|
-
concat: function(a) {
|
|
213
|
-
var d = this.words, p = a.words, v = this.sigBytes, b = a.sigBytes;
|
|
214
|
-
if (this.clamp(), v % 4)
|
|
215
|
-
for (var E = 0; E < b; E++) {
|
|
216
|
-
var x = p[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
217
|
-
d[v + E >>> 2] |= x << 24 - (v + E) % 4 * 8;
|
|
218
|
-
}
|
|
219
|
-
else
|
|
220
|
-
for (var C = 0; C < b; C += 4)
|
|
221
|
-
d[v + C >>> 2] = p[C >>> 2];
|
|
222
|
-
return this.sigBytes += b, this;
|
|
223
|
-
},
|
|
224
|
-
/**
|
|
225
|
-
* Removes insignificant bits.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
*
|
|
229
|
-
* wordArray.clamp();
|
|
230
|
-
*/
|
|
231
|
-
clamp: function() {
|
|
232
|
-
var a = this.words, d = this.sigBytes;
|
|
233
|
-
a[d >>> 2] &= 4294967295 << 32 - d % 4 * 8, a.length = r.ceil(d / 4);
|
|
234
|
-
},
|
|
235
|
-
/**
|
|
236
|
-
* Creates a copy of this word array.
|
|
237
|
-
*
|
|
238
|
-
* @return {WordArray} The clone.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
*
|
|
242
|
-
* var clone = wordArray.clone();
|
|
243
|
-
*/
|
|
244
|
-
clone: function() {
|
|
245
|
-
var a = g.clone.call(this);
|
|
246
|
-
return a.words = this.words.slice(0), a;
|
|
247
|
-
},
|
|
248
|
-
/**
|
|
249
|
-
* Creates a word array filled with random bytes.
|
|
250
|
-
*
|
|
251
|
-
* @param {number} nBytes The number of random bytes to generate.
|
|
252
|
-
*
|
|
253
|
-
* @return {WordArray} The random word array.
|
|
254
|
-
*
|
|
255
|
-
* @static
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
*
|
|
259
|
-
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
260
|
-
*/
|
|
261
|
-
random: function(a) {
|
|
262
|
-
for (var d = [], p = 0; p < a; p += 4)
|
|
263
|
-
d.push(o());
|
|
264
|
-
return new u.init(d, a);
|
|
265
|
-
}
|
|
266
|
-
}), S = l.enc = {}, w = S.Hex = {
|
|
267
|
-
/**
|
|
268
|
-
* Converts a word array to a hex string.
|
|
269
|
-
*
|
|
270
|
-
* @param {WordArray} wordArray The word array.
|
|
271
|
-
*
|
|
272
|
-
* @return {string} The hex string.
|
|
273
|
-
*
|
|
274
|
-
* @static
|
|
275
|
-
*
|
|
276
|
-
* @example
|
|
277
|
-
*
|
|
278
|
-
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
279
|
-
*/
|
|
280
|
-
stringify: function(a) {
|
|
281
|
-
for (var d = a.words, p = a.sigBytes, v = [], b = 0; b < p; b++) {
|
|
282
|
-
var E = d[b >>> 2] >>> 24 - b % 4 * 8 & 255;
|
|
283
|
-
v.push((E >>> 4).toString(16)), v.push((E & 15).toString(16));
|
|
45
|
+
default: Pe
|
|
46
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = /* @__PURE__ */ Te(Ae);
|
|
47
|
+
(function(e, t) {
|
|
48
|
+
(function(s, r) {
|
|
49
|
+
e.exports = r();
|
|
50
|
+
})(N, function() {
|
|
51
|
+
var s = s || function(r, i) {
|
|
52
|
+
var n;
|
|
53
|
+
if (typeof window < "u" && window.crypto && (n = window.crypto), typeof self < "u" && self.crypto && (n = self.crypto), typeof globalThis < "u" && globalThis.crypto && (n = globalThis.crypto), !n && typeof window < "u" && window.msCrypto && (n = window.msCrypto), !n && typeof N < "u" && N.crypto && (n = N.crypto), !n && typeof Ie == "function")
|
|
54
|
+
try {
|
|
55
|
+
n = Oe;
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
var o = function() {
|
|
59
|
+
if (n) {
|
|
60
|
+
if (typeof n.getRandomValues == "function")
|
|
61
|
+
try {
|
|
62
|
+
return n.getRandomValues(new Uint32Array(1))[0];
|
|
63
|
+
} catch {
|
|
284
64
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
*
|
|
290
|
-
* @param {string} hexStr The hex string.
|
|
291
|
-
*
|
|
292
|
-
* @return {WordArray} The word array.
|
|
293
|
-
*
|
|
294
|
-
* @static
|
|
295
|
-
*
|
|
296
|
-
* @example
|
|
297
|
-
*
|
|
298
|
-
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
299
|
-
*/
|
|
300
|
-
parse: function(a) {
|
|
301
|
-
for (var d = a.length, p = [], v = 0; v < d; v += 2)
|
|
302
|
-
p[v >>> 3] |= parseInt(a.substr(v, 2), 16) << 24 - v % 8 * 4;
|
|
303
|
-
return new u.init(p, d / 2);
|
|
304
|
-
}
|
|
305
|
-
}, k = S.Latin1 = {
|
|
306
|
-
/**
|
|
307
|
-
* Converts a word array to a Latin1 string.
|
|
308
|
-
*
|
|
309
|
-
* @param {WordArray} wordArray The word array.
|
|
310
|
-
*
|
|
311
|
-
* @return {string} The Latin1 string.
|
|
312
|
-
*
|
|
313
|
-
* @static
|
|
314
|
-
*
|
|
315
|
-
* @example
|
|
316
|
-
*
|
|
317
|
-
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
318
|
-
*/
|
|
319
|
-
stringify: function(a) {
|
|
320
|
-
for (var d = a.words, p = a.sigBytes, v = [], b = 0; b < p; b++) {
|
|
321
|
-
var E = d[b >>> 2] >>> 24 - b % 4 * 8 & 255;
|
|
322
|
-
v.push(String.fromCharCode(E));
|
|
65
|
+
if (typeof n.randomBytes == "function")
|
|
66
|
+
try {
|
|
67
|
+
return n.randomBytes(4).readInt32LE();
|
|
68
|
+
} catch {
|
|
323
69
|
}
|
|
324
|
-
|
|
325
|
-
|
|
70
|
+
}
|
|
71
|
+
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
72
|
+
}, c = Object.create || function() {
|
|
73
|
+
function a() {
|
|
74
|
+
}
|
|
75
|
+
return function(d) {
|
|
76
|
+
var p;
|
|
77
|
+
return a.prototype = d, p = new a(), a.prototype = null, p;
|
|
78
|
+
};
|
|
79
|
+
}(), l = {}, h = l.lib = {}, g = h.Base = function() {
|
|
80
|
+
return {
|
|
326
81
|
/**
|
|
327
|
-
*
|
|
82
|
+
* Creates a new object that inherits from this object.
|
|
328
83
|
*
|
|
329
|
-
* @param {
|
|
84
|
+
* @param {Object} overrides Properties to copy into the new object.
|
|
330
85
|
*
|
|
331
|
-
* @return {
|
|
86
|
+
* @return {Object} The new object.
|
|
332
87
|
*
|
|
333
88
|
* @static
|
|
334
89
|
*
|
|
335
90
|
* @example
|
|
336
91
|
*
|
|
337
|
-
* var
|
|
338
|
-
|
|
339
|
-
parse: function(a) {
|
|
340
|
-
for (var d = a.length, p = [], v = 0; v < d; v++)
|
|
341
|
-
p[v >>> 2] |= (a.charCodeAt(v) & 255) << 24 - v % 4 * 8;
|
|
342
|
-
return new u.init(p, d);
|
|
343
|
-
}
|
|
344
|
-
}, _ = S.Utf8 = {
|
|
345
|
-
/**
|
|
346
|
-
* Converts a word array to a UTF-8 string.
|
|
347
|
-
*
|
|
348
|
-
* @param {WordArray} wordArray The word array.
|
|
349
|
-
*
|
|
350
|
-
* @return {string} The UTF-8 string.
|
|
351
|
-
*
|
|
352
|
-
* @static
|
|
92
|
+
* var MyType = CryptoJS.lib.Base.extend({
|
|
93
|
+
* field: 'value',
|
|
353
94
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
95
|
+
* method: function () {
|
|
96
|
+
* }
|
|
97
|
+
* });
|
|
357
98
|
*/
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
99
|
+
extend: function(a) {
|
|
100
|
+
var d = c(this);
|
|
101
|
+
return a && d.mixIn(a), (!d.hasOwnProperty("init") || this.init === d.init) && (d.init = function() {
|
|
102
|
+
d.$super.init.apply(this, arguments);
|
|
103
|
+
}), d.init.prototype = d, d.$super = this, d;
|
|
364
104
|
},
|
|
365
105
|
/**
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
* @param {string} utf8Str The UTF-8 string.
|
|
106
|
+
* Extends this object and runs the init method.
|
|
107
|
+
* Arguments to create() will be passed to init().
|
|
369
108
|
*
|
|
370
|
-
* @return {
|
|
109
|
+
* @return {Object} The new object.
|
|
371
110
|
*
|
|
372
111
|
* @static
|
|
373
112
|
*
|
|
374
113
|
* @example
|
|
375
114
|
*
|
|
376
|
-
* var
|
|
115
|
+
* var instance = MyType.create();
|
|
377
116
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}, m = h.BufferedBlockAlgorithm = g.extend({
|
|
382
|
-
/**
|
|
383
|
-
* Resets this block algorithm's data buffer to its initial state.
|
|
384
|
-
*
|
|
385
|
-
* @example
|
|
386
|
-
*
|
|
387
|
-
* bufferedBlockAlgorithm.reset();
|
|
388
|
-
*/
|
|
389
|
-
reset: function() {
|
|
390
|
-
this._data = new u.init(), this._nDataBytes = 0;
|
|
117
|
+
create: function() {
|
|
118
|
+
var a = this.extend();
|
|
119
|
+
return a.init.apply(a, arguments), a;
|
|
391
120
|
},
|
|
392
121
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
|
|
122
|
+
* Initializes a newly created object.
|
|
123
|
+
* Override this method to add some logic when your objects are created.
|
|
396
124
|
*
|
|
397
125
|
* @example
|
|
398
126
|
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
127
|
+
* var MyType = CryptoJS.lib.Base.extend({
|
|
128
|
+
* init: function () {
|
|
129
|
+
* // ...
|
|
130
|
+
* }
|
|
131
|
+
* });
|
|
401
132
|
*/
|
|
402
|
-
|
|
403
|
-
typeof a == "string" && (a = _.parse(a)), this._data.concat(a), this._nDataBytes += a.sigBytes;
|
|
133
|
+
init: function() {
|
|
404
134
|
},
|
|
405
135
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
|
|
409
|
-
*
|
|
410
|
-
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
|
|
136
|
+
* Copies properties into this object.
|
|
411
137
|
*
|
|
412
|
-
* @
|
|
138
|
+
* @param {Object} properties The properties to mix in.
|
|
413
139
|
*
|
|
414
140
|
* @example
|
|
415
141
|
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
142
|
+
* MyType.mixIn({
|
|
143
|
+
* field: 'value'
|
|
144
|
+
* });
|
|
418
145
|
*/
|
|
419
|
-
|
|
420
|
-
var d
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
if (A) {
|
|
424
|
-
for (var q = 0; q < A; q += E)
|
|
425
|
-
this._doProcessBlock(v, q);
|
|
426
|
-
d = v.splice(0, A), p.sigBytes -= R;
|
|
427
|
-
}
|
|
428
|
-
return new u.init(d, R);
|
|
146
|
+
mixIn: function(a) {
|
|
147
|
+
for (var d in a)
|
|
148
|
+
a.hasOwnProperty(d) && (this[d] = a[d]);
|
|
149
|
+
a.hasOwnProperty("toString") && (this.toString = a.toString);
|
|
429
150
|
},
|
|
430
151
|
/**
|
|
431
152
|
* Creates a copy of this object.
|
|
@@ -434,133 +155,404 @@ function J() {
|
|
|
434
155
|
*
|
|
435
156
|
* @example
|
|
436
157
|
*
|
|
437
|
-
* var clone =
|
|
158
|
+
* var clone = instance.clone();
|
|
438
159
|
*/
|
|
439
160
|
clone: function() {
|
|
440
|
-
|
|
441
|
-
return a._data = this._data.clone(), a;
|
|
442
|
-
},
|
|
443
|
-
_minBufferSize: 0
|
|
444
|
-
});
|
|
445
|
-
h.Hasher = m.extend({
|
|
446
|
-
/**
|
|
447
|
-
* Configuration options.
|
|
448
|
-
*/
|
|
449
|
-
cfg: g.extend(),
|
|
450
|
-
/**
|
|
451
|
-
* Initializes a newly created hasher.
|
|
452
|
-
*
|
|
453
|
-
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
|
|
454
|
-
*
|
|
455
|
-
* @example
|
|
456
|
-
*
|
|
457
|
-
* var hasher = CryptoJS.algo.SHA256.create();
|
|
458
|
-
*/
|
|
459
|
-
init: function(a) {
|
|
460
|
-
this.cfg = this.cfg.extend(a), this.reset();
|
|
461
|
-
},
|
|
462
|
-
/**
|
|
463
|
-
* Resets this hasher to its initial state.
|
|
464
|
-
*
|
|
465
|
-
* @example
|
|
466
|
-
*
|
|
467
|
-
* hasher.reset();
|
|
468
|
-
*/
|
|
469
|
-
reset: function() {
|
|
470
|
-
m.reset.call(this), this._doReset();
|
|
471
|
-
},
|
|
472
|
-
/**
|
|
473
|
-
* Updates this hasher with a message.
|
|
474
|
-
*
|
|
475
|
-
* @param {WordArray|string} messageUpdate The message to append.
|
|
476
|
-
*
|
|
477
|
-
* @return {Hasher} This hasher.
|
|
478
|
-
*
|
|
479
|
-
* @example
|
|
480
|
-
*
|
|
481
|
-
* hasher.update('message');
|
|
482
|
-
* hasher.update(wordArray);
|
|
483
|
-
*/
|
|
484
|
-
update: function(a) {
|
|
485
|
-
return this._append(a), this._process(), this;
|
|
486
|
-
},
|
|
487
|
-
/**
|
|
488
|
-
* Finalizes the hash computation.
|
|
489
|
-
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
490
|
-
*
|
|
491
|
-
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
|
492
|
-
*
|
|
493
|
-
* @return {WordArray} The hash.
|
|
494
|
-
*
|
|
495
|
-
* @example
|
|
496
|
-
*
|
|
497
|
-
* var hash = hasher.finalize();
|
|
498
|
-
* var hash = hasher.finalize('message');
|
|
499
|
-
* var hash = hasher.finalize(wordArray);
|
|
500
|
-
*/
|
|
501
|
-
finalize: function(a) {
|
|
502
|
-
a && this._append(a);
|
|
503
|
-
var d = this._doFinalize();
|
|
504
|
-
return d;
|
|
505
|
-
},
|
|
506
|
-
blockSize: 16,
|
|
507
|
-
/**
|
|
508
|
-
* Creates a shortcut function to a hasher's object interface.
|
|
509
|
-
*
|
|
510
|
-
* @param {Hasher} hasher The hasher to create a helper for.
|
|
511
|
-
*
|
|
512
|
-
* @return {Function} The shortcut function.
|
|
513
|
-
*
|
|
514
|
-
* @static
|
|
515
|
-
*
|
|
516
|
-
* @example
|
|
517
|
-
*
|
|
518
|
-
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
519
|
-
*/
|
|
520
|
-
_createHelper: function(a) {
|
|
521
|
-
return function(d, p) {
|
|
522
|
-
return new a.init(p).finalize(d);
|
|
523
|
-
};
|
|
524
|
-
},
|
|
525
|
-
/**
|
|
526
|
-
* Creates a shortcut function to the HMAC's object interface.
|
|
527
|
-
*
|
|
528
|
-
* @param {Hasher} hasher The hasher to use in this HMAC helper.
|
|
529
|
-
*
|
|
530
|
-
* @return {Function} The shortcut function.
|
|
531
|
-
*
|
|
532
|
-
* @static
|
|
533
|
-
*
|
|
534
|
-
* @example
|
|
535
|
-
*
|
|
536
|
-
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
537
|
-
*/
|
|
538
|
-
_createHmacHelper: function(a) {
|
|
539
|
-
return function(d, p) {
|
|
540
|
-
return new y.HMAC.init(a, p).finalize(d);
|
|
541
|
-
};
|
|
161
|
+
return this.init.prototype.extend(this);
|
|
542
162
|
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
var
|
|
163
|
+
};
|
|
164
|
+
}(), u = h.WordArray = g.extend({
|
|
165
|
+
/**
|
|
166
|
+
* Initializes a newly created word array.
|
|
167
|
+
*
|
|
168
|
+
* @param {Array} words (Optional) An array of 32-bit words.
|
|
169
|
+
* @param {number} sigBytes (Optional) The number of significant bytes in the words.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
*
|
|
173
|
+
* var wordArray = CryptoJS.lib.WordArray.create();
|
|
174
|
+
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
|
|
175
|
+
* var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
|
|
176
|
+
*/
|
|
177
|
+
init: function(a, d) {
|
|
178
|
+
a = this.words = a || [], d != i ? this.sigBytes = d : this.sigBytes = a.length * 4;
|
|
179
|
+
},
|
|
180
|
+
/**
|
|
181
|
+
* Converts this word array to a string.
|
|
182
|
+
*
|
|
183
|
+
* @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
|
|
184
|
+
*
|
|
185
|
+
* @return {string} The stringified word array.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
*
|
|
189
|
+
* var string = wordArray + '';
|
|
190
|
+
* var string = wordArray.toString();
|
|
191
|
+
* var string = wordArray.toString(CryptoJS.enc.Utf8);
|
|
192
|
+
*/
|
|
193
|
+
toString: function(a) {
|
|
194
|
+
return (a || w).stringify(this);
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* Concatenates a word array to this word array.
|
|
198
|
+
*
|
|
199
|
+
* @param {WordArray} wordArray The word array to append.
|
|
200
|
+
*
|
|
201
|
+
* @return {WordArray} This word array.
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
*
|
|
205
|
+
* wordArray1.concat(wordArray2);
|
|
206
|
+
*/
|
|
207
|
+
concat: function(a) {
|
|
208
|
+
var d = this.words, p = a.words, v = this.sigBytes, b = a.sigBytes;
|
|
209
|
+
if (this.clamp(), v % 4)
|
|
210
|
+
for (var E = 0; E < b; E++) {
|
|
211
|
+
var x = p[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
212
|
+
d[v + E >>> 2] |= x << 24 - (v + E) % 4 * 8;
|
|
213
|
+
}
|
|
214
|
+
else
|
|
215
|
+
for (var C = 0; C < b; C += 4)
|
|
216
|
+
d[v + C >>> 2] = p[C >>> 2];
|
|
217
|
+
return this.sigBytes += b, this;
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* Removes insignificant bits.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
*
|
|
224
|
+
* wordArray.clamp();
|
|
225
|
+
*/
|
|
226
|
+
clamp: function() {
|
|
227
|
+
var a = this.words, d = this.sigBytes;
|
|
228
|
+
a[d >>> 2] &= 4294967295 << 32 - d % 4 * 8, a.length = r.ceil(d / 4);
|
|
229
|
+
},
|
|
230
|
+
/**
|
|
231
|
+
* Creates a copy of this word array.
|
|
232
|
+
*
|
|
233
|
+
* @return {WordArray} The clone.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
*
|
|
237
|
+
* var clone = wordArray.clone();
|
|
238
|
+
*/
|
|
239
|
+
clone: function() {
|
|
240
|
+
var a = g.clone.call(this);
|
|
241
|
+
return a.words = this.words.slice(0), a;
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* Creates a word array filled with random bytes.
|
|
245
|
+
*
|
|
246
|
+
* @param {number} nBytes The number of random bytes to generate.
|
|
247
|
+
*
|
|
248
|
+
* @return {WordArray} The random word array.
|
|
249
|
+
*
|
|
250
|
+
* @static
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
*
|
|
254
|
+
* var wordArray = CryptoJS.lib.WordArray.random(16);
|
|
255
|
+
*/
|
|
256
|
+
random: function(a) {
|
|
257
|
+
for (var d = [], p = 0; p < a; p += 4)
|
|
258
|
+
d.push(o());
|
|
259
|
+
return new u.init(d, a);
|
|
260
|
+
}
|
|
261
|
+
}), S = l.enc = {}, w = S.Hex = {
|
|
262
|
+
/**
|
|
263
|
+
* Converts a word array to a hex string.
|
|
264
|
+
*
|
|
265
|
+
* @param {WordArray} wordArray The word array.
|
|
266
|
+
*
|
|
267
|
+
* @return {string} The hex string.
|
|
268
|
+
*
|
|
269
|
+
* @static
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
*
|
|
273
|
+
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
274
|
+
*/
|
|
275
|
+
stringify: function(a) {
|
|
276
|
+
for (var d = a.words, p = a.sigBytes, v = [], b = 0; b < p; b++) {
|
|
277
|
+
var E = d[b >>> 2] >>> 24 - b % 4 * 8 & 255;
|
|
278
|
+
v.push((E >>> 4).toString(16)), v.push((E & 15).toString(16));
|
|
279
|
+
}
|
|
280
|
+
return v.join("");
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* Converts a hex string to a word array.
|
|
284
|
+
*
|
|
285
|
+
* @param {string} hexStr The hex string.
|
|
286
|
+
*
|
|
287
|
+
* @return {WordArray} The word array.
|
|
288
|
+
*
|
|
289
|
+
* @static
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
*
|
|
293
|
+
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
294
|
+
*/
|
|
295
|
+
parse: function(a) {
|
|
296
|
+
for (var d = a.length, p = [], v = 0; v < d; v += 2)
|
|
297
|
+
p[v >>> 3] |= parseInt(a.substr(v, 2), 16) << 24 - v % 8 * 4;
|
|
298
|
+
return new u.init(p, d / 2);
|
|
299
|
+
}
|
|
300
|
+
}, k = S.Latin1 = {
|
|
301
|
+
/**
|
|
302
|
+
* Converts a word array to a Latin1 string.
|
|
303
|
+
*
|
|
304
|
+
* @param {WordArray} wordArray The word array.
|
|
305
|
+
*
|
|
306
|
+
* @return {string} The Latin1 string.
|
|
307
|
+
*
|
|
308
|
+
* @static
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
*
|
|
312
|
+
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
313
|
+
*/
|
|
314
|
+
stringify: function(a) {
|
|
315
|
+
for (var d = a.words, p = a.sigBytes, v = [], b = 0; b < p; b++) {
|
|
316
|
+
var E = d[b >>> 2] >>> 24 - b % 4 * 8 & 255;
|
|
317
|
+
v.push(String.fromCharCode(E));
|
|
318
|
+
}
|
|
319
|
+
return v.join("");
|
|
320
|
+
},
|
|
321
|
+
/**
|
|
322
|
+
* Converts a Latin1 string to a word array.
|
|
323
|
+
*
|
|
324
|
+
* @param {string} latin1Str The Latin1 string.
|
|
325
|
+
*
|
|
326
|
+
* @return {WordArray} The word array.
|
|
327
|
+
*
|
|
328
|
+
* @static
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
*
|
|
332
|
+
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
333
|
+
*/
|
|
334
|
+
parse: function(a) {
|
|
335
|
+
for (var d = a.length, p = [], v = 0; v < d; v++)
|
|
336
|
+
p[v >>> 2] |= (a.charCodeAt(v) & 255) << 24 - v % 4 * 8;
|
|
337
|
+
return new u.init(p, d);
|
|
338
|
+
}
|
|
339
|
+
}, _ = S.Utf8 = {
|
|
340
|
+
/**
|
|
341
|
+
* Converts a word array to a UTF-8 string.
|
|
342
|
+
*
|
|
343
|
+
* @param {WordArray} wordArray The word array.
|
|
344
|
+
*
|
|
345
|
+
* @return {string} The UTF-8 string.
|
|
346
|
+
*
|
|
347
|
+
* @static
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
*
|
|
351
|
+
* var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
|
|
352
|
+
*/
|
|
353
|
+
stringify: function(a) {
|
|
354
|
+
try {
|
|
355
|
+
return decodeURIComponent(escape(k.stringify(a)));
|
|
356
|
+
} catch {
|
|
357
|
+
throw new Error("Malformed UTF-8 data");
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* Converts a UTF-8 string to a word array.
|
|
362
|
+
*
|
|
363
|
+
* @param {string} utf8Str The UTF-8 string.
|
|
364
|
+
*
|
|
365
|
+
* @return {WordArray} The word array.
|
|
366
|
+
*
|
|
367
|
+
* @static
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
*
|
|
371
|
+
* var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
|
|
372
|
+
*/
|
|
373
|
+
parse: function(a) {
|
|
374
|
+
return k.parse(unescape(encodeURIComponent(a)));
|
|
375
|
+
}
|
|
376
|
+
}, m = h.BufferedBlockAlgorithm = g.extend({
|
|
377
|
+
/**
|
|
378
|
+
* Resets this block algorithm's data buffer to its initial state.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
*
|
|
382
|
+
* bufferedBlockAlgorithm.reset();
|
|
383
|
+
*/
|
|
384
|
+
reset: function() {
|
|
385
|
+
this._data = new u.init(), this._nDataBytes = 0;
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* Adds new data to this block algorithm's buffer.
|
|
389
|
+
*
|
|
390
|
+
* @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
*
|
|
394
|
+
* bufferedBlockAlgorithm._append('data');
|
|
395
|
+
* bufferedBlockAlgorithm._append(wordArray);
|
|
396
|
+
*/
|
|
397
|
+
_append: function(a) {
|
|
398
|
+
typeof a == "string" && (a = _.parse(a)), this._data.concat(a), this._nDataBytes += a.sigBytes;
|
|
399
|
+
},
|
|
400
|
+
/**
|
|
401
|
+
* Processes available data blocks.
|
|
402
|
+
*
|
|
403
|
+
* This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
|
|
404
|
+
*
|
|
405
|
+
* @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
|
|
406
|
+
*
|
|
407
|
+
* @return {WordArray} The processed data.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
*
|
|
411
|
+
* var processedData = bufferedBlockAlgorithm._process();
|
|
412
|
+
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
413
|
+
*/
|
|
414
|
+
_process: function(a) {
|
|
415
|
+
var d, p = this._data, v = p.words, b = p.sigBytes, E = this.blockSize, x = E * 4, C = b / x;
|
|
416
|
+
a ? C = r.ceil(C) : C = r.max((C | 0) - this._minBufferSize, 0);
|
|
417
|
+
var A = C * E, R = r.min(A * 4, b);
|
|
418
|
+
if (A) {
|
|
419
|
+
for (var q = 0; q < A; q += E)
|
|
420
|
+
this._doProcessBlock(v, q);
|
|
421
|
+
d = v.splice(0, A), p.sigBytes -= R;
|
|
422
|
+
}
|
|
423
|
+
return new u.init(d, R);
|
|
424
|
+
},
|
|
425
|
+
/**
|
|
426
|
+
* Creates a copy of this object.
|
|
427
|
+
*
|
|
428
|
+
* @return {Object} The clone.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
*
|
|
432
|
+
* var clone = bufferedBlockAlgorithm.clone();
|
|
433
|
+
*/
|
|
434
|
+
clone: function() {
|
|
435
|
+
var a = g.clone.call(this);
|
|
436
|
+
return a._data = this._data.clone(), a;
|
|
437
|
+
},
|
|
438
|
+
_minBufferSize: 0
|
|
439
|
+
});
|
|
440
|
+
h.Hasher = m.extend({
|
|
441
|
+
/**
|
|
442
|
+
* Configuration options.
|
|
443
|
+
*/
|
|
444
|
+
cfg: g.extend(),
|
|
445
|
+
/**
|
|
446
|
+
* Initializes a newly created hasher.
|
|
447
|
+
*
|
|
448
|
+
* @param {Object} cfg (Optional) The configuration options to use for this hash computation.
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
*
|
|
452
|
+
* var hasher = CryptoJS.algo.SHA256.create();
|
|
453
|
+
*/
|
|
454
|
+
init: function(a) {
|
|
455
|
+
this.cfg = this.cfg.extend(a), this.reset();
|
|
456
|
+
},
|
|
457
|
+
/**
|
|
458
|
+
* Resets this hasher to its initial state.
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
*
|
|
462
|
+
* hasher.reset();
|
|
463
|
+
*/
|
|
464
|
+
reset: function() {
|
|
465
|
+
m.reset.call(this), this._doReset();
|
|
466
|
+
},
|
|
467
|
+
/**
|
|
468
|
+
* Updates this hasher with a message.
|
|
469
|
+
*
|
|
470
|
+
* @param {WordArray|string} messageUpdate The message to append.
|
|
471
|
+
*
|
|
472
|
+
* @return {Hasher} This hasher.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
*
|
|
476
|
+
* hasher.update('message');
|
|
477
|
+
* hasher.update(wordArray);
|
|
478
|
+
*/
|
|
479
|
+
update: function(a) {
|
|
480
|
+
return this._append(a), this._process(), this;
|
|
481
|
+
},
|
|
482
|
+
/**
|
|
483
|
+
* Finalizes the hash computation.
|
|
484
|
+
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
485
|
+
*
|
|
486
|
+
* @param {WordArray|string} messageUpdate (Optional) A final message update.
|
|
487
|
+
*
|
|
488
|
+
* @return {WordArray} The hash.
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
*
|
|
492
|
+
* var hash = hasher.finalize();
|
|
493
|
+
* var hash = hasher.finalize('message');
|
|
494
|
+
* var hash = hasher.finalize(wordArray);
|
|
495
|
+
*/
|
|
496
|
+
finalize: function(a) {
|
|
497
|
+
a && this._append(a);
|
|
498
|
+
var d = this._doFinalize();
|
|
499
|
+
return d;
|
|
500
|
+
},
|
|
501
|
+
blockSize: 16,
|
|
502
|
+
/**
|
|
503
|
+
* Creates a shortcut function to a hasher's object interface.
|
|
504
|
+
*
|
|
505
|
+
* @param {Hasher} hasher The hasher to create a helper for.
|
|
506
|
+
*
|
|
507
|
+
* @return {Function} The shortcut function.
|
|
508
|
+
*
|
|
509
|
+
* @static
|
|
510
|
+
*
|
|
511
|
+
* @example
|
|
512
|
+
*
|
|
513
|
+
* var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
|
|
514
|
+
*/
|
|
515
|
+
_createHelper: function(a) {
|
|
516
|
+
return function(d, p) {
|
|
517
|
+
return new a.init(p).finalize(d);
|
|
518
|
+
};
|
|
519
|
+
},
|
|
520
|
+
/**
|
|
521
|
+
* Creates a shortcut function to the HMAC's object interface.
|
|
522
|
+
*
|
|
523
|
+
* @param {Hasher} hasher The hasher to use in this HMAC helper.
|
|
524
|
+
*
|
|
525
|
+
* @return {Function} The shortcut function.
|
|
526
|
+
*
|
|
527
|
+
* @static
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
*
|
|
531
|
+
* var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
|
|
532
|
+
*/
|
|
533
|
+
_createHmacHelper: function(a) {
|
|
534
|
+
return function(d, p) {
|
|
535
|
+
return new y.HMAC.init(a, p).finalize(d);
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
var y = l.algo = {};
|
|
540
|
+
return l;
|
|
541
|
+
}(Math);
|
|
542
|
+
return s;
|
|
543
|
+
});
|
|
544
|
+
})(Ue);
|
|
545
|
+
var Q = {}, qe = {
|
|
554
546
|
get exports() {
|
|
555
|
-
return
|
|
547
|
+
return Q;
|
|
556
548
|
},
|
|
557
549
|
set exports(e) {
|
|
558
|
-
|
|
550
|
+
Q = e;
|
|
559
551
|
}
|
|
560
552
|
};
|
|
561
553
|
(function(e, t) {
|
|
562
554
|
(function(s, r) {
|
|
563
|
-
e.exports = r(
|
|
555
|
+
e.exports = r(H);
|
|
564
556
|
})(N, function(s) {
|
|
565
557
|
return function(r) {
|
|
566
558
|
var i = s, n = i.lib, o = n.WordArray, c = n.Hasher, l = i.algo, h = [], g = [];
|
|
@@ -589,8 +581,8 @@ var X = {}, We = {
|
|
|
589
581
|
var C = u[x - 15], A = (C << 25 | C >>> 7) ^ (C << 14 | C >>> 18) ^ C >>> 3, R = u[x - 2], q = (R << 15 | R >>> 17) ^ (R << 13 | R >>> 19) ^ R >>> 10;
|
|
590
582
|
u[x] = A + u[x - 7] + q + u[x - 16];
|
|
591
583
|
}
|
|
592
|
-
var
|
|
593
|
-
E = b, b = v, v = p, p = d +
|
|
584
|
+
var W = p & v ^ ~p & b, J = m & y ^ m & a ^ y & a, K = (m << 30 | m >>> 2) ^ (m << 19 | m >>> 13) ^ (m << 10 | m >>> 22), V = (p << 26 | p >>> 6) ^ (p << 21 | p >>> 11) ^ (p << 7 | p >>> 25), B = E + V + W + g[x] + u[x], xe = K + J;
|
|
585
|
+
E = b, b = v, v = p, p = d + B | 0, d = a, a = y, y = m, m = B + xe | 0;
|
|
594
586
|
}
|
|
595
587
|
_[0] = _[0] + m | 0, _[1] = _[1] + y | 0, _[2] = _[2] + a | 0, _[3] = _[3] + d | 0, _[4] = _[4] + p | 0, _[5] = _[5] + v | 0, _[6] = _[6] + b | 0, _[7] = _[7] + E | 0;
|
|
596
588
|
},
|
|
@@ -606,8 +598,8 @@ var X = {}, We = {
|
|
|
606
598
|
i.SHA256 = c._createHelper(S), i.HmacSHA256 = c._createHmacHelper(S);
|
|
607
599
|
}(Math), s.SHA256;
|
|
608
600
|
});
|
|
609
|
-
})(
|
|
610
|
-
var $ = {},
|
|
601
|
+
})(qe);
|
|
602
|
+
var $ = {}, Ne = {
|
|
611
603
|
get exports() {
|
|
612
604
|
return $;
|
|
613
605
|
},
|
|
@@ -617,7 +609,7 @@ var $ = {}, Be = {
|
|
|
617
609
|
};
|
|
618
610
|
(function(e, t) {
|
|
619
611
|
(function(s, r) {
|
|
620
|
-
e.exports = r(
|
|
612
|
+
e.exports = r(H);
|
|
621
613
|
})(N, function(s) {
|
|
622
614
|
return function() {
|
|
623
615
|
var r = s, i = r.lib, n = i.WordArray, o = r.enc;
|
|
@@ -686,35 +678,35 @@ var $ = {}, Be = {
|
|
|
686
678
|
}
|
|
687
679
|
}(), s.enc.Base64;
|
|
688
680
|
});
|
|
689
|
-
})(
|
|
690
|
-
var
|
|
681
|
+
})(Ne);
|
|
682
|
+
var X = {}, je = {
|
|
691
683
|
get exports() {
|
|
692
|
-
return
|
|
684
|
+
return X;
|
|
693
685
|
},
|
|
694
686
|
set exports(e) {
|
|
695
|
-
|
|
687
|
+
X = e;
|
|
696
688
|
}
|
|
697
689
|
};
|
|
698
690
|
(function(e, t) {
|
|
699
691
|
(function(s, r) {
|
|
700
|
-
e.exports = r(
|
|
692
|
+
e.exports = r(H);
|
|
701
693
|
})(N, function(s) {
|
|
702
694
|
return s.enc.Utf8;
|
|
703
695
|
});
|
|
704
|
-
})(
|
|
705
|
-
function
|
|
696
|
+
})(je);
|
|
697
|
+
function Y(e) {
|
|
706
698
|
this.message = e;
|
|
707
699
|
}
|
|
708
|
-
|
|
709
|
-
var
|
|
700
|
+
Y.prototype = new Error(), Y.prototype.name = "InvalidCharacterError";
|
|
701
|
+
var ce = typeof window < "u" && window.atob && window.atob.bind(window) || function(e) {
|
|
710
702
|
var t = String(e).replace(/=+$/, "");
|
|
711
703
|
if (t.length % 4 == 1)
|
|
712
|
-
throw new
|
|
704
|
+
throw new Y("'atob' failed: The string to be decoded is not correctly encoded.");
|
|
713
705
|
for (var s, r, i = 0, n = 0, o = ""; r = t.charAt(n++); ~r && (s = i % 4 ? 64 * s + r : r, i++ % 4) ? o += String.fromCharCode(255 & s >> (-2 * i & 6)) : 0)
|
|
714
706
|
r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);
|
|
715
707
|
return o;
|
|
716
708
|
};
|
|
717
|
-
function
|
|
709
|
+
function He(e) {
|
|
718
710
|
var t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
719
711
|
switch (t.length % 4) {
|
|
720
712
|
case 0:
|
|
@@ -730,30 +722,30 @@ function Fe(e) {
|
|
|
730
722
|
}
|
|
731
723
|
try {
|
|
732
724
|
return function(s) {
|
|
733
|
-
return decodeURIComponent(
|
|
725
|
+
return decodeURIComponent(ce(s).replace(/(.)/g, function(r, i) {
|
|
734
726
|
var n = i.charCodeAt(0).toString(16).toUpperCase();
|
|
735
727
|
return n.length < 2 && (n = "0" + n), "%" + n;
|
|
736
728
|
}));
|
|
737
729
|
}(t);
|
|
738
730
|
} catch {
|
|
739
|
-
return
|
|
731
|
+
return ce(t);
|
|
740
732
|
}
|
|
741
733
|
}
|
|
742
734
|
function z(e) {
|
|
743
735
|
this.message = e;
|
|
744
736
|
}
|
|
745
|
-
function
|
|
737
|
+
function Me(e, t) {
|
|
746
738
|
if (typeof e != "string")
|
|
747
739
|
throw new z("Invalid token specified");
|
|
748
740
|
var s = (t = t || {}).header === !0 ? 0 : 1;
|
|
749
741
|
try {
|
|
750
|
-
return JSON.parse(
|
|
742
|
+
return JSON.parse(He(e.split(".")[s]));
|
|
751
743
|
} catch (r) {
|
|
752
744
|
throw new z("Invalid token specified: " + r.message);
|
|
753
745
|
}
|
|
754
746
|
}
|
|
755
747
|
z.prototype = new Error(), z.prototype.name = "InvalidTokenError";
|
|
756
|
-
var
|
|
748
|
+
var We = {
|
|
757
749
|
debug: () => {
|
|
758
750
|
},
|
|
759
751
|
info: () => {
|
|
@@ -765,7 +757,7 @@ var ze = {
|
|
|
765
757
|
}, I, U, D = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.ERROR = 1] = "ERROR", e[e.WARN = 2] = "WARN", e[e.INFO = 3] = "INFO", e[e.DEBUG = 4] = "DEBUG", e))(D || {});
|
|
766
758
|
((e) => {
|
|
767
759
|
function t() {
|
|
768
|
-
I = 3, U =
|
|
760
|
+
I = 3, U = We;
|
|
769
761
|
}
|
|
770
762
|
e.reset = t;
|
|
771
763
|
function s(i) {
|
|
@@ -825,15 +817,15 @@ var f = class {
|
|
|
825
817
|
}
|
|
826
818
|
};
|
|
827
819
|
D.reset();
|
|
828
|
-
var
|
|
820
|
+
var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
829
821
|
static _randomWord() {
|
|
830
|
-
return
|
|
822
|
+
return H.lib.WordArray.random(1).words[0];
|
|
831
823
|
}
|
|
832
824
|
/**
|
|
833
825
|
* Generates RFC4122 version 4 guid
|
|
834
826
|
*/
|
|
835
827
|
static generateUUIDv4() {
|
|
836
|
-
return
|
|
828
|
+
return Be.replace(
|
|
837
829
|
/[018]/g,
|
|
838
830
|
(t) => (+t ^ P._randomWord() & 15 >> +t / 4).toString(16)
|
|
839
831
|
).replace(/-/g, "");
|
|
@@ -849,7 +841,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
849
841
|
*/
|
|
850
842
|
static generateCodeChallenge(e) {
|
|
851
843
|
try {
|
|
852
|
-
const t =
|
|
844
|
+
const t = Q(e);
|
|
853
845
|
return $.stringify(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
854
846
|
} catch (t) {
|
|
855
847
|
throw f.error("CryptoUtils.generateCodeChallenge", t), t;
|
|
@@ -859,7 +851,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
859
851
|
* Generates a base64-encoded string for a basic auth header
|
|
860
852
|
*/
|
|
861
853
|
static generateBasicAuth(e, t) {
|
|
862
|
-
const s =
|
|
854
|
+
const s = X.parse([e, t].join(":"));
|
|
863
855
|
return $.stringify(s);
|
|
864
856
|
}
|
|
865
857
|
}, O = class {
|
|
@@ -878,16 +870,16 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
878
870
|
for (const t of this._callbacks)
|
|
879
871
|
t(...e);
|
|
880
872
|
}
|
|
881
|
-
},
|
|
873
|
+
}, Z = class {
|
|
882
874
|
// IMPORTANT: doesn't validate the token
|
|
883
875
|
static decode(e) {
|
|
884
876
|
try {
|
|
885
|
-
return
|
|
877
|
+
return Me(e);
|
|
886
878
|
} catch (t) {
|
|
887
879
|
throw f.error("JwtUtils.decode", t), t;
|
|
888
880
|
}
|
|
889
881
|
}
|
|
890
|
-
},
|
|
882
|
+
}, le = class {
|
|
891
883
|
/**
|
|
892
884
|
* Populates a map of window features with a placement centered in front of
|
|
893
885
|
* the current window. If no explicit width is given, a default value is
|
|
@@ -929,7 +921,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
929
921
|
cancel() {
|
|
930
922
|
this._logger.create("cancel"), this._timerHandle && (clearInterval(this._timerHandle), this._timerHandle = null);
|
|
931
923
|
}
|
|
932
|
-
},
|
|
924
|
+
}, ee = class {
|
|
933
925
|
static readParams(e, t = "query") {
|
|
934
926
|
if (!e)
|
|
935
927
|
throw new TypeError("Invalid URL");
|
|
@@ -943,11 +935,11 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
943
935
|
throw f.error("ErrorResponse", "No error passed"), new Error("No error passed");
|
|
944
936
|
this.error = e.error, this.error_description = (s = e.error_description) != null ? s : null, this.error_uri = (r = e.error_uri) != null ? r : null, this.state = e.userState, this.session_state = (i = e.session_state) != null ? i : null;
|
|
945
937
|
}
|
|
946
|
-
},
|
|
938
|
+
}, re = class extends Error {
|
|
947
939
|
constructor(e) {
|
|
948
940
|
super(e), this.name = "ErrorTimeout";
|
|
949
941
|
}
|
|
950
|
-
},
|
|
942
|
+
}, Le = class {
|
|
951
943
|
constructor(e) {
|
|
952
944
|
this._logger = new f("AccessTokenEvents"), this._expiringTimer = new T("Access token expiring"), this._expiredTimer = new T("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
|
|
953
945
|
}
|
|
@@ -992,7 +984,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
992
984
|
removeAccessTokenExpired(e) {
|
|
993
985
|
this._expiredTimer.removeHandler(e);
|
|
994
986
|
}
|
|
995
|
-
},
|
|
987
|
+
}, Fe = class {
|
|
996
988
|
constructor(e, t, s, r, i) {
|
|
997
989
|
this._callback = e, this._client_id = t, this._intervalInSeconds = r, this._stopOnError = i, this._logger = new f("CheckSessionIFrame"), this._timer = null, this._session_state = null, this._message = (o) => {
|
|
998
990
|
o.origin === this._frame_origin && o.source === this._frame.contentWindow && (o.data === "error" ? (this._logger.error("error message from check session op iframe"), this._stopOnError && this.stop()) : o.data === "changed" ? (this._logger.debug("changed message from check session op iframe"), this.stop(), this._callback()) : this._logger.debug(o.data + " message from check session op iframe"));
|
|
@@ -1019,7 +1011,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1019
1011
|
stop() {
|
|
1020
1012
|
this._logger.create("stop"), this._session_state = null, this._timer && (clearInterval(this._timer), this._timer = null);
|
|
1021
1013
|
}
|
|
1022
|
-
},
|
|
1014
|
+
}, fe = class {
|
|
1023
1015
|
constructor() {
|
|
1024
1016
|
this._logger = new f("InMemoryWebStorage"), this._data = {};
|
|
1025
1017
|
}
|
|
@@ -1041,7 +1033,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1041
1033
|
key(e) {
|
|
1042
1034
|
return Object.getOwnPropertyNames(this._data)[e];
|
|
1043
1035
|
}
|
|
1044
|
-
},
|
|
1036
|
+
}, ie = class {
|
|
1045
1037
|
constructor(e = [], t = null) {
|
|
1046
1038
|
this._jwtHandler = t, this._logger = new f("JsonService"), this._contentTypes = [], this._contentTypes.push(...e, "application/json"), t && this._contentTypes.push("application/jwt");
|
|
1047
1039
|
}
|
|
@@ -1056,7 +1048,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1056
1048
|
signal: i.signal
|
|
1057
1049
|
});
|
|
1058
1050
|
} catch (o) {
|
|
1059
|
-
throw o instanceof DOMException && o.name === "AbortError" ? new
|
|
1051
|
+
throw o instanceof DOMException && o.name === "AbortError" ? new re("Network timed out") : o;
|
|
1060
1052
|
} finally {
|
|
1061
1053
|
clearTimeout(n);
|
|
1062
1054
|
}
|
|
@@ -1122,9 +1114,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1122
1114
|
throw n.error("Error from server:", g), g.error ? new j(g, t) : new Error(`${c.statusText} (${c.status}): ${JSON.stringify(g)}`);
|
|
1123
1115
|
return g;
|
|
1124
1116
|
}
|
|
1125
|
-
},
|
|
1117
|
+
}, $e = class {
|
|
1126
1118
|
constructor(e) {
|
|
1127
|
-
this._settings = e, this._logger = new f("MetadataService"), this._jsonService = new
|
|
1119
|
+
this._settings = e, this._logger = new f("MetadataService"), this._jsonService = new ie(["application/jwk-set+json"]), this._signingKeys = null, this._metadata = null, this._metadataUrl = this._settings.metadataUrl, this._settings.signingKeys && (this._logger.debug("using signingKeys from settings"), this._signingKeys = this._settings.signingKeys), this._settings.metadata && (this._logger.debug("using metadata from settings"), this._metadata = this._settings.metadata), this._settings.fetchRequestCredentials && (this._logger.debug("using fetchRequestCredentials from settings"), this._fetchRequestCredentials = this._settings.fetchRequestCredentials);
|
|
1128
1120
|
}
|
|
1129
1121
|
resetSigningKeys() {
|
|
1130
1122
|
this._signingKeys = null;
|
|
@@ -1185,7 +1177,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1185
1177
|
throw e.throw(new Error("Missing keys on keyset")), null;
|
|
1186
1178
|
return this._signingKeys = s.keys, this._signingKeys;
|
|
1187
1179
|
}
|
|
1188
|
-
},
|
|
1180
|
+
}, we = class {
|
|
1189
1181
|
constructor({
|
|
1190
1182
|
prefix: e = "oidc.",
|
|
1191
1183
|
store: t = localStorage
|
|
@@ -1212,7 +1204,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1212
1204
|
}
|
|
1213
1205
|
return t;
|
|
1214
1206
|
}
|
|
1215
|
-
},
|
|
1207
|
+
}, ze = "code", De = "openid", Je = "client_secret_post", Ke = "query", Ve = 60 * 15, Ge = 60 * 5, ve = class {
|
|
1216
1208
|
constructor({
|
|
1217
1209
|
// metadata related
|
|
1218
1210
|
authority: e,
|
|
@@ -1223,11 +1215,11 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1223
1215
|
// client related
|
|
1224
1216
|
client_id: n,
|
|
1225
1217
|
client_secret: o,
|
|
1226
|
-
response_type: c =
|
|
1227
|
-
scope: l =
|
|
1218
|
+
response_type: c = ze,
|
|
1219
|
+
scope: l = De,
|
|
1228
1220
|
redirect_uri: h,
|
|
1229
1221
|
post_logout_redirect_uri: g,
|
|
1230
|
-
client_authentication: u =
|
|
1222
|
+
client_authentication: u = Je,
|
|
1231
1223
|
// optional protocol
|
|
1232
1224
|
prompt: S,
|
|
1233
1225
|
display: w,
|
|
@@ -1235,12 +1227,12 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1235
1227
|
ui_locales: _,
|
|
1236
1228
|
acr_values: m,
|
|
1237
1229
|
resource: y,
|
|
1238
|
-
response_mode: a =
|
|
1230
|
+
response_mode: a = Ke,
|
|
1239
1231
|
// behavior flags
|
|
1240
1232
|
filterProtocolClaims: d = !0,
|
|
1241
1233
|
loadUserInfo: p = !1,
|
|
1242
|
-
staleStateAgeInSeconds: v =
|
|
1243
|
-
clockSkewInSeconds: b =
|
|
1234
|
+
staleStateAgeInSeconds: v = Ve,
|
|
1235
|
+
clockSkewInSeconds: b = Ge,
|
|
1244
1236
|
userInfoJwtIssuer: E = "OP",
|
|
1245
1237
|
mergeClaims: x = !1,
|
|
1246
1238
|
disablePKCE: C = !1,
|
|
@@ -1248,31 +1240,31 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1248
1240
|
stateStore: A,
|
|
1249
1241
|
refreshTokenCredentials: R,
|
|
1250
1242
|
revokeTokenAdditionalContentTypes: q,
|
|
1251
|
-
fetchRequestCredentials:
|
|
1252
|
-
refreshTokenAllowedScope:
|
|
1243
|
+
fetchRequestCredentials: W,
|
|
1244
|
+
refreshTokenAllowedScope: J,
|
|
1253
1245
|
// extra query params
|
|
1254
|
-
extraQueryParams:
|
|
1255
|
-
extraTokenParams:
|
|
1246
|
+
extraQueryParams: K = {},
|
|
1247
|
+
extraTokenParams: V = {}
|
|
1256
1248
|
}) {
|
|
1257
|
-
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = i, this.signingKeys = r, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = h, this.post_logout_redirect_uri = g, this.client_authentication = u, this.prompt = S, this.display = w, this.max_age = k, this.ui_locales = _, this.acr_values = m, this.resource = y, this.response_mode = a, this.filterProtocolClaims = d ?? !0, this.loadUserInfo = !!p, this.staleStateAgeInSeconds = v, this.clockSkewInSeconds = b, this.userInfoJwtIssuer = E, this.mergeClaims = !!x, this.disablePKCE = !!C, this.revokeTokenAdditionalContentTypes = q,
|
|
1249
|
+
if (this.authority = e, t ? this.metadataUrl = t : (this.metadataUrl = e, e && (this.metadataUrl.endsWith("/") || (this.metadataUrl += "/"), this.metadataUrl += ".well-known/openid-configuration")), this.metadata = s, this.metadataSeed = i, this.signingKeys = r, this.client_id = n, this.client_secret = o, this.response_type = c, this.scope = l, this.redirect_uri = h, this.post_logout_redirect_uri = g, this.client_authentication = u, this.prompt = S, this.display = w, this.max_age = k, this.ui_locales = _, this.acr_values = m, this.resource = y, this.response_mode = a, this.filterProtocolClaims = d ?? !0, this.loadUserInfo = !!p, this.staleStateAgeInSeconds = v, this.clockSkewInSeconds = b, this.userInfoJwtIssuer = E, this.mergeClaims = !!x, this.disablePKCE = !!C, this.revokeTokenAdditionalContentTypes = q, W && R && console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."), this.fetchRequestCredentials = W || R || "same-origin", A)
|
|
1258
1250
|
this.stateStore = A;
|
|
1259
1251
|
else {
|
|
1260
|
-
const
|
|
1261
|
-
this.stateStore = new
|
|
1252
|
+
const B = typeof window < "u" ? window.localStorage : new fe();
|
|
1253
|
+
this.stateStore = new we({ store: B });
|
|
1262
1254
|
}
|
|
1263
|
-
this.refreshTokenAllowedScope =
|
|
1255
|
+
this.refreshTokenAllowedScope = J, this.extraQueryParams = K, this.extraTokenParams = V;
|
|
1264
1256
|
}
|
|
1265
|
-
},
|
|
1257
|
+
}, Qe = class {
|
|
1266
1258
|
constructor(e, t) {
|
|
1267
1259
|
this._settings = e, this._metadataService = t, this._logger = new f("UserInfoService"), this._getClaimsFromJwt = async (s) => {
|
|
1268
1260
|
const r = this._logger.create("_getClaimsFromJwt");
|
|
1269
1261
|
try {
|
|
1270
|
-
const i =
|
|
1262
|
+
const i = Z.decode(s);
|
|
1271
1263
|
return r.debug("JWT decoding successful"), i;
|
|
1272
1264
|
} catch (i) {
|
|
1273
1265
|
throw r.error("Error parsing JWT response"), i;
|
|
1274
1266
|
}
|
|
1275
|
-
}, this._jsonService = new
|
|
1267
|
+
}, this._jsonService = new ie(void 0, this._getClaimsFromJwt);
|
|
1276
1268
|
}
|
|
1277
1269
|
async getClaims(e) {
|
|
1278
1270
|
const t = this._logger.create("getClaims");
|
|
@@ -1285,9 +1277,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1285
1277
|
});
|
|
1286
1278
|
return t.debug("got claims", r), r;
|
|
1287
1279
|
}
|
|
1288
|
-
},
|
|
1280
|
+
}, me = class {
|
|
1289
1281
|
constructor(e, t) {
|
|
1290
|
-
this._settings = e, this._metadataService = t, this._logger = new f("TokenClient"), this._jsonService = new
|
|
1282
|
+
this._settings = e, this._metadataService = t, this._logger = new f("TokenClient"), this._jsonService = new ie(this._settings.revokeTokenAdditionalContentTypes);
|
|
1291
1283
|
}
|
|
1292
1284
|
async exchangeCode({
|
|
1293
1285
|
grant_type: e = "authorization_code",
|
|
@@ -1389,7 +1381,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1389
1381
|
o != null && i.set(n, o);
|
|
1390
1382
|
i.set("client_id", this._settings.client_id), this._settings.client_secret && i.set("client_secret", this._settings.client_secret), await this._jsonService.postForm(r, { body: i }), s.debug("got response");
|
|
1391
1383
|
}
|
|
1392
|
-
},
|
|
1384
|
+
}, Xe = [
|
|
1393
1385
|
"nbf",
|
|
1394
1386
|
"jti",
|
|
1395
1387
|
"auth_time",
|
|
@@ -1399,9 +1391,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1399
1391
|
"azp",
|
|
1400
1392
|
"at_hash"
|
|
1401
1393
|
// https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
|
|
1402
|
-
],
|
|
1394
|
+
], Ye = ["sub", "iss", "aud", "exp", "iat"], Ze = class {
|
|
1403
1395
|
constructor(e, t) {
|
|
1404
|
-
this._settings = e, this._metadataService = t, this._logger = new f("ResponseValidator"), this._userInfoService = new
|
|
1396
|
+
this._settings = e, this._metadataService = t, this._logger = new f("ResponseValidator"), this._userInfoService = new Qe(this._settings, this._metadataService), this._tokenClient = new me(this._settings, this._metadataService);
|
|
1405
1397
|
}
|
|
1406
1398
|
async validateSigninResponse(e, t) {
|
|
1407
1399
|
const s = this._logger.create("validateSigninResponse");
|
|
@@ -1453,9 +1445,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1453
1445
|
const t = { ...e };
|
|
1454
1446
|
if (this._settings.filterProtocolClaims) {
|
|
1455
1447
|
let s;
|
|
1456
|
-
Array.isArray(this._settings.filterProtocolClaims) ? s = this._settings.filterProtocolClaims : s =
|
|
1448
|
+
Array.isArray(this._settings.filterProtocolClaims) ? s = this._settings.filterProtocolClaims : s = Xe;
|
|
1457
1449
|
for (const r of s)
|
|
1458
|
-
|
|
1450
|
+
Ye.includes(r) || delete t[r];
|
|
1459
1451
|
}
|
|
1460
1452
|
return t;
|
|
1461
1453
|
}
|
|
@@ -1479,9 +1471,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1479
1471
|
var s;
|
|
1480
1472
|
const r = this._logger.create("_validateIdTokenAttributes");
|
|
1481
1473
|
r.debug("decoding ID Token JWT");
|
|
1482
|
-
const i =
|
|
1474
|
+
const i = Z.decode((s = e.id_token) != null ? s : "");
|
|
1483
1475
|
if (i.sub || r.throw(new Error("ID Token is missing a subject claim")), t) {
|
|
1484
|
-
const n =
|
|
1476
|
+
const n = Z.decode(t);
|
|
1485
1477
|
n.sub !== i.sub && r.throw(new Error("sub in id_token does not match current sub")), n.auth_time && n.auth_time !== i.auth_time && r.throw(new Error("auth_time in id_token does not match original auth_time")), n.azp && n.azp !== i.azp && r.throw(new Error("azp in id_token does not match original azp")), !n.azp && i.azp && r.throw(new Error("azp not in id_token, but present in original id_token"));
|
|
1486
1478
|
}
|
|
1487
1479
|
e.profile = i;
|
|
@@ -1519,7 +1511,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1519
1511
|
l && (s.debug("removed item for key:", o), e.remove(o));
|
|
1520
1512
|
}
|
|
1521
1513
|
}
|
|
1522
|
-
},
|
|
1514
|
+
}, ne = class extends M {
|
|
1523
1515
|
constructor(e) {
|
|
1524
1516
|
super(e), e.code_verifier === !0 ? this.code_verifier = P.generateCodeVerifier() : e.code_verifier && (this.code_verifier = e.code_verifier), this.code_verifier && (this.code_challenge = P.generateCodeChallenge(this.code_verifier)), this.authority = e.authority, this.client_id = e.client_id, this.redirect_uri = e.redirect_uri, this.scope = e.scope, this.client_secret = e.client_secret, this.extraTokenParams = e.extraTokenParams, this.response_mode = e.response_mode, this.skipUserInfo = e.skipUserInfo;
|
|
1525
1517
|
}
|
|
@@ -1543,9 +1535,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1543
1535
|
static fromStorageString(e) {
|
|
1544
1536
|
f.createStatic("SigninState", "fromStorageString");
|
|
1545
1537
|
const t = JSON.parse(e);
|
|
1546
|
-
return new
|
|
1538
|
+
return new ne(t);
|
|
1547
1539
|
}
|
|
1548
|
-
},
|
|
1540
|
+
}, et = class {
|
|
1549
1541
|
constructor({
|
|
1550
1542
|
// mandatory
|
|
1551
1543
|
url: e,
|
|
@@ -1579,7 +1571,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1579
1571
|
throw this._logger.error("ctor: No scope passed"), new Error("scope");
|
|
1580
1572
|
if (!t)
|
|
1581
1573
|
throw this._logger.error("ctor: No authority passed"), new Error("authority");
|
|
1582
|
-
this.state = new
|
|
1574
|
+
this.state = new ne({
|
|
1583
1575
|
data: o,
|
|
1584
1576
|
request_type: l,
|
|
1585
1577
|
code_verifier: !_,
|
|
@@ -1598,7 +1590,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1598
1590
|
d != null && y.searchParams.append(a, d.toString());
|
|
1599
1591
|
this.url = y.href;
|
|
1600
1592
|
}
|
|
1601
|
-
},
|
|
1593
|
+
}, tt = "openid", G = class {
|
|
1602
1594
|
constructor(e) {
|
|
1603
1595
|
this.access_token = "", this.token_type = "", this.profile = {}, this.state = e.get("state"), this.session_state = e.get("session_state"), this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri"), this.code = e.get("code");
|
|
1604
1596
|
}
|
|
@@ -1611,9 +1603,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1611
1603
|
}
|
|
1612
1604
|
get isOpenId() {
|
|
1613
1605
|
var e;
|
|
1614
|
-
return ((e = this.scope) == null ? void 0 : e.split(" ").includes(
|
|
1606
|
+
return ((e = this.scope) == null ? void 0 : e.split(" ").includes(tt)) || !!this.id_token;
|
|
1615
1607
|
}
|
|
1616
|
-
},
|
|
1608
|
+
}, st = class {
|
|
1617
1609
|
constructor({
|
|
1618
1610
|
url: e,
|
|
1619
1611
|
state_data: t,
|
|
@@ -1630,13 +1622,13 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1630
1622
|
l != null && o.searchParams.append(c, l.toString());
|
|
1631
1623
|
this.url = o.href;
|
|
1632
1624
|
}
|
|
1633
|
-
},
|
|
1625
|
+
}, rt = class {
|
|
1634
1626
|
constructor(e) {
|
|
1635
1627
|
this.state = e.get("state"), this.error = e.get("error"), this.error_description = e.get("error_description"), this.error_uri = e.get("error_uri");
|
|
1636
1628
|
}
|
|
1637
|
-
},
|
|
1629
|
+
}, it = class {
|
|
1638
1630
|
constructor(e) {
|
|
1639
|
-
this._logger = new f("OidcClient"), this.settings = new
|
|
1631
|
+
this._logger = new f("OidcClient"), this.settings = new ve(e), this.metadataService = new $e(this.settings), this._validator = new Ze(this.settings, this.metadataService), this._tokenClient = new me(this.settings, this.metadataService);
|
|
1640
1632
|
}
|
|
1641
1633
|
async createSigninRequest({
|
|
1642
1634
|
state: e,
|
|
@@ -1665,7 +1657,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1665
1657
|
throw new Error("Only the Authorization Code flow (with PKCE) is supported");
|
|
1666
1658
|
const v = await this.metadataService.getAuthorizationEndpoint();
|
|
1667
1659
|
p.debug("Received authorization endpoint", v);
|
|
1668
|
-
const b = new
|
|
1660
|
+
const b = new et({
|
|
1669
1661
|
url: v,
|
|
1670
1662
|
authority: this.settings.authority,
|
|
1671
1663
|
client_id: this.settings.client_id,
|
|
@@ -1697,13 +1689,13 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1697
1689
|
return await this.settings.stateStore.set(E.id, E.toStorageString()), b;
|
|
1698
1690
|
}
|
|
1699
1691
|
async readSigninResponseState(e, t = !1) {
|
|
1700
|
-
const s = this._logger.create("readSigninResponseState"), r = new
|
|
1692
|
+
const s = this._logger.create("readSigninResponseState"), r = new G(ee.readParams(e, this.settings.response_mode));
|
|
1701
1693
|
if (!r.state)
|
|
1702
1694
|
throw s.throw(new Error("No state in response")), null;
|
|
1703
1695
|
const i = await this.settings.stateStore[t ? "remove" : "get"](r.state);
|
|
1704
1696
|
if (!i)
|
|
1705
1697
|
throw s.throw(new Error("No matching state found in storage")), null;
|
|
1706
|
-
return { state:
|
|
1698
|
+
return { state: ne.fromStorageString(i), response: r };
|
|
1707
1699
|
}
|
|
1708
1700
|
async processSigninResponse(e) {
|
|
1709
1701
|
const t = this._logger.create("processSigninResponse"), { state: s, response: r } = await this.readSigninResponseState(e, !0);
|
|
@@ -1715,7 +1707,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1715
1707
|
skipUserInfo: s = !1,
|
|
1716
1708
|
extraTokenParams: r = {}
|
|
1717
1709
|
}) {
|
|
1718
|
-
const i = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...r }), n = new
|
|
1710
|
+
const i = await this._tokenClient.exchangeCredentials({ username: e, password: t, ...r }), n = new G(new URLSearchParams());
|
|
1719
1711
|
return Object.assign(n, i), await this._validator.validateCredentialsResponse(n, s), n;
|
|
1720
1712
|
}
|
|
1721
1713
|
async useRefreshToken({
|
|
@@ -1736,7 +1728,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1736
1728
|
// provide the (possible filtered) scope list
|
|
1737
1729
|
scope: i,
|
|
1738
1730
|
timeoutInSeconds: t
|
|
1739
|
-
}), o = new
|
|
1731
|
+
}), o = new G(new URLSearchParams());
|
|
1740
1732
|
return Object.assign(o, n), r.debug("validating response", o), await this._validator.validateRefreshResponse(o, {
|
|
1741
1733
|
...e,
|
|
1742
1734
|
// overide the scope in the state handed over to the validator
|
|
@@ -1755,7 +1747,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1755
1747
|
if (!o)
|
|
1756
1748
|
throw n.throw(new Error("No end session endpoint")), null;
|
|
1757
1749
|
n.debug("Received end session endpoint", o);
|
|
1758
|
-
const c = new
|
|
1750
|
+
const c = new st({
|
|
1759
1751
|
url: o,
|
|
1760
1752
|
id_token_hint: t,
|
|
1761
1753
|
post_logout_redirect_uri: r,
|
|
@@ -1768,7 +1760,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1768
1760
|
return l && (n.debug("Signout request has state to persist"), await this.settings.stateStore.set(l.id, l.toStorageString())), c;
|
|
1769
1761
|
}
|
|
1770
1762
|
async readSignoutResponseState(e, t = !1) {
|
|
1771
|
-
const s = this._logger.create("readSignoutResponseState"), r = new
|
|
1763
|
+
const s = this._logger.create("readSignoutResponseState"), r = new rt(ee.readParams(e, this.settings.response_mode));
|
|
1772
1764
|
if (!r.state) {
|
|
1773
1765
|
if (s.debug("No state in response"), r.error)
|
|
1774
1766
|
throw s.warn("Response was error:", r.error), new j(r);
|
|
@@ -1792,7 +1784,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1792
1784
|
token_type_hint: t
|
|
1793
1785
|
});
|
|
1794
1786
|
}
|
|
1795
|
-
},
|
|
1787
|
+
}, nt = class {
|
|
1796
1788
|
constructor(e) {
|
|
1797
1789
|
this._userManager = e, this._logger = new f("SessionMonitor"), this._start = async (t) => {
|
|
1798
1790
|
const s = t.session_state;
|
|
@@ -1807,7 +1799,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1807
1799
|
const i = await this._userManager.metadataService.getCheckSessionIframe();
|
|
1808
1800
|
if (i) {
|
|
1809
1801
|
r.debug("initializing check session iframe");
|
|
1810
|
-
const n = this._userManager.settings.client_id, o = this._userManager.settings.checkSessionIntervalInSeconds, c = this._userManager.settings.stopCheckSessionOnError, l = new
|
|
1802
|
+
const n = this._userManager.settings.client_id, o = this._userManager.settings.checkSessionIntervalInSeconds, c = this._userManager.settings.stopCheckSessionOnError, l = new Fe(this._callback, n, i, o, c);
|
|
1811
1803
|
await l.load(), this._checkSessionIFrame = l, l.start(s);
|
|
1812
1804
|
} else
|
|
1813
1805
|
r.warn("no check session iframe found in the metadata");
|
|
@@ -1868,7 +1860,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1868
1860
|
}
|
|
1869
1861
|
}
|
|
1870
1862
|
}
|
|
1871
|
-
},
|
|
1863
|
+
}, L = class {
|
|
1872
1864
|
constructor(e) {
|
|
1873
1865
|
var t;
|
|
1874
1866
|
this.id_token = e.id_token, this.session_state = (t = e.session_state) != null ? t : null, this.access_token = e.access_token, this.refresh_token = e.refresh_token, this.token_type = e.token_type, this.scope = e.scope, this.profile = e.profile, this.expires_at = e.expires_at, this.state = e.userState;
|
|
@@ -1905,9 +1897,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1905
1897
|
});
|
|
1906
1898
|
}
|
|
1907
1899
|
static fromStorageString(e) {
|
|
1908
|
-
return f.createStatic("User", "fromStorageString"), new
|
|
1900
|
+
return f.createStatic("User", "fromStorageString"), new L(JSON.parse(e));
|
|
1909
1901
|
}
|
|
1910
|
-
},
|
|
1902
|
+
}, de = "oidc-client", Se = class {
|
|
1911
1903
|
constructor() {
|
|
1912
1904
|
this._abort = new O("Window navigation aborted"), this._disposeHandlers = /* @__PURE__ */ new Set(), this._window = null;
|
|
1913
1905
|
}
|
|
@@ -1920,9 +1912,9 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1920
1912
|
const o = (c) => {
|
|
1921
1913
|
var l;
|
|
1922
1914
|
const h = c.data, g = (l = e.scriptOrigin) != null ? l : window.location.origin;
|
|
1923
|
-
if (!(c.origin !== g || (h == null ? void 0 : h.source) !==
|
|
1915
|
+
if (!(c.origin !== g || (h == null ? void 0 : h.source) !== de)) {
|
|
1924
1916
|
try {
|
|
1925
|
-
const u =
|
|
1917
|
+
const u = ee.readParams(h.url, e.response_mode).get("state");
|
|
1926
1918
|
if (u || t.warn("no state found in response url"), c.source !== this._window && u !== e.state)
|
|
1927
1919
|
return;
|
|
1928
1920
|
} catch {
|
|
@@ -1945,54 +1937,54 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1945
1937
|
}
|
|
1946
1938
|
static _notifyParent(e, t, s = !1, r = window.location.origin) {
|
|
1947
1939
|
e.postMessage({
|
|
1948
|
-
source:
|
|
1940
|
+
source: de,
|
|
1949
1941
|
url: t,
|
|
1950
1942
|
keepOpen: s
|
|
1951
1943
|
}, r);
|
|
1952
1944
|
}
|
|
1953
|
-
},
|
|
1945
|
+
}, ye = {
|
|
1954
1946
|
location: !1,
|
|
1955
1947
|
toolbar: !1,
|
|
1956
1948
|
height: 640
|
|
1957
|
-
},
|
|
1949
|
+
}, be = "_blank", ot = 60, at = 2, ke = 10, ct = class extends ve {
|
|
1958
1950
|
constructor(e) {
|
|
1959
1951
|
const {
|
|
1960
1952
|
popup_redirect_uri: t = e.redirect_uri,
|
|
1961
1953
|
popup_post_logout_redirect_uri: s = e.post_logout_redirect_uri,
|
|
1962
|
-
popupWindowFeatures: r =
|
|
1963
|
-
popupWindowTarget: i =
|
|
1954
|
+
popupWindowFeatures: r = ye,
|
|
1955
|
+
popupWindowTarget: i = be,
|
|
1964
1956
|
redirectMethod: n = "assign",
|
|
1965
1957
|
redirectTarget: o = "self",
|
|
1966
1958
|
iframeNotifyParentOrigin: c = e.iframeNotifyParentOrigin,
|
|
1967
1959
|
iframeScriptOrigin: l = e.iframeScriptOrigin,
|
|
1968
1960
|
silent_redirect_uri: h = e.redirect_uri,
|
|
1969
|
-
silentRequestTimeoutInSeconds: g =
|
|
1961
|
+
silentRequestTimeoutInSeconds: g = ke,
|
|
1970
1962
|
automaticSilentRenew: u = !0,
|
|
1971
1963
|
validateSubOnSilentRenew: S = !0,
|
|
1972
1964
|
includeIdTokenInSilentRenew: w = !1,
|
|
1973
1965
|
monitorSession: k = !1,
|
|
1974
1966
|
monitorAnonymousSession: _ = !1,
|
|
1975
|
-
checkSessionIntervalInSeconds: m =
|
|
1967
|
+
checkSessionIntervalInSeconds: m = at,
|
|
1976
1968
|
query_status_response_type: y = "code",
|
|
1977
1969
|
stopCheckSessionOnError: a = !0,
|
|
1978
1970
|
revokeTokenTypes: d = ["access_token", "refresh_token"],
|
|
1979
1971
|
revokeTokensOnSignout: p = !1,
|
|
1980
1972
|
includeIdTokenInSilentSignout: v = !1,
|
|
1981
|
-
accessTokenExpiringNotificationTimeInSeconds: b =
|
|
1973
|
+
accessTokenExpiringNotificationTimeInSeconds: b = ot,
|
|
1982
1974
|
userStore: E
|
|
1983
1975
|
} = e;
|
|
1984
1976
|
if (super(e), this.popup_redirect_uri = t, this.popup_post_logout_redirect_uri = s, this.popupWindowFeatures = r, this.popupWindowTarget = i, this.redirectMethod = n, this.redirectTarget = o, this.iframeNotifyParentOrigin = c, this.iframeScriptOrigin = l, this.silent_redirect_uri = h, this.silentRequestTimeoutInSeconds = g, this.automaticSilentRenew = u, this.validateSubOnSilentRenew = S, this.includeIdTokenInSilentRenew = w, this.monitorSession = k, this.monitorAnonymousSession = _, this.checkSessionIntervalInSeconds = m, this.stopCheckSessionOnError = a, this.query_status_response_type = y, this.revokeTokenTypes = d, this.revokeTokensOnSignout = p, this.includeIdTokenInSilentSignout = v, this.accessTokenExpiringNotificationTimeInSeconds = b, E)
|
|
1985
1977
|
this.userStore = E;
|
|
1986
1978
|
else {
|
|
1987
|
-
const x = typeof window < "u" ? window.sessionStorage : new
|
|
1988
|
-
this.userStore = new
|
|
1979
|
+
const x = typeof window < "u" ? window.sessionStorage : new fe();
|
|
1980
|
+
this.userStore = new we({ store: x });
|
|
1989
1981
|
}
|
|
1990
1982
|
}
|
|
1991
|
-
},
|
|
1983
|
+
}, te = class extends Se {
|
|
1992
1984
|
constructor({
|
|
1993
|
-
silentRequestTimeoutInSeconds: e =
|
|
1985
|
+
silentRequestTimeoutInSeconds: e = ke
|
|
1994
1986
|
}) {
|
|
1995
|
-
super(), this._logger = new f("IFrameWindow"), this._timeoutInSeconds = e, this._frame =
|
|
1987
|
+
super(), this._logger = new f("IFrameWindow"), this._timeoutInSeconds = e, this._frame = te.createHiddenIframe(), this._window = this._frame.contentWindow;
|
|
1996
1988
|
}
|
|
1997
1989
|
static createHiddenIframe() {
|
|
1998
1990
|
const e = window.document.createElement("iframe");
|
|
@@ -2000,7 +1992,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2000
1992
|
}
|
|
2001
1993
|
async navigate(e) {
|
|
2002
1994
|
this._logger.debug("navigate: Using timeout of:", this._timeoutInSeconds);
|
|
2003
|
-
const t = setTimeout(() => this._abort.raise(new
|
|
1995
|
+
const t = setTimeout(() => this._abort.raise(new re("IFrame timed out without a response")), this._timeoutInSeconds * 1e3);
|
|
2004
1996
|
return this._disposeHandlers.add(() => clearTimeout(t)), await super.navigate(e);
|
|
2005
1997
|
}
|
|
2006
1998
|
close() {
|
|
@@ -2014,33 +2006,33 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2014
2006
|
static notifyParent(e, t) {
|
|
2015
2007
|
return super._notifyParent(window.parent, e, !1, t);
|
|
2016
2008
|
}
|
|
2017
|
-
},
|
|
2009
|
+
}, lt = class {
|
|
2018
2010
|
constructor(e) {
|
|
2019
2011
|
this._settings = e, this._logger = new f("IFrameNavigator");
|
|
2020
2012
|
}
|
|
2021
2013
|
async prepare({
|
|
2022
2014
|
silentRequestTimeoutInSeconds: e = this._settings.silentRequestTimeoutInSeconds
|
|
2023
2015
|
}) {
|
|
2024
|
-
return new
|
|
2016
|
+
return new te({ silentRequestTimeoutInSeconds: e });
|
|
2025
2017
|
}
|
|
2026
2018
|
async callback(e) {
|
|
2027
|
-
this._logger.create("callback"),
|
|
2019
|
+
this._logger.create("callback"), te.notifyParent(e, this._settings.iframeNotifyParentOrigin);
|
|
2028
2020
|
}
|
|
2029
|
-
},
|
|
2021
|
+
}, dt = 500, he = class extends Se {
|
|
2030
2022
|
constructor({
|
|
2031
|
-
popupWindowTarget: e =
|
|
2023
|
+
popupWindowTarget: e = be,
|
|
2032
2024
|
popupWindowFeatures: t = {}
|
|
2033
2025
|
}) {
|
|
2034
2026
|
super(), this._logger = new f("PopupWindow");
|
|
2035
|
-
const s =
|
|
2036
|
-
this._window = window.open(void 0, e,
|
|
2027
|
+
const s = le.center({ ...ye, ...t });
|
|
2028
|
+
this._window = window.open(void 0, e, le.serialize(s));
|
|
2037
2029
|
}
|
|
2038
2030
|
async navigate(e) {
|
|
2039
2031
|
var t;
|
|
2040
2032
|
(t = this._window) == null || t.focus();
|
|
2041
2033
|
const s = setInterval(() => {
|
|
2042
2034
|
(!this._window || this._window.closed) && this._abort.raise(new Error("Popup closed by user"));
|
|
2043
|
-
},
|
|
2035
|
+
}, dt);
|
|
2044
2036
|
return this._disposeHandlers.add(() => clearInterval(s)), await super.navigate(e);
|
|
2045
2037
|
}
|
|
2046
2038
|
close() {
|
|
@@ -2051,7 +2043,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2051
2043
|
throw new Error("No window.opener. Can't complete notification.");
|
|
2052
2044
|
return super._notifyParent(window.opener, e, t);
|
|
2053
2045
|
}
|
|
2054
|
-
},
|
|
2046
|
+
}, ht = class {
|
|
2055
2047
|
constructor(e) {
|
|
2056
2048
|
this._settings = e, this._logger = new f("PopupNavigator");
|
|
2057
2049
|
}
|
|
@@ -2059,12 +2051,12 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2059
2051
|
popupWindowFeatures: e = this._settings.popupWindowFeatures,
|
|
2060
2052
|
popupWindowTarget: t = this._settings.popupWindowTarget
|
|
2061
2053
|
}) {
|
|
2062
|
-
return new
|
|
2054
|
+
return new he({ popupWindowFeatures: e, popupWindowTarget: t });
|
|
2063
2055
|
}
|
|
2064
2056
|
async callback(e, t = !1) {
|
|
2065
|
-
this._logger.create("callback"),
|
|
2057
|
+
this._logger.create("callback"), he.notifyOpener(e, t);
|
|
2066
2058
|
}
|
|
2067
|
-
},
|
|
2059
|
+
}, ut = class {
|
|
2068
2060
|
constructor(e) {
|
|
2069
2061
|
this._settings = e, this._logger = new f("RedirectNavigator");
|
|
2070
2062
|
}
|
|
@@ -2091,7 +2083,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2091
2083
|
}
|
|
2092
2084
|
};
|
|
2093
2085
|
}
|
|
2094
|
-
},
|
|
2086
|
+
}, gt = class extends Le {
|
|
2095
2087
|
constructor(e) {
|
|
2096
2088
|
super({ expiringNotificationTimeInSeconds: e.accessTokenExpiringNotificationTimeInSeconds }), this._logger = new f("UserManagerEvents"), this._userLoaded = new O("User loaded"), this._userUnloaded = new O("User unloaded"), this._silentRenewError = new O("Silent renew error"), this._userSignedIn = new O("User signed in"), this._userSignedOut = new O("User signed out"), this._userSessionChanged = new O("User session changed");
|
|
2097
2089
|
}
|
|
@@ -2200,14 +2192,14 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2200
2192
|
_raiseUserSessionChanged() {
|
|
2201
2193
|
this._userSessionChanged.raise();
|
|
2202
2194
|
}
|
|
2203
|
-
},
|
|
2195
|
+
}, _t = class {
|
|
2204
2196
|
constructor(e) {
|
|
2205
2197
|
this._userManager = e, this._logger = new f("SilentRenewService"), this._isStarted = !1, this._retryTimer = new T("Retry Silent Renew"), this._tokenExpiring = async () => {
|
|
2206
2198
|
const t = this._logger.create("_tokenExpiring");
|
|
2207
2199
|
try {
|
|
2208
2200
|
await this._userManager.signinSilent(), t.debug("silent token renewal successful");
|
|
2209
2201
|
} catch (s) {
|
|
2210
|
-
if (s instanceof
|
|
2202
|
+
if (s instanceof re) {
|
|
2211
2203
|
t.warn("ErrorTimeout from signinSilent:", s, "retry in 5s"), this._retryTimer.init(5);
|
|
2212
2204
|
return;
|
|
2213
2205
|
}
|
|
@@ -2229,13 +2221,13 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2229
2221
|
stop() {
|
|
2230
2222
|
this._isStarted && (this._retryTimer.cancel(), this._retryTimer.removeHandler(this._tokenExpiring), this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring), this._isStarted = !1);
|
|
2231
2223
|
}
|
|
2232
|
-
},
|
|
2224
|
+
}, pt = class {
|
|
2233
2225
|
constructor(e) {
|
|
2234
2226
|
this.refresh_token = e.refresh_token, this.id_token = e.id_token, this.session_state = e.session_state, this.scope = e.scope, this.profile = e.profile, this.data = e.state;
|
|
2235
2227
|
}
|
|
2236
|
-
},
|
|
2228
|
+
}, xt = class {
|
|
2237
2229
|
constructor(e) {
|
|
2238
|
-
this._logger = new f("UserManager"), this.settings = new
|
|
2230
|
+
this._logger = new f("UserManager"), this.settings = new ct(e), this._client = new it(e), this._redirectNavigator = new ut(this.settings), this._popupNavigator = new ht(this.settings), this._iframeNavigator = new lt(this.settings), this._events = new gt(this.settings), this._silentRenewService = new _t(this), this.settings.automaticSilentRenew && this.startSilentRenew(), this._sessionMonitor = null, this.settings.monitorSession && (this._sessionMonitor = new nt(this));
|
|
2239
2231
|
}
|
|
2240
2232
|
/** Returns an object used to register for events raised by the `UserManager`. */
|
|
2241
2233
|
get events() {
|
|
@@ -2333,7 +2325,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2333
2325
|
let n = await this._loadUser();
|
|
2334
2326
|
if (n != null && n.refresh_token) {
|
|
2335
2327
|
s.debug("using refresh token");
|
|
2336
|
-
const h = new
|
|
2328
|
+
const h = new pt(n);
|
|
2337
2329
|
return await this._useRefreshToken(h);
|
|
2338
2330
|
}
|
|
2339
2331
|
const o = this.settings.silent_redirect_uri;
|
|
@@ -2353,7 +2345,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2353
2345
|
const t = await this._client.useRefreshToken({
|
|
2354
2346
|
state: e,
|
|
2355
2347
|
timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds
|
|
2356
|
-
}), s = new
|
|
2348
|
+
}), s = new L({ ...e, ...t });
|
|
2357
2349
|
return await this.storeUser(s), this._events.load(s), s;
|
|
2358
2350
|
}
|
|
2359
2351
|
/**
|
|
@@ -2458,7 +2450,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2458
2450
|
return s.debug("got signin response"), await this._buildUser(r, t);
|
|
2459
2451
|
}
|
|
2460
2452
|
async _buildUser(e, t) {
|
|
2461
|
-
const s = this._logger.create("_buildUser"), r = new
|
|
2453
|
+
const s = this._logger.create("_buildUser"), r = new L(e);
|
|
2462
2454
|
if (t) {
|
|
2463
2455
|
if (t !== r.profile.sub)
|
|
2464
2456
|
throw s.debug("current user does not match user returned from signin. sub from signin:", r.profile.sub), new j({ ...e, error: "login_required" });
|
|
@@ -2601,7 +2593,7 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2601
2593
|
}
|
|
2602
2594
|
async _loadUser() {
|
|
2603
2595
|
const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
|
|
2604
|
-
return t ? (e.debug("user storageString loaded"),
|
|
2596
|
+
return t ? (e.debug("user storageString loaded"), L.fromStorageString(t)) : (e.debug("no user storageString"), null);
|
|
2605
2597
|
}
|
|
2606
2598
|
async storeUser(e) {
|
|
2607
2599
|
const t = this._logger.create("storeUser");
|
|
@@ -2618,56 +2610,56 @@ var De = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2618
2610
|
async clearStaleState() {
|
|
2619
2611
|
await this._client.clearStaleState();
|
|
2620
2612
|
}
|
|
2621
|
-
},
|
|
2622
|
-
const
|
|
2613
|
+
}, ft = "2.2.2", Ct = ft;
|
|
2614
|
+
const Ee = ue(
|
|
2623
2615
|
null
|
|
2624
|
-
),
|
|
2625
|
-
const e =
|
|
2616
|
+
), wt = () => {
|
|
2617
|
+
const e = ge(Ee);
|
|
2626
2618
|
if (!e)
|
|
2627
2619
|
throw new Error(
|
|
2628
2620
|
"useImpersonationContext must be used within a ImpersonationContextProvider"
|
|
2629
2621
|
);
|
|
2630
2622
|
return e;
|
|
2631
|
-
},
|
|
2623
|
+
}, Rt = ({
|
|
2632
2624
|
children: e
|
|
2633
2625
|
}) => {
|
|
2634
|
-
const [t, s] =
|
|
2626
|
+
const [t, s] = Re("impersonationState", {
|
|
2635
2627
|
defaultValue: {}
|
|
2636
|
-
}), r =
|
|
2628
|
+
}), r = _e(() => ({
|
|
2637
2629
|
accessToken: t == null ? void 0 : t.accessToken,
|
|
2638
2630
|
userInfo: t == null ? void 0 : t.userInfo,
|
|
2639
2631
|
setImpersonation: (i, n) => {
|
|
2640
2632
|
s({ accessToken: i, userInfo: n });
|
|
2641
2633
|
}
|
|
2642
2634
|
}), []);
|
|
2643
|
-
return /* @__PURE__ */
|
|
2644
|
-
},
|
|
2635
|
+
return /* @__PURE__ */ se.jsx(Ee.Provider, { value: r, children: e });
|
|
2636
|
+
}, vt = (e) => {
|
|
2645
2637
|
const s = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), r = atob(s);
|
|
2646
2638
|
return JSON.parse(r);
|
|
2647
|
-
},
|
|
2648
|
-
const { setImpersonation: t } =
|
|
2649
|
-
|
|
2639
|
+
}, Tt = (e) => {
|
|
2640
|
+
const { setImpersonation: t } = wt();
|
|
2641
|
+
F(() => {
|
|
2650
2642
|
const { search: s } = window.location, r = new URLSearchParams(s).get(
|
|
2651
2643
|
"impersonateAccessToken"
|
|
2652
2644
|
);
|
|
2653
2645
|
if (r && t) {
|
|
2654
|
-
const i =
|
|
2646
|
+
const i = vt(r);
|
|
2655
2647
|
t(r, i), e();
|
|
2656
2648
|
}
|
|
2657
2649
|
}, []);
|
|
2658
|
-
},
|
|
2650
|
+
}, mt = ({
|
|
2659
2651
|
userManager: e,
|
|
2660
2652
|
context: t,
|
|
2661
2653
|
children: s
|
|
2662
2654
|
}) => {
|
|
2663
|
-
const [r, i] =
|
|
2655
|
+
const [r, i] = Ce({
|
|
2664
2656
|
user: null,
|
|
2665
2657
|
isLoading: !0,
|
|
2666
2658
|
isAuthenticated: !1,
|
|
2667
2659
|
isError: !1,
|
|
2668
2660
|
error: null
|
|
2669
|
-
}), n =
|
|
2670
|
-
|
|
2661
|
+
}), n = pe(!1);
|
|
2662
|
+
F(() => {
|
|
2671
2663
|
n.current || (n.current = !0, (async () => {
|
|
2672
2664
|
try {
|
|
2673
2665
|
const h = await e.getUser();
|
|
@@ -2688,7 +2680,7 @@ const Ce = _e(
|
|
|
2688
2680
|
});
|
|
2689
2681
|
}
|
|
2690
2682
|
})());
|
|
2691
|
-
}, [e]),
|
|
2683
|
+
}, [e]), F(() => {
|
|
2692
2684
|
const h = (S) => {
|
|
2693
2685
|
i({
|
|
2694
2686
|
user: S,
|
|
@@ -2719,7 +2711,7 @@ const Ce = _e(
|
|
|
2719
2711
|
e.events.removeUserLoaded(h), e.events.removeUserUnloaded(g), e.events.removeSilentRenewError(u);
|
|
2720
2712
|
};
|
|
2721
2713
|
}, [e]);
|
|
2722
|
-
const o =
|
|
2714
|
+
const o = ae(async () => {
|
|
2723
2715
|
const h = await e.signinCallback();
|
|
2724
2716
|
return i({
|
|
2725
2717
|
user: h ?? null,
|
|
@@ -2728,7 +2720,7 @@ const Ce = _e(
|
|
|
2728
2720
|
isError: !1,
|
|
2729
2721
|
error: null
|
|
2730
2722
|
}), h ?? void 0;
|
|
2731
|
-
}, [e]), c =
|
|
2723
|
+
}, [e]), c = ae(
|
|
2732
2724
|
async (h) => {
|
|
2733
2725
|
try {
|
|
2734
2726
|
await e.signinRedirect(h);
|
|
@@ -2737,7 +2729,7 @@ const Ce = _e(
|
|
|
2737
2729
|
}
|
|
2738
2730
|
},
|
|
2739
2731
|
[e]
|
|
2740
|
-
), l =
|
|
2732
|
+
), l = _e(
|
|
2741
2733
|
() => ({
|
|
2742
2734
|
state: r,
|
|
2743
2735
|
handleSigninCallback: o,
|
|
@@ -2745,32 +2737,32 @@ const Ce = _e(
|
|
|
2745
2737
|
}),
|
|
2746
2738
|
[r, o, c]
|
|
2747
2739
|
);
|
|
2748
|
-
return /* @__PURE__ */
|
|
2749
|
-
},
|
|
2750
|
-
const t =
|
|
2740
|
+
return /* @__PURE__ */ se.jsx(t.Provider, { value: l, children: s });
|
|
2741
|
+
}, oe = (e) => {
|
|
2742
|
+
const t = ge(e);
|
|
2751
2743
|
if (!t)
|
|
2752
2744
|
throw new Error("useAuthContext must be used within an AuthProvider");
|
|
2753
2745
|
return t;
|
|
2754
|
-
},
|
|
2755
|
-
const { state: t } =
|
|
2746
|
+
}, St = (e) => {
|
|
2747
|
+
const { state: t } = oe(e);
|
|
2756
2748
|
return t;
|
|
2757
|
-
},
|
|
2758
|
-
const { state: s, handleSigninCallback: r } =
|
|
2759
|
-
return
|
|
2749
|
+
}, yt = (e, t) => {
|
|
2750
|
+
const { state: s, handleSigninCallback: r } = oe(e), i = pe(!1);
|
|
2751
|
+
return F(() => {
|
|
2760
2752
|
i.current || (i.current = !0, r().then(
|
|
2761
2753
|
(n) => new Promise(
|
|
2762
2754
|
(o) => setTimeout(() => o(n), 0)
|
|
2763
2755
|
)
|
|
2764
2756
|
).then((n) => t == null ? void 0 : t(n)));
|
|
2765
2757
|
}, [r]), s;
|
|
2766
|
-
},
|
|
2767
|
-
const t =
|
|
2758
|
+
}, It = (e) => {
|
|
2759
|
+
const t = ue(null);
|
|
2768
2760
|
return {
|
|
2769
2761
|
AuthContext: t,
|
|
2770
|
-
AuthProvider: ({ children: c }) => /* @__PURE__ */
|
|
2771
|
-
useAuthContext: () =>
|
|
2772
|
-
useAuthState: () =>
|
|
2773
|
-
useSigninCallback: (c) =>
|
|
2762
|
+
AuthProvider: ({ children: c }) => /* @__PURE__ */ se.jsx(mt, { userManager: e, context: t, children: c }),
|
|
2763
|
+
useAuthContext: () => oe(t),
|
|
2764
|
+
useAuthState: () => St(t),
|
|
2765
|
+
useSigninCallback: (c) => yt(t, c),
|
|
2774
2766
|
getAccessToken: async () => {
|
|
2775
2767
|
const c = await e.getUser();
|
|
2776
2768
|
return c ? c.access_token : null;
|
|
@@ -2778,28 +2770,28 @@ const Ce = _e(
|
|
|
2778
2770
|
};
|
|
2779
2771
|
};
|
|
2780
2772
|
export {
|
|
2781
|
-
|
|
2782
|
-
|
|
2773
|
+
Le as AccessTokenEvents,
|
|
2774
|
+
Fe as CheckSessionIFrame,
|
|
2783
2775
|
j as ErrorResponse,
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2776
|
+
re as ErrorTimeout,
|
|
2777
|
+
Rt as ImpersonationContextProvider,
|
|
2778
|
+
fe as InMemoryWebStorage,
|
|
2787
2779
|
D as Log,
|
|
2788
2780
|
f as Logger,
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2781
|
+
$e as MetadataService,
|
|
2782
|
+
it as OidcClient,
|
|
2783
|
+
ve as OidcClientSettingsStore,
|
|
2784
|
+
nt as SessionMonitor,
|
|
2785
|
+
G as SigninResponse,
|
|
2786
|
+
ne as SigninState,
|
|
2787
|
+
rt as SignoutResponse,
|
|
2796
2788
|
M as State,
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2789
|
+
L as User,
|
|
2790
|
+
xt as UserManager,
|
|
2791
|
+
ct as UserManagerSettingsStore,
|
|
2792
|
+
Ct as Version,
|
|
2793
|
+
we as WebStorageStateStore,
|
|
2794
|
+
It as createAuthContext,
|
|
2795
|
+
Tt as useImpersonationCallback,
|
|
2796
|
+
wt as useImpersonationContext
|
|
2805
2797
|
};
|