@axa-fr/oidc-client 7.27.16 → 7.27.17
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/index.js +154 -130
- package/dist/index.umd.cjs +2 -2
- package/dist/logout.d.ts +14 -0
- package/dist/logout.d.ts.map +1 -1
- package/dist/oidc.d.ts +20 -0
- package/dist/oidc.d.ts.map +1 -1
- package/dist/oidcClient.d.ts +20 -0
- package/dist/oidcClient.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/logout.spec.ts +208 -1
- package/src/logout.ts +149 -80
- package/src/oidc.ts +30 -1
- package/src/oidcClient.ts +26 -0
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -636,10 +636,10 @@ var oe = () => {
|
|
|
636
636
|
} else throw console.error(a.message), a;
|
|
637
637
|
}
|
|
638
638
|
return a;
|
|
639
|
-
},
|
|
639
|
+
}, fe = {
|
|
640
640
|
refresh_token: "refresh_token",
|
|
641
641
|
access_token: "access_token"
|
|
642
|
-
},
|
|
642
|
+
}, pe = (e) => async (t, n, r = fe.refresh_token, i, a = {}, o = 1e4) => {
|
|
643
643
|
let s = {
|
|
644
644
|
token: n,
|
|
645
645
|
token_type_hint: r,
|
|
@@ -657,7 +657,7 @@ var oe = () => {
|
|
|
657
657
|
headers: { "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8" },
|
|
658
658
|
body: l
|
|
659
659
|
}, o)).status === 200 ? { success: !0 } : { success: !1 };
|
|
660
|
-
},
|
|
660
|
+
}, me = (e) => async (t, n, r, i, a = {}, o, s = 1e4) => {
|
|
661
661
|
for (let [e, t] of Object.entries(r)) n[e] === void 0 && (n[e] = t);
|
|
662
662
|
let c = [];
|
|
663
663
|
for (let e in n) {
|
|
@@ -678,20 +678,20 @@ var oe = () => {
|
|
|
678
678
|
demonstratingProofOfPossessionNonce: null
|
|
679
679
|
};
|
|
680
680
|
let d = await u.json(), f = null;
|
|
681
|
-
return u.headers.has(
|
|
681
|
+
return u.headers.has(j) && (f = u.headers.get(j)), {
|
|
682
682
|
success: !0,
|
|
683
683
|
status: u.status,
|
|
684
684
|
data: G(d, i, o),
|
|
685
685
|
demonstratingProofOfPossessionNonce: f
|
|
686
686
|
};
|
|
687
|
-
},
|
|
687
|
+
}, he = (e, t) => async (n, r) => {
|
|
688
688
|
r = r ? { ...r } : {};
|
|
689
689
|
let i = D(128), a = await ne(i);
|
|
690
690
|
await e.setCodeVerifierAsync(i), await e.setStateAsync(r.state), r.code_challenge = a, r.code_challenge_method = "S256";
|
|
691
691
|
let o = "";
|
|
692
692
|
if (r) for (let [e, t] of Object.entries(r)) o === "" ? o += "?" : o += "&", o += `${e}=${encodeURIComponent(t)}`;
|
|
693
693
|
t.open(`${n}${o}`);
|
|
694
|
-
},
|
|
694
|
+
}, j = "DPoP-Nonce", ge = (e) => async (t, n, r, i, a = 1e4) => {
|
|
695
695
|
n = n ? { ...n } : {}, n.code_verifier = await e.getCodeVerifierAsync();
|
|
696
696
|
let o = [];
|
|
697
697
|
for (let e in n) {
|
|
@@ -711,7 +711,7 @@ var oe = () => {
|
|
|
711
711
|
status: c.status
|
|
712
712
|
};
|
|
713
713
|
let l = null;
|
|
714
|
-
c.headers.has(
|
|
714
|
+
c.headers.has(j) && (l = c.headers.get(j));
|
|
715
715
|
let u = await c.json();
|
|
716
716
|
return {
|
|
717
717
|
success: !0,
|
|
@@ -721,7 +721,7 @@ var oe = () => {
|
|
|
721
721
|
demonstratingProofOfPossessionNonce: l
|
|
722
722
|
}
|
|
723
723
|
};
|
|
724
|
-
},
|
|
724
|
+
}, _e = (e) => {
|
|
725
725
|
let t = e.match(/^([a-z][\w-]+\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);
|
|
726
726
|
if (!t) throw Error("Invalid URL");
|
|
727
727
|
let n = t[6], r = t[7];
|
|
@@ -739,19 +739,19 @@ var oe = () => {
|
|
|
739
739
|
search: n,
|
|
740
740
|
hash: r
|
|
741
741
|
};
|
|
742
|
-
},
|
|
743
|
-
let t =
|
|
742
|
+
}, ve = (e) => {
|
|
743
|
+
let t = _e(e), { path: n } = t;
|
|
744
744
|
n.endsWith("/") && (n = n.slice(0, -1));
|
|
745
745
|
let { hash: r } = t;
|
|
746
746
|
return r === "#_=_" && (r = ""), r && (n += r), n;
|
|
747
|
-
},
|
|
748
|
-
let { search: t } =
|
|
749
|
-
return
|
|
750
|
-
},
|
|
747
|
+
}, M = (e) => {
|
|
748
|
+
let { search: t } = _e(e);
|
|
749
|
+
return ye(t);
|
|
750
|
+
}, ye = (e) => {
|
|
751
751
|
let t = {}, n, r, i, a = e.split("&");
|
|
752
752
|
for (r = 0, i = a.length; r < i; r++) n = a[r].split("="), t[decodeURIComponent(n[0])] = decodeURIComponent(n[1]);
|
|
753
753
|
return t;
|
|
754
|
-
},
|
|
754
|
+
}, be = (t, n, r, a, o) => (s = void 0, c = null, l = !1, u = void 0) => {
|
|
755
755
|
let d = c;
|
|
756
756
|
return c = { ...c }, (async () => {
|
|
757
757
|
let f = s || o.getPath();
|
|
@@ -785,15 +785,15 @@ var oe = () => {
|
|
|
785
785
|
response_type: "code",
|
|
786
786
|
...r
|
|
787
787
|
};
|
|
788
|
-
await
|
|
788
|
+
await he(h, o)(m.authorizationEndpoint, g);
|
|
789
789
|
} catch (t) {
|
|
790
790
|
throw r(e.loginAsync_error, t), t;
|
|
791
791
|
}
|
|
792
792
|
})();
|
|
793
|
-
},
|
|
793
|
+
}, xe = (t) => async (n = !1) => {
|
|
794
794
|
try {
|
|
795
795
|
t.publishEvent(e.loginCallbackAsync_begin, {});
|
|
796
|
-
let r = t.configuration, a = r.client_id, o = n ? r.silent_redirect_uri : r.redirect_uri, s = r.authority, c = r.token_request_timeout, l = await t.initAsync(s, r.authority_configuration), u =
|
|
796
|
+
let r = t.configuration, a = r.client_id, o = n ? r.silent_redirect_uri : r.redirect_uri, s = r.authority, c = r.token_request_timeout, l = await t.initAsync(s, r.authority_configuration), u = M(t.location.getCurrentHref()), d = u.session_state, f = await $(r, t.configurationName), p, m, h, g;
|
|
797
797
|
if (f) await f.initAsync(l, "loginCallbackAsync", r), await f.setSessionStateAsync(d), m = await f.getNonceAsync(), h = f.getLoginParams(), g = await f.getStateAsync(), f.startKeepAliveServiceWorker(), p = f;
|
|
798
798
|
else {
|
|
799
799
|
let e = i(t.configurationName, r.storage ?? sessionStorage, r.login_state_storage ?? r.storage ?? sessionStorage);
|
|
@@ -816,14 +816,14 @@ var oe = () => {
|
|
|
816
816
|
let e = await x(window)(r.demonstrating_proof_of_possession_configuration.generateKeyAlgorithm);
|
|
817
817
|
await i(t.configurationName, r.storage, r.login_state_storage ?? r.storage).setDemonstratingProofOfPossessionJwkAsync(e), b.DPoP = await S(window)(r.demonstrating_proof_of_possession_configuration)(e, "POST", y);
|
|
818
818
|
}
|
|
819
|
-
let C = await
|
|
819
|
+
let C = await ge(p)(y, {
|
|
820
820
|
..._,
|
|
821
821
|
...v
|
|
822
822
|
}, b, t.configuration.token_renew_mode, c);
|
|
823
823
|
if (!C.success) throw Error("Token request failed");
|
|
824
824
|
let w, T = C.data.tokens, E = C.data.demonstratingProofOfPossessionNonce;
|
|
825
825
|
if (C.data.state !== v.state) throw Error("state is not valid");
|
|
826
|
-
let { isValid: D, reason: ee } =
|
|
826
|
+
let { isValid: D, reason: ee } = He(T, m.nonce, l);
|
|
827
827
|
if (!D) throw Error(`Tokens are not OpenID valid, reason: ${ee}`);
|
|
828
828
|
if (f) {
|
|
829
829
|
if (T.refreshToken && !T.refreshToken.includes("SECURED_BY_OIDC_SERVICE_WORKER")) throw Error("Refresh token should be hidden by service worker");
|
|
@@ -844,10 +844,10 @@ var oe = () => {
|
|
|
844
844
|
} catch (n) {
|
|
845
845
|
throw console.error(n), t.publishEvent(e.loginCallbackAsync_error, n), n;
|
|
846
846
|
}
|
|
847
|
-
},
|
|
847
|
+
}, Se = {
|
|
848
848
|
access_token: "access_token",
|
|
849
849
|
refresh_token: "refresh_token"
|
|
850
|
-
},
|
|
850
|
+
}, N = (e, t) => {
|
|
851
851
|
let n = {};
|
|
852
852
|
if (e) {
|
|
853
853
|
for (let [r, i] of Object.entries(e)) if (r.endsWith(t)) {
|
|
@@ -857,59 +857,72 @@ var oe = () => {
|
|
|
857
857
|
return n;
|
|
858
858
|
}
|
|
859
859
|
return n;
|
|
860
|
-
},
|
|
860
|
+
}, Ce = (e) => {
|
|
861
861
|
let t = {};
|
|
862
862
|
if (e) {
|
|
863
863
|
for (let [n, r] of Object.entries(e)) n.includes(":") || (t[n] = r);
|
|
864
864
|
return t;
|
|
865
865
|
}
|
|
866
866
|
return t;
|
|
867
|
-
},
|
|
867
|
+
}, we = (e) => async (t) => {
|
|
868
868
|
c.clearTimeout(e.timeoutId), e.timeoutId = null, e.checkSessionIFrame && e.checkSessionIFrame.stop();
|
|
869
869
|
let n = await $(e.configuration, e.configurationName);
|
|
870
870
|
n ? await n.clearAsync(t) : await i(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).clearAsync(t), e.tokens = null, e.userInfo = null;
|
|
871
|
-
},
|
|
872
|
-
let
|
|
873
|
-
|
|
874
|
-
let
|
|
875
|
-
|
|
876
|
-
|
|
871
|
+
}, P = (t, n) => async () => {
|
|
872
|
+
let r = t.tokens?.idTokenPayload?.sub ?? null;
|
|
873
|
+
await t.destroyAsync("LOGGED_OUT");
|
|
874
|
+
for (let [, i] of Object.entries(n)) i === t ? t.publishEvent(e.logout_from_same_tab, {}) : await t.logoutSameTabAsync(t.configuration.client_id, r);
|
|
875
|
+
}, Te = (e, t, n, r) => {
|
|
876
|
+
"id_token_hint" in t || (t.id_token_hint = n), !("post_logout_redirect_uri" in t) && r !== null && (t.post_logout_redirect_uri = r);
|
|
877
|
+
let i = "";
|
|
878
|
+
for (let [e, n] of Object.entries(t)) n != null && (i === "" ? i += "?" : i += "&", i += `${e}=${encodeURIComponent(n)}`);
|
|
879
|
+
return `${e}${i}`;
|
|
880
|
+
}, Ee = (e, t, n, r, i) => async (a = void 0, o = null) => {
|
|
881
|
+
let s = e.configuration, c = await e.initAsync(s.authority, s.authority_configuration);
|
|
882
|
+
a && typeof a != "string" && (a = void 0, r.warn("callbackPathOrUrl path is not a string"));
|
|
883
|
+
let l = a ?? i.getPath(), u = !1;
|
|
884
|
+
a && (u = a.includes("https://") || a.includes("http://"));
|
|
885
|
+
let d = a === null ? null : u ? a : i.getOrigin() + l, f = e.tokens ? e.tokens.idToken : "";
|
|
886
|
+
e.isLoggingOut = !0;
|
|
877
887
|
try {
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
888
|
+
try {
|
|
889
|
+
let t = c.revocationEndpoint;
|
|
890
|
+
if (t) {
|
|
891
|
+
let r = [], i = e.tokens ? e.tokens.accessToken : null;
|
|
892
|
+
if (i && s.logout_tokens_to_invalidate.includes(Se.access_token)) {
|
|
893
|
+
let e = N(o, ":revoke_access_token"), a = pe(n)(t, i, fe.access_token, s.client_id, e);
|
|
894
|
+
r.push(a);
|
|
895
|
+
}
|
|
896
|
+
let a = e.tokens ? e.tokens.refreshToken : null;
|
|
897
|
+
if (a && s.logout_tokens_to_invalidate.includes(Se.refresh_token)) {
|
|
898
|
+
let e = N(o, ":revoke_refresh_token"), i = pe(n)(t, a, fe.refresh_token, s.client_id, e);
|
|
899
|
+
r.push(i);
|
|
900
|
+
}
|
|
901
|
+
r.length > 0 && await Promise.all(r);
|
|
889
902
|
}
|
|
890
|
-
|
|
903
|
+
} catch (e) {
|
|
904
|
+
r.warn("logoutAsync: error when revoking tokens, if the error persist, you ay configure property logout_tokens_to_invalidate from configuration to avoid this error"), r.warn(e);
|
|
891
905
|
}
|
|
892
|
-
|
|
893
|
-
|
|
906
|
+
let a = N(o, ":oidc");
|
|
907
|
+
if (a && a.no_reload === "true") {
|
|
908
|
+
await P(e, t)(), e.isLoggingOut = !1;
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
let l = Ce(o);
|
|
912
|
+
if (c.endSessionEndpoint) {
|
|
913
|
+
let e = Te(c.endSessionEndpoint, l, f, d);
|
|
914
|
+
i.open(e);
|
|
915
|
+
} else i.reload();
|
|
916
|
+
await P(e, t)();
|
|
917
|
+
} catch (t) {
|
|
918
|
+
throw e.isLoggingOut = !1, t;
|
|
894
919
|
}
|
|
895
|
-
let m = t.tokens?.idTokenPayload?.sub ?? null;
|
|
896
|
-
await t.destroyAsync("LOGGED_OUT");
|
|
897
|
-
for (let [, r] of Object.entries(n)) r === t ? t.publishEvent(e.logout_from_same_tab, {}) : await t.logoutSameTabAsync(t.configuration.client_id, m);
|
|
898
|
-
let h = P(s, ":oidc");
|
|
899
|
-
if (h && h.no_reload === "true") return;
|
|
900
|
-
let g = Se(s);
|
|
901
|
-
if (l.endSessionEndpoint) {
|
|
902
|
-
"id_token_hint" in g || (g.id_token_hint = p), !("post_logout_redirect_uri" in g) && o !== null && (g.post_logout_redirect_uri = f);
|
|
903
|
-
let e = "";
|
|
904
|
-
for (let [t, n] of Object.entries(g)) n != null && (e === "" ? e += "?" : e += "&", e += `${t}=${encodeURIComponent(n)}`);
|
|
905
|
-
a.open(`${l.endSessionEndpoint}${e}`);
|
|
906
|
-
} else a.reload();
|
|
907
920
|
}, F = /* @__PURE__ */ function(e) {
|
|
908
921
|
return e.AutomaticBeforeTokenExpiration = "AutomaticBeforeTokensExpiration", e.AutomaticOnlyWhenFetchExecuted = "AutomaticOnlyWhenFetchExecuted", e;
|
|
909
|
-
}({}),
|
|
922
|
+
}({}), De = (e, t, n = !1) => async (...r) => {
|
|
910
923
|
let [i, a, ...o] = r, s = a ? { ...a } : { method: "GET" }, c = new Headers();
|
|
911
924
|
s.headers && (c = s.headers instanceof Headers ? s.headers : new Headers(s.headers));
|
|
912
|
-
let l = (await
|
|
925
|
+
let l = (await Ve({
|
|
913
926
|
getTokens: () => t.tokens,
|
|
914
927
|
configuration: {
|
|
915
928
|
token_automatic_renew_mode: t.configuration.token_automatic_renew_mode,
|
|
@@ -932,25 +945,25 @@ var oe = () => {
|
|
|
932
945
|
...s,
|
|
933
946
|
headers: c
|
|
934
947
|
}, ...o);
|
|
935
|
-
},
|
|
948
|
+
}, Oe = (e) => async (t = !1, n = !1) => {
|
|
936
949
|
if (e.userInfo != null && !t) return e.userInfo;
|
|
937
950
|
let r = !t && e.configuration.storage?.getItem(`oidc.${e.configurationName}.userInfo`);
|
|
938
951
|
if (r) return e.userInfo = JSON.parse(r), e.userInfo;
|
|
939
952
|
let i = e.configuration, a = (await e.initAsync(i.authority, i.authority_configuration)).userInfoEndpoint, o = await (async () => {
|
|
940
|
-
let t = await
|
|
953
|
+
let t = await De(fetch, e, n)(a);
|
|
941
954
|
return t.status === 200 ? t.json() : null;
|
|
942
955
|
})();
|
|
943
956
|
return e.userInfo = o, o && e.configuration.storage?.setItem(`oidc.${e.configurationName}.userInfo`, JSON.stringify(o)), o;
|
|
944
|
-
},
|
|
957
|
+
}, ke = () => fetch, I = class {
|
|
945
958
|
constructor(e) {
|
|
946
959
|
this.authorizationEndpoint = e.authorization_endpoint, this.tokenEndpoint = e.token_endpoint, this.revocationEndpoint = e.revocation_endpoint, this.userInfoEndpoint = e.userinfo_endpoint, this.checkSessionIframe = e.check_session_iframe, this.issuer = e.issuer, this.endSessionEndpoint = e.end_session_endpoint;
|
|
947
960
|
}
|
|
948
|
-
}, L = {},
|
|
961
|
+
}, L = {}, Ae = (e, t = new O()) => (n, r = "default") => (L[r] || (L[r] = new R(n, r, e, t)), L[r]), je = async (e) => {
|
|
949
962
|
let { parsedTokens: t, callbackPath: n, extras: r, scope: i } = await e.loginCallbackAsync();
|
|
950
963
|
return e.timeoutId = z(e, t.expiresAt, r, i), { callbackPath: n };
|
|
951
|
-
},
|
|
964
|
+
}, Me = (e) => Math.floor(Math.random() * e), R = class t {
|
|
952
965
|
constructor(e, t = "default", n, r = new O()) {
|
|
953
|
-
this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.logoutPromise = null;
|
|
966
|
+
this.isLoggingOut = !1, this.initPromise = null, this.tryKeepExistingSessionPromise = null, this.loginPromise = null, this.loginCallbackPromise = null, this.loginCallbackWithAutoTokensRenewPromise = null, this.userInfoPromise = null, this.renewTokensPromise = null, this.clearSessionPromise = null, this.logoutPromise = null;
|
|
954
967
|
let i = e.silent_login_uri;
|
|
955
968
|
e.silent_redirect_uri && !e.silent_login_uri && (i = `${e.silent_redirect_uri.replace("-callback", "").replace("callback", "")}-login`);
|
|
956
969
|
let a = e.refresh_time_before_tokens_expiration_in_second ?? 120;
|
|
@@ -968,10 +981,10 @@ var oe = () => {
|
|
|
968
981
|
service_worker_activate: e.service_worker_activate ?? oe,
|
|
969
982
|
demonstrating_proof_of_possession_configuration: e.demonstrating_proof_of_possession_configuration ?? _,
|
|
970
983
|
preload_user_info: e.preload_user_info ?? !1
|
|
971
|
-
}, this.getFetch = n ??
|
|
984
|
+
}, this.getFetch = n ?? ke, this.configurationName = t, this.tokens = null, this.userInfo = null, this.events = [], this.timeoutId = null, this.loginCallbackWithAutoTokensRenewAsync.bind(this), this.initAsync.bind(this), this.loginCallbackAsync.bind(this), this.subscribeEvents.bind(this), this.removeEventSubscription.bind(this), this.publishEvent.bind(this), this.destroyAsync.bind(this), this.logoutAsync.bind(this), this.renewTokensAsync.bind(this), this.initAsync(this.configuration.authority, this.configuration.authority_configuration);
|
|
972
985
|
}
|
|
973
986
|
subscribeEvents(e) {
|
|
974
|
-
let t =
|
|
987
|
+
let t = Me(9999999999999).toString();
|
|
975
988
|
return this.events.push({
|
|
976
989
|
id: t,
|
|
977
990
|
func: e
|
|
@@ -987,7 +1000,7 @@ var oe = () => {
|
|
|
987
1000
|
});
|
|
988
1001
|
}
|
|
989
1002
|
static {
|
|
990
|
-
this.getOrCreate = (e, t) => (n, r = "default") =>
|
|
1003
|
+
this.getOrCreate = (e, t) => (n, r = "default") => Ae(e, t)(n, r);
|
|
991
1004
|
}
|
|
992
1005
|
static get(e = "default") {
|
|
993
1006
|
return Object.prototype.hasOwnProperty.call(L, e) ? L[e] : null;
|
|
@@ -1003,7 +1016,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1003
1016
|
}
|
|
1004
1017
|
_silentLoginCallbackFromIFrame() {
|
|
1005
1018
|
if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
|
|
1006
|
-
let e = this.location, t =
|
|
1019
|
+
let e = this.location, t = M(e.getCurrentHref());
|
|
1007
1020
|
window.parent.postMessage(`${this.configurationName}_oidc_tokens:${JSON.stringify({
|
|
1008
1021
|
tokens: this.tokens,
|
|
1009
1022
|
sessionState: t.session_state
|
|
@@ -1012,7 +1025,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1012
1025
|
}
|
|
1013
1026
|
_silentLoginErrorCallbackFromIFrame(e = null) {
|
|
1014
1027
|
if (this.configuration.silent_redirect_uri && this.configuration.silent_login_uri) {
|
|
1015
|
-
let t = this.location, n =
|
|
1028
|
+
let t = this.location, n = M(t.getCurrentHref());
|
|
1016
1029
|
n.error ? window.parent.postMessage(`${this.configurationName}_oidc_error:${JSON.stringify({ error: n.error })}`, t.getOrigin()) : window.parent.postMessage(`${this.configurationName}_oidc_exception:${JSON.stringify({ error: e == null ? "" : e.toString() })}`, t.getOrigin());
|
|
1017
1030
|
}
|
|
1018
1031
|
}
|
|
@@ -1051,14 +1064,14 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1051
1064
|
await d(this, L, this.configuration)(e, t, n, r);
|
|
1052
1065
|
}
|
|
1053
1066
|
async loginAsync(e = void 0, t = null, n = !1, r = void 0, i = !1) {
|
|
1054
|
-
return this.logoutPromise && await this.logoutPromise, this.loginPromise === null ? (i ? this.loginPromise = u(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(t, r) : this.loginPromise =
|
|
1067
|
+
return this.logoutPromise && await this.logoutPromise, this.loginPromise === null ? (i ? this.loginPromise = u(window, this.configurationName, this.configuration, this.publishEvent.bind(this), this)(t, r) : this.loginPromise = be(this.configurationName, this.configuration, this.publishEvent.bind(this), this.initAsync.bind(this), this.location)(e, t, n, r), this.loginPromise.finally(() => {
|
|
1055
1068
|
this.loginPromise = null;
|
|
1056
1069
|
})) : this.loginPromise;
|
|
1057
1070
|
}
|
|
1058
1071
|
async loginCallbackAsync(e = !1) {
|
|
1059
1072
|
if (this.loginCallbackPromise !== null) return this.loginCallbackPromise;
|
|
1060
1073
|
let n = async () => {
|
|
1061
|
-
let n = await
|
|
1074
|
+
let n = await xe(this)(e), r = n.tokens;
|
|
1062
1075
|
return this.tokens = r, await $(this.configuration, this.configurationName) || i(this.configurationName, this.configuration.storage, this.configuration.login_state_storage ?? this.configuration.storage).setTokens(r), this.publishEvent(t.eventNames.token_acquired, r), this.configuration.preload_user_info && await this.userInfoAsync(), {
|
|
1063
1076
|
parsedTokens: r,
|
|
1064
1077
|
state: n.state,
|
|
@@ -1076,28 +1089,33 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1076
1089
|
ath: await te(e),
|
|
1077
1090
|
...r
|
|
1078
1091
|
};
|
|
1079
|
-
if (await $(a, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${
|
|
1092
|
+
if (await $(a, this.configurationName)) return `DPOP_SECURED_BY_OIDC_SERVICE_WORKER_${this.configurationName}#tabId=${Ke(this.configurationName)}`;
|
|
1080
1093
|
let s = i(this.configurationName, a.storage, a.login_state_storage ?? a.storage), c = await s.getDemonstratingProofOfPossessionJwkAsync(), l = s.getDemonstratingProofOfPossessionNonce();
|
|
1081
1094
|
return l && (o.nonce = l), await S(window)(a.demonstrating_proof_of_possession_configuration)(c, n, t, o);
|
|
1082
1095
|
}
|
|
1083
1096
|
loginCallbackWithAutoTokensRenewAsync() {
|
|
1084
|
-
return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise =
|
|
1097
|
+
return this.loginCallbackWithAutoTokensRenewPromise === null ? (this.loginCallbackWithAutoTokensRenewPromise = je(this), this.loginCallbackWithAutoTokensRenewPromise.finally(() => {
|
|
1085
1098
|
this.loginCallbackWithAutoTokensRenewPromise = null;
|
|
1086
1099
|
})) : this.loginCallbackWithAutoTokensRenewPromise;
|
|
1087
1100
|
}
|
|
1088
1101
|
userInfoAsync(e = !1, t = !1) {
|
|
1089
|
-
return this.userInfoPromise === null ? (this.userInfoPromise =
|
|
1102
|
+
return this.userInfoPromise === null ? (this.userInfoPromise = Oe(this)(e, t), this.userInfoPromise.finally(() => {
|
|
1090
1103
|
this.userInfoPromise = null;
|
|
1091
1104
|
})) : this.userInfoPromise;
|
|
1092
1105
|
}
|
|
1093
1106
|
async renewTokensAsync(e = null, t = null) {
|
|
1094
1107
|
if (this.renewTokensPromise !== null) return this.renewTokensPromise;
|
|
1095
|
-
if (this.timeoutId) return c.clearTimeout(this.timeoutId), this.renewTokensPromise =
|
|
1108
|
+
if (this.timeoutId) return c.clearTimeout(this.timeoutId), this.renewTokensPromise = Pe(this, !0, e, t), this.renewTokensPromise.finally(() => {
|
|
1096
1109
|
this.renewTokensPromise = null;
|
|
1097
1110
|
});
|
|
1098
1111
|
}
|
|
1099
1112
|
async destroyAsync(e) {
|
|
1100
|
-
return await
|
|
1113
|
+
return await we(this)(e);
|
|
1114
|
+
}
|
|
1115
|
+
async clearSessionAsync() {
|
|
1116
|
+
return this.clearSessionPromise ? this.clearSessionPromise : (this.clearSessionPromise = P(this, L)(), this.clearSessionPromise.finally(() => {
|
|
1117
|
+
this.clearSessionPromise = null;
|
|
1118
|
+
}));
|
|
1101
1119
|
}
|
|
1102
1120
|
async logoutSameTabAsync(t, n) {
|
|
1103
1121
|
this.configuration.monitor_session && this.configuration.client_id === t && n && this.tokens && this.tokens.idTokenPayload && this.tokens.idTokenPayload.sub === n && (await this.destroyAsync("LOGGED_OUT"), this.publishEvent(e.logout_from_same_tab, {
|
|
@@ -1112,25 +1130,25 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
|
|
|
1112
1130
|
}));
|
|
1113
1131
|
}
|
|
1114
1132
|
async logoutAsync(e = void 0, t = null) {
|
|
1115
|
-
return this.logoutPromise ? this.logoutPromise : (this.logoutPromise =
|
|
1133
|
+
return this.logoutPromise ? this.logoutPromise : (this.logoutPromise = Ee(this, L, this.getFetch(), console, this.location)(e, t), this.logoutPromise.finally(() => {
|
|
1116
1134
|
this.logoutPromise = null;
|
|
1117
1135
|
}));
|
|
1118
1136
|
}
|
|
1119
1137
|
};
|
|
1120
1138
|
//#endregion
|
|
1121
1139
|
//#region src/renewTokens.ts
|
|
1122
|
-
async function
|
|
1140
|
+
async function Ne(e, t, n, r = null) {
|
|
1123
1141
|
let { tokens: a, status: o } = await H(e)((t) => {
|
|
1124
1142
|
e.tokens = t;
|
|
1125
1143
|
}, 0, 0, t, n, r);
|
|
1126
1144
|
return await $(e.configuration, e.configurationName) || i(e.configurationName, e.configuration.storage, e.configuration.login_state_storage ?? e.configuration.storage).setTokens(e.tokens), e.tokens ? a : (await e.destroyAsync(o), null);
|
|
1127
1145
|
}
|
|
1128
|
-
async function
|
|
1146
|
+
async function Pe(e, t = !1, n = null, r = null) {
|
|
1129
1147
|
let i = e.configuration, a = `${i.client_id}_${e.configurationName}_${i.authority}`, o, s = await $(e.configuration, e.configurationName);
|
|
1130
|
-
if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await
|
|
1148
|
+
if (i?.storage === window?.sessionStorage && !s || !navigator.locks) o = await Ne(e, t, n, r);
|
|
1131
1149
|
else {
|
|
1132
1150
|
let i = "retry";
|
|
1133
|
-
for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await
|
|
1151
|
+
for (; i === "retry";) i = await navigator.locks.request(a, { ifAvailable: !0 }, async (i) => i ? await Ne(e, t, n, r) : (e.publishEvent(R.eventNames.syncTokensAsync_lock_not_available, { lock: "lock not available" }), "retry"));
|
|
1134
1152
|
o = i;
|
|
1135
1153
|
}
|
|
1136
1154
|
return o ? (e.timeoutId &&= z(e, e.tokens.expiresAt, n, r), e.tokens) : null;
|
|
@@ -1139,7 +1157,7 @@ var z = (e, t, n = null, r = null) => {
|
|
|
1139
1157
|
let i = e.configuration.refresh_time_before_tokens_expiration_in_second;
|
|
1140
1158
|
return e.timeoutId && c.clearTimeout(e.timeoutId), c.setTimeout(async () => {
|
|
1141
1159
|
let a = { timeLeft: K(i, t) };
|
|
1142
|
-
e.publishEvent(R.eventNames.token_timer, a), await
|
|
1160
|
+
e.publishEvent(R.eventNames.token_timer, a), await Pe(e, !1, n, r);
|
|
1143
1161
|
}, 1e3);
|
|
1144
1162
|
}, B = {
|
|
1145
1163
|
FORCE_REFRESH: "FORCE_REFRESH",
|
|
@@ -1301,9 +1319,9 @@ var z = (e, t, n = null, r = null) => {
|
|
|
1301
1319
|
refresh_token: u.refreshToken
|
|
1302
1320
|
}, a = await t.initAsync(v, h.authority_configuration), l = document.hidden ? 1e4 : 3e4 * 10, _ = a.tokenEndpoint, b = {};
|
|
1303
1321
|
h.demonstrating_proof_of_possession && (b.DPoP = await t.generateDemonstrationOfProofOfPossessionAsync(u.accessToken, _, "POST"));
|
|
1304
|
-
let x = await
|
|
1322
|
+
let x = await me(t.getFetch())(_, r, y, u, b, h.token_renew_mode, l);
|
|
1305
1323
|
if (x.success) {
|
|
1306
|
-
let { isValid: r, reason: o } =
|
|
1324
|
+
let { isValid: r, reason: o } = He(x.data, d.nonce, a);
|
|
1307
1325
|
if (!r) return n(null), t.publishEvent(e.refreshTokensAsync_error, { message: `refresh token return not valid tokens, reason: ${o}` }), {
|
|
1308
1326
|
tokens: null,
|
|
1309
1327
|
status: "SESSION_LOST"
|
|
@@ -1336,29 +1354,29 @@ var z = (e, t, n = null, r = null) => {
|
|
|
1336
1354
|
}, 1e3);
|
|
1337
1355
|
});
|
|
1338
1356
|
}
|
|
1339
|
-
},
|
|
1357
|
+
}, Fe = (e) => decodeURIComponent(Array.prototype.map.call(atob(e), (e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)).join("")), Ie = (e) => JSON.parse(Fe(e.replaceAll(/-/g, "+").replaceAll(/_/g, "/"))), Le = (e) => {
|
|
1340
1358
|
try {
|
|
1341
|
-
return e &&
|
|
1359
|
+
return e && Re(e, ".") === 2 ? Ie(e.split(".")[1]) : null;
|
|
1342
1360
|
} catch (e) {
|
|
1343
1361
|
console.warn(e);
|
|
1344
1362
|
}
|
|
1345
1363
|
return null;
|
|
1346
|
-
},
|
|
1364
|
+
}, Re = (e, t) => e.split(t).length - 1, U = {
|
|
1347
1365
|
access_token_or_id_token_invalid: "access_token_or_id_token_invalid",
|
|
1348
1366
|
access_token_invalid: "access_token_invalid",
|
|
1349
1367
|
id_token_invalid: "id_token_invalid"
|
|
1350
1368
|
};
|
|
1351
|
-
function
|
|
1369
|
+
function ze(e, t, n) {
|
|
1352
1370
|
return e.issuedAt ? typeof e.issuedAt == "string" ? parseInt(e.issuedAt, 10) : e.issuedAt : t && t.iat ? t.iat : n && n.iat ? n.iat : (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
1353
1371
|
}
|
|
1354
1372
|
var W = (e, t = null, n) => {
|
|
1355
1373
|
if (!e) return null;
|
|
1356
1374
|
let r, i = typeof e.expiresIn == "string" ? parseInt(e.expiresIn, 10) : e.expiresIn;
|
|
1357
|
-
r = e.accessTokenPayload === void 0 ?
|
|
1375
|
+
r = e.accessTokenPayload === void 0 ? Le(e.accessToken) : e.accessTokenPayload;
|
|
1358
1376
|
let a;
|
|
1359
1377
|
a = t != null && "idToken" in t && !("idToken" in e) ? t.idToken : e.idToken;
|
|
1360
|
-
let o = e.idTokenPayload ? e.idTokenPayload :
|
|
1361
|
-
e.issuedAt =
|
|
1378
|
+
let o = e.idTokenPayload ? e.idTokenPayload : Le(a), s = o && o.exp ? o.exp : Number.MAX_VALUE, c = r && r.exp ? r.exp : e.issuedAt + i;
|
|
1379
|
+
e.issuedAt = ze(e, r, o);
|
|
1362
1380
|
let l;
|
|
1363
1381
|
l = e.expiresAt ? e.expiresAt : n === U.access_token_invalid ? c : n === U.id_token_invalid || s < c ? s : c;
|
|
1364
1382
|
let u = {
|
|
@@ -1391,7 +1409,7 @@ var W = (e, t = null, n) => {
|
|
|
1391
1409
|
}, K = (e, t) => {
|
|
1392
1410
|
let n = t - (/* @__PURE__ */ new Date()).getTime() / 1e3;
|
|
1393
1411
|
return Math.round(n - e);
|
|
1394
|
-
},
|
|
1412
|
+
}, Be = (e, t = 0) => e ? K(t, e.expiresAt) > 0 : !1, Ve = async (e, t = 200, n = 50) => {
|
|
1395
1413
|
let r = n, i = await e.syncTokensInfoAsync();
|
|
1396
1414
|
for (; [
|
|
1397
1415
|
B.REQUIRE_SYNC_TOKENS,
|
|
@@ -1405,11 +1423,11 @@ var W = (e, t = null, n) => {
|
|
|
1405
1423
|
--r, i = await e.syncTokensInfoAsync();
|
|
1406
1424
|
}
|
|
1407
1425
|
return {
|
|
1408
|
-
isTokensValid:
|
|
1426
|
+
isTokensValid: Be(e.getTokens()),
|
|
1409
1427
|
tokens: e.getTokens(),
|
|
1410
1428
|
numberWaited: r - n
|
|
1411
1429
|
};
|
|
1412
|
-
},
|
|
1430
|
+
}, He = (e, t, n) => {
|
|
1413
1431
|
if (e.idTokenPayload) {
|
|
1414
1432
|
let r = e.idTokenPayload;
|
|
1415
1433
|
if (n.issuer !== r.iss) return {
|
|
@@ -1435,25 +1453,25 @@ var W = (e, t = null, n) => {
|
|
|
1435
1453
|
isValid: !0,
|
|
1436
1454
|
reason: ""
|
|
1437
1455
|
};
|
|
1438
|
-
},
|
|
1456
|
+
}, Ue = "7.27.17", We = null, q, J = ({ milliseconds: e }) => new Promise((t) => c.setTimeout(t, e)), Ge = (e = "/") => {
|
|
1439
1457
|
try {
|
|
1440
1458
|
q = new AbortController(), fetch(`${e}OidcKeepAliveServiceWorker.json?minSleepSeconds=150`, { signal: q.signal }).catch((e) => {
|
|
1441
1459
|
console.log(e);
|
|
1442
|
-
}), J({ milliseconds: 150 * 1e3 }).then(() =>
|
|
1460
|
+
}), J({ milliseconds: 150 * 1e3 }).then(() => Ge(e));
|
|
1443
1461
|
} catch (e) {
|
|
1444
1462
|
console.log(e);
|
|
1445
1463
|
}
|
|
1446
1464
|
}, Y = () => {
|
|
1447
1465
|
q && q.abort();
|
|
1448
|
-
},
|
|
1466
|
+
}, Ke = (e) => {
|
|
1449
1467
|
let t = `oidc.tabId.${e}`, n = sessionStorage.getItem(t);
|
|
1450
1468
|
if (n) return n;
|
|
1451
1469
|
let r = globalThis.crypto.randomUUID();
|
|
1452
1470
|
return sessionStorage.setItem(t, r), r;
|
|
1453
|
-
},
|
|
1471
|
+
}, qe = (e) => navigator.serviceWorker.controller ?? e.active ?? e.waiting ?? e.installing ?? null, X = (e, t) => (n) => {
|
|
1454
1472
|
let r = t?.timeoutMs ?? 5e3;
|
|
1455
1473
|
return new Promise((t, i) => {
|
|
1456
|
-
let a =
|
|
1474
|
+
let a = qe(e);
|
|
1457
1475
|
if (!a) {
|
|
1458
1476
|
i(/* @__PURE__ */ Error("Service worker target not available (controller/active/waiting/installing missing)"));
|
|
1459
1477
|
return;
|
|
@@ -1474,39 +1492,39 @@ var W = (e, t = null, n) => {
|
|
|
1474
1492
|
let e = n?.configurationName;
|
|
1475
1493
|
a.postMessage({
|
|
1476
1494
|
...n,
|
|
1477
|
-
tabId:
|
|
1495
|
+
tabId: Ke(e ?? "default")
|
|
1478
1496
|
}, [o.port2]);
|
|
1479
1497
|
} catch (e) {
|
|
1480
1498
|
l(), i(e);
|
|
1481
1499
|
}
|
|
1482
1500
|
});
|
|
1483
|
-
},
|
|
1501
|
+
}, Je = async (e) => navigator.serviceWorker.controller ? navigator.serviceWorker.controller : new Promise((t) => {
|
|
1484
1502
|
let n = !1, r = () => {
|
|
1485
1503
|
n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
|
|
1486
1504
|
};
|
|
1487
1505
|
navigator.serviceWorker.addEventListener("controllerchange", r), c.setTimeout(() => {
|
|
1488
1506
|
n || (n = !0, navigator.serviceWorker.removeEventListener("controllerchange", r), t(navigator.serviceWorker.controller ?? null));
|
|
1489
1507
|
}, e);
|
|
1490
|
-
}),
|
|
1508
|
+
}), Ye = !1, Z = !1, Q = /* @__PURE__ */ new Map(), Xe = "oidc.sw.controllerchange_reload_count", Ze = 3, Qe = () => {
|
|
1491
1509
|
try {
|
|
1492
|
-
return parseInt(sessionStorage.getItem(
|
|
1510
|
+
return parseInt(sessionStorage.getItem(Xe) ?? "0", 10);
|
|
1493
1511
|
} catch {
|
|
1494
1512
|
return 0;
|
|
1495
1513
|
}
|
|
1496
|
-
},
|
|
1497
|
-
let e =
|
|
1514
|
+
}, $e = () => {
|
|
1515
|
+
let e = Qe() + 1;
|
|
1498
1516
|
try {
|
|
1499
|
-
sessionStorage.setItem(
|
|
1517
|
+
sessionStorage.setItem(Xe, String(e));
|
|
1500
1518
|
} catch {}
|
|
1501
1519
|
return e;
|
|
1502
|
-
},
|
|
1520
|
+
}, et = () => {
|
|
1503
1521
|
try {
|
|
1504
|
-
sessionStorage.removeItem(
|
|
1522
|
+
sessionStorage.removeItem(Xe);
|
|
1505
1523
|
} catch {}
|
|
1506
1524
|
}, $ = async (e, t) => {
|
|
1507
1525
|
let n = e.service_worker_relative_url;
|
|
1508
1526
|
if (typeof window > "u" || typeof navigator > "u" || !navigator.serviceWorker || !n || e.service_worker_activate() === !1) return null;
|
|
1509
|
-
let r = `${n}?v=${
|
|
1527
|
+
let r = `${n}?v=${Ue}`, i = null;
|
|
1510
1528
|
e.service_worker_register ? (Q.has(n) || Q.set(n, e.service_worker_register(n)), i = await Q.get(n)) : (Q.has(r) || Q.set(r, navigator.serviceWorker.register(r, { updateViaCache: "none" })), i = await Q.get(r));
|
|
1511
1529
|
let a = `oidc.sw.version_mismatch_reload.${t}`, o = async (e) => {
|
|
1512
1530
|
Y(), console.log("New SW waiting – SKIP_WAITING");
|
|
@@ -1529,7 +1547,7 @@ var W = (e, t = null, n) => {
|
|
|
1529
1547
|
type: "SKIP_WAITING",
|
|
1530
1548
|
configurationName: t,
|
|
1531
1549
|
data: null,
|
|
1532
|
-
tabId:
|
|
1550
|
+
tabId: Ke(t ?? "default")
|
|
1533
1551
|
}, [i.port2]);
|
|
1534
1552
|
} catch (e) {
|
|
1535
1553
|
o(), r(e);
|
|
@@ -1544,7 +1562,7 @@ var W = (e, t = null, n) => {
|
|
|
1544
1562
|
}, l = (e) => {
|
|
1545
1563
|
Y(), e.addEventListener("statechange", async () => {
|
|
1546
1564
|
if (e.state === "installed" && navigator.serviceWorker.controller) {
|
|
1547
|
-
if (
|
|
1565
|
+
if (Qe() >= Ze) {
|
|
1548
1566
|
console.warn("SW trackInstallingWorker: skipping SKIP_WAITING because the reload budget is exhausted");
|
|
1549
1567
|
return;
|
|
1550
1568
|
}
|
|
@@ -1555,7 +1573,7 @@ var W = (e, t = null, n) => {
|
|
|
1555
1573
|
i.addEventListener("updatefound", () => {
|
|
1556
1574
|
let e = i.installing;
|
|
1557
1575
|
e && l(e);
|
|
1558
|
-
}), i.installing ? l(i.installing) : i.waiting && navigator.serviceWorker.controller && (
|
|
1576
|
+
}), i.installing ? l(i.installing) : i.waiting && navigator.serviceWorker.controller && (Qe() < Ze ? s() : console.warn("SW: a waiting worker exists but reload budget is exhausted – skipping activation")), i.update().catch((e) => {
|
|
1559
1577
|
console.error(e);
|
|
1560
1578
|
});
|
|
1561
1579
|
try {
|
|
@@ -1563,14 +1581,14 @@ var W = (e, t = null, n) => {
|
|
|
1563
1581
|
type: "claim",
|
|
1564
1582
|
configurationName: t,
|
|
1565
1583
|
data: null
|
|
1566
|
-
}), await
|
|
1584
|
+
}), await Je(2e3));
|
|
1567
1585
|
} catch (e) {
|
|
1568
1586
|
return console.warn(`Failed init ServiceWorker ${e?.toString?.() ?? String(e)}`), null;
|
|
1569
1587
|
}
|
|
1570
|
-
|
|
1588
|
+
Ye || (Ye = !0, navigator.serviceWorker.addEventListener("controllerchange", () => {
|
|
1571
1589
|
if (Z) return;
|
|
1572
|
-
let e =
|
|
1573
|
-
if (e >
|
|
1590
|
+
let e = $e();
|
|
1591
|
+
if (e > Ze) {
|
|
1574
1592
|
console.warn(`SW controllerchange: reload budget exhausted (${e - 1} reloads). Skipping reload to avoid infinite loop.`);
|
|
1575
1593
|
return;
|
|
1576
1594
|
}
|
|
@@ -1593,8 +1611,8 @@ var W = (e, t = null, n) => {
|
|
|
1593
1611
|
},
|
|
1594
1612
|
configurationName: t
|
|
1595
1613
|
}), c = o.version;
|
|
1596
|
-
if (c !== "7.27.
|
|
1597
|
-
console.warn(`Service worker ${c} version mismatch with js client version ${
|
|
1614
|
+
if (c !== "7.27.17") {
|
|
1615
|
+
console.warn(`Service worker ${c} version mismatch with js client version ${Ue}, unregistering and reloading`);
|
|
1598
1616
|
let e = parseInt(sessionStorage.getItem(a) ?? "0", 10);
|
|
1599
1617
|
if (e < 3) {
|
|
1600
1618
|
if (sessionStorage.setItem(a, String(e + 1)), i.waiting) return await s(), await J({ milliseconds: 500 }), Z || (Z = !0, window.location.reload()), new Promise(() => {});
|
|
@@ -1609,13 +1627,13 @@ var W = (e, t = null, n) => {
|
|
|
1609
1627
|
return console.log(`Service worker unregistering ${e}`), await J({ milliseconds: 500 }), Z || (Z = !0, window.location.reload()), new Promise(() => {});
|
|
1610
1628
|
}
|
|
1611
1629
|
} else console.error(`Service worker version mismatch persists after ${e} attempt(s). Continuing with mismatched version.`);
|
|
1612
|
-
} else sessionStorage.removeItem(a),
|
|
1630
|
+
} else sessionStorage.removeItem(a), et();
|
|
1613
1631
|
return {
|
|
1614
1632
|
tokens: G(o.tokens, null, r.token_renew_mode),
|
|
1615
1633
|
status: o.status
|
|
1616
1634
|
};
|
|
1617
1635
|
}, f = (e = "/") => {
|
|
1618
|
-
|
|
1636
|
+
We ?? (We = "not_null", Ge(e));
|
|
1619
1637
|
}, p = (e) => X(i)({
|
|
1620
1638
|
type: "setSessionState",
|
|
1621
1639
|
data: { sessionState: e },
|
|
@@ -1721,11 +1739,11 @@ var W = (e, t = null, n) => {
|
|
|
1721
1739
|
configurationName: e.configurationName ?? t
|
|
1722
1740
|
})
|
|
1723
1741
|
};
|
|
1724
|
-
},
|
|
1742
|
+
}, tt = async (e, t, n, r) => {
|
|
1725
1743
|
let i = await $(e, t);
|
|
1726
1744
|
if (!i) throw Error(`signalServiceWorkerAsync: no service worker registered for configuration "${t}"`);
|
|
1727
1745
|
return i.signalAsync(n, r);
|
|
1728
|
-
},
|
|
1746
|
+
}, nt = class e {
|
|
1729
1747
|
constructor(e) {
|
|
1730
1748
|
this._oidc = e;
|
|
1731
1749
|
}
|
|
@@ -1760,6 +1778,12 @@ var W = (e, t = null, n) => {
|
|
|
1760
1778
|
logoutAsync(e = void 0, t = null) {
|
|
1761
1779
|
return this._oidc.logoutAsync(e, t);
|
|
1762
1780
|
}
|
|
1781
|
+
clearSessionAsync() {
|
|
1782
|
+
return this._oidc.clearSessionAsync();
|
|
1783
|
+
}
|
|
1784
|
+
get isLoggingOut() {
|
|
1785
|
+
return this._oidc.isLoggingOut === !0;
|
|
1786
|
+
}
|
|
1763
1787
|
silentLoginCallbackAsync() {
|
|
1764
1788
|
return this._oidc.silentLoginCallbackAsync();
|
|
1765
1789
|
}
|
|
@@ -1780,7 +1804,7 @@ var W = (e, t = null, n) => {
|
|
|
1780
1804
|
}
|
|
1781
1805
|
async getValidTokenAsync(e = 200, t = 50) {
|
|
1782
1806
|
let n = this._oidc;
|
|
1783
|
-
return
|
|
1807
|
+
return Ve({
|
|
1784
1808
|
getTokens: () => n.tokens,
|
|
1785
1809
|
configuration: {
|
|
1786
1810
|
token_automatic_renew_mode: n.configuration.token_automatic_renew_mode,
|
|
@@ -1794,7 +1818,7 @@ var W = (e, t = null, n) => {
|
|
|
1794
1818
|
}, e, t);
|
|
1795
1819
|
}
|
|
1796
1820
|
fetchWithTokens(e, t = !1) {
|
|
1797
|
-
return
|
|
1821
|
+
return De(e, this._oidc, t);
|
|
1798
1822
|
}
|
|
1799
1823
|
async userInfoAsync(e = !1, t = !1) {
|
|
1800
1824
|
return this._oidc.userInfoAsync(e, t);
|
|
@@ -1803,9 +1827,9 @@ var W = (e, t = null, n) => {
|
|
|
1803
1827
|
return this._oidc.userInfo;
|
|
1804
1828
|
}
|
|
1805
1829
|
async signalServiceWorker(e, t) {
|
|
1806
|
-
return
|
|
1830
|
+
return tt(this._oidc.configuration, this._oidc.configurationName, e, t);
|
|
1807
1831
|
}
|
|
1808
|
-
},
|
|
1832
|
+
}, rt = "1.0.0", it = {
|
|
1809
1833
|
SKIP_WAITING: "SKIP_WAITING",
|
|
1810
1834
|
CLAIM: "claim",
|
|
1811
1835
|
CLEAR: "clear",
|
|
@@ -1822,18 +1846,18 @@ var W = (e, t = null, n) => {
|
|
|
1822
1846
|
GET_DPOP_NONCE: "getDemonstratingProofOfPossessionNonce",
|
|
1823
1847
|
SET_DPOP_JWK: "setDemonstratingProofOfPossessionJwk",
|
|
1824
1848
|
GET_DPOP_JWK: "getDemonstratingProofOfPossessionJwk"
|
|
1825
|
-
},
|
|
1849
|
+
}, at = {
|
|
1826
1850
|
ACCESS_TOKEN: "ACCESS_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER",
|
|
1827
1851
|
REFRESH_TOKEN: "REFRESH_TOKEN_SECURED_BY_OIDC_SERVICE_WORKER",
|
|
1828
1852
|
NONCE_TOKEN: "NONCE_SECURED_BY_OIDC_SERVICE_WORKER",
|
|
1829
1853
|
CODE_VERIFIER: "CODE_VERIFIER_SECURED_BY_OIDC_SERVICE_WORKER"
|
|
1830
|
-
},
|
|
1854
|
+
}, ot = "DPOP_SECURED_BY_OIDC_SERVICE_WORKER", st = {
|
|
1831
1855
|
TAB_ID: "oidc.tabId.",
|
|
1832
1856
|
STATE: "oidc.state.",
|
|
1833
1857
|
NONCE: "oidc.nonce.",
|
|
1834
1858
|
CODE_VERIFIER: "oidc.code_verifier.",
|
|
1835
1859
|
LOGIN_PARAMS: "oidc.login.",
|
|
1836
1860
|
SW_VERSION_MISMATCH_RELOAD: "oidc.sw.version_mismatch_reload."
|
|
1837
|
-
},
|
|
1861
|
+
}, ct = "oidc.sw.controllerchange_reload_count", lt = (e, t) => `${e}${t}`, ut = (e, t, n = "default") => `${e}_${t}#tabId=${n}`, dt = (e, t = "default") => `${ot}_${e}#tabId=${t}`, ft = (e) => typeof e == "string" ? Object.values(it).includes(e) : !1;
|
|
1838
1862
|
//#endregion
|
|
1839
|
-
export {
|
|
1863
|
+
export { ot as DPOP_TOKEN_PLACEHOLDER_PREFIX, nt as OidcClient, O as OidcLocation, rt as PROTOCOL_VERSION, st as STORAGE_KEY_PREFIX, ct as SW_CONTROLLER_CHANGE_RELOAD_COUNT_KEY, it as ServiceWorkerMessageType, at as TOKEN_PLACEHOLDERS, F as TokenAutomaticRenewMode, U as TokenRenewMode, dt as buildDpopSecuredPlaceholder, ut as buildSecuredTokenPlaceholder, lt as buildStorageKey, ke as getFetchDefault, M as getParseQueryStringFromLocation, ve as getPath, ft as isServiceWorkerMessageType, tt as signalServiceWorkerAsync };
|