@arkitektbedriftene/fe-lib 0.2.16 → 0.2.18
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/lib/oidc/firmAccess.d.ts +8 -0
- package/dist/lib/oidc/oidc.d.ts +1 -0
- package/dist/oidc.es.js +105 -91
- package/package.json +1 -1
- package/src/lib/colors/colors.ts +3 -0
- package/src/lib/oidc/firmAccess.ts +34 -0
- package/src/lib/oidc/oidc.tsx +1 -1
package/dist/lib/oidc/oidc.d.ts
CHANGED
package/dist/oidc.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as se } from "./jsx-runtime-a0589023.js";
|
|
2
|
-
import { createContext as ue, useContext as ge, useMemo as _e, useEffect as
|
|
2
|
+
import { createContext as ue, useContext as ge, useMemo as _e, useEffect as L, useState as Ce, useRef as pe, useCallback as ae } from "react";
|
|
3
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
5
|
function Te(e) {
|
|
@@ -40,10 +40,10 @@ var H = {}, Ue = {
|
|
|
40
40
|
H = e;
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
const
|
|
43
|
+
const Ae = {}, Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
44
44
|
__proto__: null,
|
|
45
|
-
default:
|
|
46
|
-
}, Symbol.toStringTag, { value: "Module" })), Oe = /* @__PURE__ */ Te(
|
|
45
|
+
default: Ae
|
|
46
|
+
}, Symbol.toStringTag, { value: "Module" })), Oe = /* @__PURE__ */ Te(Pe);
|
|
47
47
|
(function(e, t) {
|
|
48
48
|
(function(s, r) {
|
|
49
49
|
e.exports = r();
|
|
@@ -205,15 +205,15 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
205
205
|
* wordArray1.concat(wordArray2);
|
|
206
206
|
*/
|
|
207
207
|
concat: function(a) {
|
|
208
|
-
var d = this.words, p = a.words,
|
|
209
|
-
if (this.clamp(),
|
|
208
|
+
var d = this.words, p = a.words, m = this.sigBytes, b = a.sigBytes;
|
|
209
|
+
if (this.clamp(), m % 4)
|
|
210
210
|
for (var E = 0; E < b; E++) {
|
|
211
211
|
var x = p[E >>> 2] >>> 24 - E % 4 * 8 & 255;
|
|
212
|
-
d[
|
|
212
|
+
d[m + E >>> 2] |= x << 24 - (m + E) % 4 * 8;
|
|
213
213
|
}
|
|
214
214
|
else
|
|
215
215
|
for (var C = 0; C < b; C += 4)
|
|
216
|
-
d[
|
|
216
|
+
d[m + C >>> 2] = p[C >>> 2];
|
|
217
217
|
return this.sigBytes += b, this;
|
|
218
218
|
},
|
|
219
219
|
/**
|
|
@@ -273,11 +273,11 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
273
273
|
* var hexString = CryptoJS.enc.Hex.stringify(wordArray);
|
|
274
274
|
*/
|
|
275
275
|
stringify: function(a) {
|
|
276
|
-
for (var d = a.words, p = a.sigBytes,
|
|
276
|
+
for (var d = a.words, p = a.sigBytes, m = [], b = 0; b < p; b++) {
|
|
277
277
|
var E = d[b >>> 2] >>> 24 - b % 4 * 8 & 255;
|
|
278
|
-
|
|
278
|
+
m.push((E >>> 4).toString(16)), m.push((E & 15).toString(16));
|
|
279
279
|
}
|
|
280
|
-
return
|
|
280
|
+
return m.join("");
|
|
281
281
|
},
|
|
282
282
|
/**
|
|
283
283
|
* Converts a hex string to a word array.
|
|
@@ -293,8 +293,8 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
293
293
|
* var wordArray = CryptoJS.enc.Hex.parse(hexString);
|
|
294
294
|
*/
|
|
295
295
|
parse: function(a) {
|
|
296
|
-
for (var d = a.length, p = [],
|
|
297
|
-
p[
|
|
296
|
+
for (var d = a.length, p = [], m = 0; m < d; m += 2)
|
|
297
|
+
p[m >>> 3] |= parseInt(a.substr(m, 2), 16) << 24 - m % 8 * 4;
|
|
298
298
|
return new u.init(p, d / 2);
|
|
299
299
|
}
|
|
300
300
|
}, k = S.Latin1 = {
|
|
@@ -312,11 +312,11 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
312
312
|
* var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
|
|
313
313
|
*/
|
|
314
314
|
stringify: function(a) {
|
|
315
|
-
for (var d = a.words, p = a.sigBytes,
|
|
315
|
+
for (var d = a.words, p = a.sigBytes, m = [], b = 0; b < p; b++) {
|
|
316
316
|
var E = d[b >>> 2] >>> 24 - b % 4 * 8 & 255;
|
|
317
|
-
|
|
317
|
+
m.push(String.fromCharCode(E));
|
|
318
318
|
}
|
|
319
|
-
return
|
|
319
|
+
return m.join("");
|
|
320
320
|
},
|
|
321
321
|
/**
|
|
322
322
|
* Converts a Latin1 string to a word array.
|
|
@@ -332,8 +332,8 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
332
332
|
* var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
|
|
333
333
|
*/
|
|
334
334
|
parse: function(a) {
|
|
335
|
-
for (var d = a.length, p = [],
|
|
336
|
-
p[
|
|
335
|
+
for (var d = a.length, p = [], m = 0; m < d; m++)
|
|
336
|
+
p[m >>> 2] |= (a.charCodeAt(m) & 255) << 24 - m % 4 * 8;
|
|
337
337
|
return new u.init(p, d);
|
|
338
338
|
}
|
|
339
339
|
}, _ = S.Utf8 = {
|
|
@@ -373,7 +373,7 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
373
373
|
parse: function(a) {
|
|
374
374
|
return k.parse(unescape(encodeURIComponent(a)));
|
|
375
375
|
}
|
|
376
|
-
},
|
|
376
|
+
}, v = h.BufferedBlockAlgorithm = g.extend({
|
|
377
377
|
/**
|
|
378
378
|
* Resets this block algorithm's data buffer to its initial state.
|
|
379
379
|
*
|
|
@@ -412,13 +412,13 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
412
412
|
* var processedData = bufferedBlockAlgorithm._process(!!'flush');
|
|
413
413
|
*/
|
|
414
414
|
_process: function(a) {
|
|
415
|
-
var d, p = this._data,
|
|
415
|
+
var d, p = this._data, m = p.words, b = p.sigBytes, E = this.blockSize, x = E * 4, C = b / x;
|
|
416
416
|
a ? C = r.ceil(C) : C = r.max((C | 0) - this._minBufferSize, 0);
|
|
417
|
-
var
|
|
418
|
-
if (
|
|
419
|
-
for (var q = 0; q <
|
|
420
|
-
this._doProcessBlock(
|
|
421
|
-
d =
|
|
417
|
+
var P = C * E, R = r.min(P * 4, b);
|
|
418
|
+
if (P) {
|
|
419
|
+
for (var q = 0; q < P; q += E)
|
|
420
|
+
this._doProcessBlock(m, q);
|
|
421
|
+
d = m.splice(0, P), p.sigBytes -= R;
|
|
422
422
|
}
|
|
423
423
|
return new u.init(d, R);
|
|
424
424
|
},
|
|
@@ -437,7 +437,7 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
437
437
|
},
|
|
438
438
|
_minBufferSize: 0
|
|
439
439
|
});
|
|
440
|
-
h.Hasher =
|
|
440
|
+
h.Hasher = v.extend({
|
|
441
441
|
/**
|
|
442
442
|
* Configuration options.
|
|
443
443
|
*/
|
|
@@ -462,7 +462,7 @@ const Pe = {}, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
462
462
|
* hasher.reset();
|
|
463
463
|
*/
|
|
464
464
|
reset: function() {
|
|
465
|
-
|
|
465
|
+
v.reset.call(this), this._doReset();
|
|
466
466
|
},
|
|
467
467
|
/**
|
|
468
468
|
* Updates this hasher with a message.
|
|
@@ -566,29 +566,29 @@ var Q = {}, qe = {
|
|
|
566
566
|
function k(y) {
|
|
567
567
|
return (y - (y | 0)) * 4294967296 | 0;
|
|
568
568
|
}
|
|
569
|
-
for (var _ = 2,
|
|
570
|
-
w(_) && (
|
|
569
|
+
for (var _ = 2, v = 0; v < 64; )
|
|
570
|
+
w(_) && (v < 8 && (h[v] = k(r.pow(_, 1 / 2))), g[v] = k(r.pow(_, 1 / 3)), v++), _++;
|
|
571
571
|
})();
|
|
572
572
|
var u = [], S = l.SHA256 = c.extend({
|
|
573
573
|
_doReset: function() {
|
|
574
574
|
this._hash = new o.init(h.slice(0));
|
|
575
575
|
},
|
|
576
576
|
_doProcessBlock: function(w, k) {
|
|
577
|
-
for (var _ = this._hash.words,
|
|
577
|
+
for (var _ = this._hash.words, v = _[0], y = _[1], a = _[2], d = _[3], p = _[4], m = _[5], b = _[6], E = _[7], x = 0; x < 64; x++) {
|
|
578
578
|
if (x < 16)
|
|
579
579
|
u[x] = w[k + x] | 0;
|
|
580
580
|
else {
|
|
581
|
-
var C = u[x - 15],
|
|
582
|
-
u[x] =
|
|
581
|
+
var C = u[x - 15], P = (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;
|
|
582
|
+
u[x] = P + u[x - 7] + q + u[x - 16];
|
|
583
583
|
}
|
|
584
|
-
var W = p &
|
|
585
|
-
E = b, b =
|
|
584
|
+
var W = p & m ^ ~p & b, J = v & y ^ v & a ^ y & a, K = (v << 30 | v >>> 2) ^ (v << 19 | v >>> 13) ^ (v << 10 | v >>> 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 = m, m = p, p = d + B | 0, d = a, a = y, y = v, v = B + xe | 0;
|
|
586
586
|
}
|
|
587
|
-
_[0] = _[0] +
|
|
587
|
+
_[0] = _[0] + v | 0, _[1] = _[1] + y | 0, _[2] = _[2] + a | 0, _[3] = _[3] + d | 0, _[4] = _[4] + p | 0, _[5] = _[5] + m | 0, _[6] = _[6] + b | 0, _[7] = _[7] + E | 0;
|
|
588
588
|
},
|
|
589
589
|
_doFinalize: function() {
|
|
590
|
-
var w = this._data, k = w.words, _ = this._nDataBytes * 8,
|
|
591
|
-
return k[
|
|
590
|
+
var w = this._data, k = w.words, _ = this._nDataBytes * 8, v = w.sigBytes * 8;
|
|
591
|
+
return k[v >>> 5] |= 128 << 24 - v % 32, k[(v + 64 >>> 9 << 4) + 14] = r.floor(_ / 4294967296), k[(v + 64 >>> 9 << 4) + 15] = _, w.sigBytes = k.length * 4, this._process(), this._hash;
|
|
592
592
|
},
|
|
593
593
|
clone: function() {
|
|
594
594
|
var w = c.clone.call(this);
|
|
@@ -631,7 +631,7 @@ var $ = {}, Ne = {
|
|
|
631
631
|
var h = l.words, g = l.sigBytes, u = this._map;
|
|
632
632
|
l.clamp();
|
|
633
633
|
for (var S = [], w = 0; w < g; w += 3)
|
|
634
|
-
for (var k = h[w >>> 2] >>> 24 - w % 4 * 8 & 255, _ = h[w + 1 >>> 2] >>> 24 - (w + 1) % 4 * 8 & 255,
|
|
634
|
+
for (var k = h[w >>> 2] >>> 24 - w % 4 * 8 & 255, _ = h[w + 1 >>> 2] >>> 24 - (w + 1) % 4 * 8 & 255, v = h[w + 2 >>> 2] >>> 24 - (w + 2) % 4 * 8 & 255, y = k << 16 | _ << 8 | v, a = 0; a < 4 && w + a * 0.75 < g; a++)
|
|
635
635
|
S.push(u.charAt(y >>> 6 * (3 - a) & 63));
|
|
636
636
|
var d = u.charAt(64);
|
|
637
637
|
if (d)
|
|
@@ -671,8 +671,8 @@ var $ = {}, Ne = {
|
|
|
671
671
|
function c(l, h, g) {
|
|
672
672
|
for (var u = [], S = 0, w = 0; w < h; w++)
|
|
673
673
|
if (w % 4) {
|
|
674
|
-
var k = g[l.charCodeAt(w - 1)] << w % 4 * 2, _ = g[l.charCodeAt(w)] >>> 6 - w % 4 * 2,
|
|
675
|
-
u[S >>> 2] |=
|
|
674
|
+
var k = g[l.charCodeAt(w - 1)] << w % 4 * 2, _ = g[l.charCodeAt(w)] >>> 6 - w % 4 * 2, v = k | _;
|
|
675
|
+
u[S >>> 2] |= v << 24 - S % 4 * 8, S++;
|
|
676
676
|
}
|
|
677
677
|
return n.create(u, S);
|
|
678
678
|
}
|
|
@@ -817,7 +817,7 @@ var f = class {
|
|
|
817
817
|
}
|
|
818
818
|
};
|
|
819
819
|
D.reset();
|
|
820
|
-
var Be = "10000000-1000-4000-8000-100000000000",
|
|
820
|
+
var Be = "10000000-1000-4000-8000-100000000000", A = class {
|
|
821
821
|
static _randomWord() {
|
|
822
822
|
return H.lib.WordArray.random(1).words[0];
|
|
823
823
|
}
|
|
@@ -827,14 +827,14 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
827
827
|
static generateUUIDv4() {
|
|
828
828
|
return Be.replace(
|
|
829
829
|
/[018]/g,
|
|
830
|
-
(t) => (+t ^
|
|
830
|
+
(t) => (+t ^ A._randomWord() & 15 >> +t / 4).toString(16)
|
|
831
831
|
).replace(/-/g, "");
|
|
832
832
|
}
|
|
833
833
|
/**
|
|
834
834
|
* PKCE: Generate a code verifier
|
|
835
835
|
*/
|
|
836
836
|
static generateCodeVerifier() {
|
|
837
|
-
return
|
|
837
|
+
return A.generateUUIDv4() + A.generateUUIDv4() + A.generateUUIDv4();
|
|
838
838
|
}
|
|
839
839
|
/**
|
|
840
840
|
* PKCE: Generate a code challenge
|
|
@@ -939,7 +939,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
939
939
|
constructor(e) {
|
|
940
940
|
super(e), this.name = "ErrorTimeout";
|
|
941
941
|
}
|
|
942
|
-
},
|
|
942
|
+
}, Fe = class {
|
|
943
943
|
constructor(e) {
|
|
944
944
|
this._logger = new f("AccessTokenEvents"), this._expiringTimer = new T("Access token expiring"), this._expiredTimer = new T("Access token expired"), this._expiringNotificationTimeInSeconds = e.expiringNotificationTimeInSeconds;
|
|
945
945
|
}
|
|
@@ -984,7 +984,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
984
984
|
removeAccessTokenExpired(e) {
|
|
985
985
|
this._expiredTimer.removeHandler(e);
|
|
986
986
|
}
|
|
987
|
-
},
|
|
987
|
+
}, Le = class {
|
|
988
988
|
constructor(e, t, s, r, i) {
|
|
989
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) => {
|
|
990
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"));
|
|
@@ -1204,7 +1204,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
return t;
|
|
1206
1206
|
}
|
|
1207
|
-
}, ze = "code", De = "openid", Je = "client_secret_post", Ke = "query", Ve = 60 * 15, Ge = 60 * 5,
|
|
1207
|
+
}, ze = "code", De = "openid", Je = "client_secret_post", Ke = "query", Ve = 60 * 15, Ge = 60 * 5, me = class {
|
|
1208
1208
|
constructor({
|
|
1209
1209
|
// metadata related
|
|
1210
1210
|
authority: e,
|
|
@@ -1225,19 +1225,19 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1225
1225
|
display: w,
|
|
1226
1226
|
max_age: k,
|
|
1227
1227
|
ui_locales: _,
|
|
1228
|
-
acr_values:
|
|
1228
|
+
acr_values: v,
|
|
1229
1229
|
resource: y,
|
|
1230
1230
|
response_mode: a = Ke,
|
|
1231
1231
|
// behavior flags
|
|
1232
1232
|
filterProtocolClaims: d = !0,
|
|
1233
1233
|
loadUserInfo: p = !1,
|
|
1234
|
-
staleStateAgeInSeconds:
|
|
1234
|
+
staleStateAgeInSeconds: m = Ve,
|
|
1235
1235
|
clockSkewInSeconds: b = Ge,
|
|
1236
1236
|
userInfoJwtIssuer: E = "OP",
|
|
1237
1237
|
mergeClaims: x = !1,
|
|
1238
1238
|
disablePKCE: C = !1,
|
|
1239
1239
|
// other behavior
|
|
1240
|
-
stateStore:
|
|
1240
|
+
stateStore: P,
|
|
1241
1241
|
refreshTokenCredentials: R,
|
|
1242
1242
|
revokeTokenAdditionalContentTypes: q,
|
|
1243
1243
|
fetchRequestCredentials: W,
|
|
@@ -1246,8 +1246,8 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1246
1246
|
extraQueryParams: K = {},
|
|
1247
1247
|
extraTokenParams: V = {}
|
|
1248
1248
|
}) {
|
|
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 =
|
|
1250
|
-
this.stateStore =
|
|
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 = v, this.resource = y, this.response_mode = a, this.filterProtocolClaims = d ?? !0, this.loadUserInfo = !!p, this.staleStateAgeInSeconds = m, 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", P)
|
|
1250
|
+
this.stateStore = P;
|
|
1251
1251
|
else {
|
|
1252
1252
|
const B = typeof window < "u" ? window.localStorage : new fe();
|
|
1253
1253
|
this.stateStore = new we({ store: B });
|
|
@@ -1277,7 +1277,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1277
1277
|
});
|
|
1278
1278
|
return t.debug("got claims", r), r;
|
|
1279
1279
|
}
|
|
1280
|
-
},
|
|
1280
|
+
}, ve = class {
|
|
1281
1281
|
constructor(e, t) {
|
|
1282
1282
|
this._settings = e, this._metadataService = t, this._logger = new f("TokenClient"), this._jsonService = new ie(this._settings.revokeTokenAdditionalContentTypes);
|
|
1283
1283
|
}
|
|
@@ -1298,7 +1298,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1298
1298
|
case "client_secret_basic":
|
|
1299
1299
|
if (!r)
|
|
1300
1300
|
throw n.throw(new Error("A client_secret is required")), null;
|
|
1301
|
-
c =
|
|
1301
|
+
c = A.generateBasicAuth(s, r);
|
|
1302
1302
|
break;
|
|
1303
1303
|
case "client_secret_post":
|
|
1304
1304
|
o.append("client_id", s), r && o.append("client_secret", r);
|
|
@@ -1326,7 +1326,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1326
1326
|
case "client_secret_basic":
|
|
1327
1327
|
if (!s)
|
|
1328
1328
|
throw n.throw(new Error("A client_secret is required")), null;
|
|
1329
|
-
c =
|
|
1329
|
+
c = A.generateBasicAuth(t, s);
|
|
1330
1330
|
break;
|
|
1331
1331
|
case "client_secret_post":
|
|
1332
1332
|
o.append("client_id", t), s && o.append("client_secret", s);
|
|
@@ -1354,7 +1354,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1354
1354
|
case "client_secret_basic":
|
|
1355
1355
|
if (!s)
|
|
1356
1356
|
throw n.throw(new Error("A client_secret is required")), null;
|
|
1357
|
-
c =
|
|
1357
|
+
c = A.generateBasicAuth(t, s);
|
|
1358
1358
|
break;
|
|
1359
1359
|
case "client_secret_post":
|
|
1360
1360
|
o.append("client_id", t), s && o.append("client_secret", s);
|
|
@@ -1393,7 +1393,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1393
1393
|
// https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken
|
|
1394
1394
|
], Ye = ["sub", "iss", "aud", "exp", "iat"], Ze = class {
|
|
1395
1395
|
constructor(e, t) {
|
|
1396
|
-
this._settings = e, this._metadataService = t, this._logger = new f("ResponseValidator"), this._userInfoService = new Qe(this._settings, this._metadataService), this._tokenClient = new
|
|
1396
|
+
this._settings = e, this._metadataService = t, this._logger = new f("ResponseValidator"), this._userInfoService = new Qe(this._settings, this._metadataService), this._tokenClient = new ve(this._settings, this._metadataService);
|
|
1397
1397
|
}
|
|
1398
1398
|
async validateSigninResponse(e, t) {
|
|
1399
1399
|
const s = this._logger.create("validateSigninResponse");
|
|
@@ -1480,7 +1480,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
}, M = class {
|
|
1482
1482
|
constructor(e) {
|
|
1483
|
-
this.id = e.id ||
|
|
1483
|
+
this.id = e.id || A.generateUUIDv4(), this.data = e.data, e.created && e.created > 0 ? this.created = e.created : this.created = T.getEpochTime(), this.request_type = e.request_type;
|
|
1484
1484
|
}
|
|
1485
1485
|
toStorageString() {
|
|
1486
1486
|
return new f("State").create("toStorageString"), JSON.stringify({
|
|
@@ -1513,7 +1513,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
}, ne = class extends M {
|
|
1515
1515
|
constructor(e) {
|
|
1516
|
-
super(e), e.code_verifier === !0 ? this.code_verifier =
|
|
1516
|
+
super(e), e.code_verifier === !0 ? this.code_verifier = A.generateCodeVerifier() : e.code_verifier && (this.code_verifier = e.code_verifier), this.code_verifier && (this.code_challenge = A.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;
|
|
1517
1517
|
}
|
|
1518
1518
|
toStorageString() {
|
|
1519
1519
|
return new f("SigninState").create("toStorageString"), JSON.stringify({
|
|
@@ -1557,7 +1557,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1557
1557
|
extraQueryParams: w,
|
|
1558
1558
|
extraTokenParams: k,
|
|
1559
1559
|
disablePKCE: _,
|
|
1560
|
-
...
|
|
1560
|
+
...v
|
|
1561
1561
|
}) {
|
|
1562
1562
|
if (this._logger = new f("SigninRequest"), !e)
|
|
1563
1563
|
throw this._logger.error("ctor: No url passed"), new Error("url");
|
|
@@ -1586,7 +1586,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1586
1586
|
});
|
|
1587
1587
|
const y = new URL(e);
|
|
1588
1588
|
y.searchParams.append("client_id", s), y.searchParams.append("redirect_uri", r), y.searchParams.append("response_type", i), y.searchParams.append("scope", n), g && y.searchParams.append("nonce", g), y.searchParams.append("state", this.state.id), this.state.code_challenge && (y.searchParams.append("code_challenge", this.state.code_challenge), y.searchParams.append("code_challenge_method", "S256")), u && (Array.isArray(u) ? u : [u]).forEach((d) => y.searchParams.append("resource", d));
|
|
1589
|
-
for (const [a, d] of Object.entries({ response_mode: c, ...
|
|
1589
|
+
for (const [a, d] of Object.entries({ response_mode: c, ...v, ...w }))
|
|
1590
1590
|
d != null && y.searchParams.append(a, d.toString());
|
|
1591
1591
|
this.url = y.href;
|
|
1592
1592
|
}
|
|
@@ -1628,7 +1628,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
}, it = class {
|
|
1630
1630
|
constructor(e) {
|
|
1631
|
-
this._logger = new f("OidcClient"), this.settings = new
|
|
1631
|
+
this._logger = new f("OidcClient"), this.settings = new me(e), this.metadataService = new $e(this.settings), this._validator = new Ze(this.settings, this.metadataService), this._tokenClient = new ve(this.settings, this.metadataService);
|
|
1632
1632
|
}
|
|
1633
1633
|
async createSigninRequest({
|
|
1634
1634
|
state: e,
|
|
@@ -1647,7 +1647,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1647
1647
|
max_age: w = this.settings.max_age,
|
|
1648
1648
|
ui_locales: k = this.settings.ui_locales,
|
|
1649
1649
|
acr_values: _ = this.settings.acr_values,
|
|
1650
|
-
resource:
|
|
1650
|
+
resource: v = this.settings.resource,
|
|
1651
1651
|
response_mode: y = this.settings.response_mode,
|
|
1652
1652
|
extraQueryParams: a = this.settings.extraQueryParams,
|
|
1653
1653
|
extraTokenParams: d = this.settings.extraTokenParams
|
|
@@ -1655,10 +1655,10 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1655
1655
|
const p = this._logger.create("createSigninRequest");
|
|
1656
1656
|
if (l !== "code")
|
|
1657
1657
|
throw new Error("Only the Authorization Code flow (with PKCE) is supported");
|
|
1658
|
-
const
|
|
1659
|
-
p.debug("Received authorization endpoint",
|
|
1658
|
+
const m = await this.metadataService.getAuthorizationEndpoint();
|
|
1659
|
+
p.debug("Received authorization endpoint", m);
|
|
1660
1660
|
const b = new et({
|
|
1661
|
-
url:
|
|
1661
|
+
url: m,
|
|
1662
1662
|
authority: this.settings.authority,
|
|
1663
1663
|
client_id: this.settings.client_id,
|
|
1664
1664
|
redirect_uri: g,
|
|
@@ -1672,7 +1672,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1672
1672
|
id_token_hint: i,
|
|
1673
1673
|
login_hint: n,
|
|
1674
1674
|
acr_values: _,
|
|
1675
|
-
resource:
|
|
1675
|
+
resource: v,
|
|
1676
1676
|
request: t,
|
|
1677
1677
|
request_uri: s,
|
|
1678
1678
|
extraQueryParams: a,
|
|
@@ -1799,7 +1799,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1799
1799
|
const i = await this._userManager.metadataService.getCheckSessionIframe();
|
|
1800
1800
|
if (i) {
|
|
1801
1801
|
r.debug("initializing check session iframe");
|
|
1802
|
-
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 Le(this._callback, n, i, o, c);
|
|
1803
1803
|
await l.load(), this._checkSessionIFrame = l, l.start(s);
|
|
1804
1804
|
} else
|
|
1805
1805
|
r.warn("no check session iframe found in the metadata");
|
|
@@ -1860,7 +1860,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
|
-
},
|
|
1863
|
+
}, F = class {
|
|
1864
1864
|
constructor(e) {
|
|
1865
1865
|
var t;
|
|
1866
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;
|
|
@@ -1897,7 +1897,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1897
1897
|
});
|
|
1898
1898
|
}
|
|
1899
1899
|
static fromStorageString(e) {
|
|
1900
|
-
return f.createStatic("User", "fromStorageString"), new
|
|
1900
|
+
return f.createStatic("User", "fromStorageString"), new F(JSON.parse(e));
|
|
1901
1901
|
}
|
|
1902
1902
|
}, de = "oidc-client", Se = class {
|
|
1903
1903
|
constructor() {
|
|
@@ -1946,7 +1946,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1946
1946
|
location: !1,
|
|
1947
1947
|
toolbar: !1,
|
|
1948
1948
|
height: 640
|
|
1949
|
-
}, be = "_blank", ot = 60, at = 2, ke = 10, ct = class extends
|
|
1949
|
+
}, be = "_blank", ot = 60, at = 2, ke = 10, ct = class extends me {
|
|
1950
1950
|
constructor(e) {
|
|
1951
1951
|
const {
|
|
1952
1952
|
popup_redirect_uri: t = e.redirect_uri,
|
|
@@ -1964,16 +1964,16 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
1964
1964
|
includeIdTokenInSilentRenew: w = !1,
|
|
1965
1965
|
monitorSession: k = !1,
|
|
1966
1966
|
monitorAnonymousSession: _ = !1,
|
|
1967
|
-
checkSessionIntervalInSeconds:
|
|
1967
|
+
checkSessionIntervalInSeconds: v = at,
|
|
1968
1968
|
query_status_response_type: y = "code",
|
|
1969
1969
|
stopCheckSessionOnError: a = !0,
|
|
1970
1970
|
revokeTokenTypes: d = ["access_token", "refresh_token"],
|
|
1971
1971
|
revokeTokensOnSignout: p = !1,
|
|
1972
|
-
includeIdTokenInSilentSignout:
|
|
1972
|
+
includeIdTokenInSilentSignout: m = !1,
|
|
1973
1973
|
accessTokenExpiringNotificationTimeInSeconds: b = ot,
|
|
1974
1974
|
userStore: E
|
|
1975
1975
|
} = e;
|
|
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 =
|
|
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 = v, this.stopCheckSessionOnError = a, this.query_status_response_type = y, this.revokeTokenTypes = d, this.revokeTokensOnSignout = p, this.includeIdTokenInSilentSignout = m, this.accessTokenExpiringNotificationTimeInSeconds = b, E)
|
|
1977
1977
|
this.userStore = E;
|
|
1978
1978
|
else {
|
|
1979
1979
|
const x = typeof window < "u" ? window.sessionStorage : new fe();
|
|
@@ -2083,7 +2083,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
};
|
|
2085
2085
|
}
|
|
2086
|
-
}, gt = class extends
|
|
2086
|
+
}, gt = class extends Fe {
|
|
2087
2087
|
constructor(e) {
|
|
2088
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");
|
|
2089
2089
|
}
|
|
@@ -2345,7 +2345,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2345
2345
|
const t = await this._client.useRefreshToken({
|
|
2346
2346
|
state: e,
|
|
2347
2347
|
timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds
|
|
2348
|
-
}), s = new
|
|
2348
|
+
}), s = new F({ ...e, ...t });
|
|
2349
2349
|
return await this.storeUser(s), this._events.load(s), s;
|
|
2350
2350
|
}
|
|
2351
2351
|
/**
|
|
@@ -2450,7 +2450,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2450
2450
|
return s.debug("got signin response"), await this._buildUser(r, t);
|
|
2451
2451
|
}
|
|
2452
2452
|
async _buildUser(e, t) {
|
|
2453
|
-
const s = this._logger.create("_buildUser"), r = new
|
|
2453
|
+
const s = this._logger.create("_buildUser"), r = new F(e);
|
|
2454
2454
|
if (t) {
|
|
2455
2455
|
if (t !== r.profile.sub)
|
|
2456
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" });
|
|
@@ -2593,7 +2593,7 @@ var Be = "10000000-1000-4000-8000-100000000000", P = class {
|
|
|
2593
2593
|
}
|
|
2594
2594
|
async _loadUser() {
|
|
2595
2595
|
const e = this._logger.create("_loadUser"), t = await this.settings.userStore.get(this._userStoreKey);
|
|
2596
|
-
return t ? (e.debug("user storageString loaded"),
|
|
2596
|
+
return t ? (e.debug("user storageString loaded"), F.fromStorageString(t)) : (e.debug("no user storageString"), null);
|
|
2597
2597
|
}
|
|
2598
2598
|
async storeUser(e) {
|
|
2599
2599
|
const t = this._logger.create("storeUser");
|
|
@@ -2633,21 +2633,34 @@ const Ee = ue(
|
|
|
2633
2633
|
}
|
|
2634
2634
|
}), []);
|
|
2635
2635
|
return /* @__PURE__ */ se.jsx(Ee.Provider, { value: r, children: e });
|
|
2636
|
-
},
|
|
2636
|
+
}, mt = (e) => {
|
|
2637
2637
|
const s = e.split(".")[1].replace(/-/g, "+").replace(/_/g, "/"), r = atob(s);
|
|
2638
2638
|
return JSON.parse(r);
|
|
2639
2639
|
}, Tt = (e) => {
|
|
2640
2640
|
const { setImpersonation: t } = wt();
|
|
2641
|
-
|
|
2641
|
+
L(() => {
|
|
2642
2642
|
const { search: s } = window.location, r = new URLSearchParams(s).get(
|
|
2643
2643
|
"impersonateAccessToken"
|
|
2644
2644
|
);
|
|
2645
2645
|
if (r && t) {
|
|
2646
|
-
const i =
|
|
2646
|
+
const i = mt(r);
|
|
2647
2647
|
t(r, i), e();
|
|
2648
2648
|
}
|
|
2649
2649
|
}, []);
|
|
2650
|
-
}
|
|
2650
|
+
};
|
|
2651
|
+
function It(e) {
|
|
2652
|
+
return JSON.parse(e).map((r) => {
|
|
2653
|
+
const [i, n, o, c, l] = r.split("|"), h = c.split(",");
|
|
2654
|
+
return {
|
|
2655
|
+
CustomerExternalId: i,
|
|
2656
|
+
CustomerFirmId: n,
|
|
2657
|
+
CustomerFirmName: o,
|
|
2658
|
+
CustomerUserRoles: h,
|
|
2659
|
+
CustomerUserIsAdmin: l === "True"
|
|
2660
|
+
};
|
|
2661
|
+
});
|
|
2662
|
+
}
|
|
2663
|
+
const vt = ({
|
|
2651
2664
|
userManager: e,
|
|
2652
2665
|
context: t,
|
|
2653
2666
|
children: s
|
|
@@ -2659,7 +2672,7 @@ const Ee = ue(
|
|
|
2659
2672
|
isError: !1,
|
|
2660
2673
|
error: null
|
|
2661
2674
|
}), n = pe(!1);
|
|
2662
|
-
|
|
2675
|
+
L(() => {
|
|
2663
2676
|
n.current || (n.current = !0, (async () => {
|
|
2664
2677
|
try {
|
|
2665
2678
|
const h = await e.getUser();
|
|
@@ -2680,7 +2693,7 @@ const Ee = ue(
|
|
|
2680
2693
|
});
|
|
2681
2694
|
}
|
|
2682
2695
|
})());
|
|
2683
|
-
}, [e]),
|
|
2696
|
+
}, [e]), L(() => {
|
|
2684
2697
|
const h = (S) => {
|
|
2685
2698
|
i({
|
|
2686
2699
|
user: S,
|
|
@@ -2748,18 +2761,18 @@ const Ee = ue(
|
|
|
2748
2761
|
return t;
|
|
2749
2762
|
}, yt = (e, t) => {
|
|
2750
2763
|
const { state: s, handleSigninCallback: r } = oe(e), i = pe(!1);
|
|
2751
|
-
return
|
|
2764
|
+
return L(() => {
|
|
2752
2765
|
i.current || (i.current = !0, r().then(
|
|
2753
2766
|
(n) => new Promise(
|
|
2754
2767
|
(o) => setTimeout(() => o(n), 0)
|
|
2755
2768
|
)
|
|
2756
2769
|
).then((n) => t == null ? void 0 : t(n)));
|
|
2757
2770
|
}, [r]), s;
|
|
2758
|
-
},
|
|
2771
|
+
}, Ut = (e) => {
|
|
2759
2772
|
const t = ue(null);
|
|
2760
2773
|
return {
|
|
2761
2774
|
AuthContext: t,
|
|
2762
|
-
AuthProvider: ({ children: c }) => /* @__PURE__ */ se.jsx(
|
|
2775
|
+
AuthProvider: ({ children: c }) => /* @__PURE__ */ se.jsx(vt, { userManager: e, context: t, children: c }),
|
|
2763
2776
|
useAuthContext: () => oe(t),
|
|
2764
2777
|
useAuthState: () => St(t),
|
|
2765
2778
|
useSigninCallback: (c) => yt(t, c),
|
|
@@ -2770,8 +2783,8 @@ const Ee = ue(
|
|
|
2770
2783
|
};
|
|
2771
2784
|
};
|
|
2772
2785
|
export {
|
|
2773
|
-
|
|
2774
|
-
|
|
2786
|
+
Fe as AccessTokenEvents,
|
|
2787
|
+
Le as CheckSessionIFrame,
|
|
2775
2788
|
j as ErrorResponse,
|
|
2776
2789
|
re as ErrorTimeout,
|
|
2777
2790
|
Rt as ImpersonationContextProvider,
|
|
@@ -2780,18 +2793,19 @@ export {
|
|
|
2780
2793
|
f as Logger,
|
|
2781
2794
|
$e as MetadataService,
|
|
2782
2795
|
it as OidcClient,
|
|
2783
|
-
|
|
2796
|
+
me as OidcClientSettingsStore,
|
|
2784
2797
|
nt as SessionMonitor,
|
|
2785
2798
|
G as SigninResponse,
|
|
2786
2799
|
ne as SigninState,
|
|
2787
2800
|
rt as SignoutResponse,
|
|
2788
2801
|
M as State,
|
|
2789
|
-
|
|
2802
|
+
F as User,
|
|
2790
2803
|
xt as UserManager,
|
|
2791
2804
|
ct as UserManagerSettingsStore,
|
|
2792
2805
|
Ct as Version,
|
|
2793
2806
|
we as WebStorageStateStore,
|
|
2794
|
-
|
|
2807
|
+
Ut as createAuthContext,
|
|
2808
|
+
It as parseUserProfileFCString,
|
|
2795
2809
|
Tt as useImpersonationCallback,
|
|
2796
2810
|
wt as useImpersonationContext
|
|
2797
2811
|
};
|
package/package.json
CHANGED
package/src/lib/colors/colors.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
fc string format:
|
|
5
|
+
["121487|910209205|ASPLAN VIAK AS, TROMSØ|Ansatt,Arkitekt,Teknisk ansatt|False","151|910209211105|Aannet|Ansatt,Arkitekt,Teknisk ansatt|False" ]
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export interface FirmAccess {
|
|
10
|
+
CustomerExternalId: string;
|
|
11
|
+
CustomerFirmId: string;
|
|
12
|
+
CustomerFirmName: string;
|
|
13
|
+
CustomerUserRoles: string[];
|
|
14
|
+
CustomerUserIsAdmin: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function parseUserProfileFCString(fc: string): FirmAccess[] {
|
|
18
|
+
const firmsData: string[] = JSON.parse(fc);
|
|
19
|
+
const firmAccesses: FirmAccess[] = firmsData.map(firmData => {
|
|
20
|
+
const [CustomerExternalId, CustomerFirmId, CustomerFirmName, CustomerUserRolesStr, CustomerUserIsAdminStr] = firmData.split("|");
|
|
21
|
+
const CustomerUserRoles = CustomerUserRolesStr.split(",");
|
|
22
|
+
const CustomerUserIsAdmin = CustomerUserIsAdminStr === "True";
|
|
23
|
+
const firmAccess: FirmAccess = {
|
|
24
|
+
CustomerExternalId,
|
|
25
|
+
CustomerFirmId,
|
|
26
|
+
CustomerFirmName,
|
|
27
|
+
CustomerUserRoles,
|
|
28
|
+
CustomerUserIsAdmin,
|
|
29
|
+
};
|
|
30
|
+
return firmAccess;
|
|
31
|
+
});
|
|
32
|
+
return firmAccesses;
|
|
33
|
+
}
|
|
34
|
+
|