oidc-spa 6.15.1 → 7.0.0
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/README.md +12 -13
- package/core/Oidc.d.ts +24 -12
- package/core/createOidc.d.ts +15 -30
- package/core/createOidc.js +131 -123
- package/core/createOidc.js.map +1 -1
- package/core/handleOidcCallback.js +2 -29
- package/core/handleOidcCallback.js.map +1 -1
- package/core/loginOrGoToAuthServer.d.ts +1 -2
- package/core/loginOrGoToAuthServer.js +10 -10
- package/core/loginOrGoToAuthServer.js.map +1 -1
- package/core/loginSilent.d.ts +1 -1
- package/core/loginSilent.js +4 -4
- package/core/loginSilent.js.map +1 -1
- package/core/oidcClientTsUserToTokens.d.ts +1 -2
- package/core/oidcClientTsUserToTokens.js +93 -58
- package/core/oidcClientTsUserToTokens.js.map +1 -1
- package/mock/oidc.d.ts +1 -1
- package/mock/oidc.js +29 -19
- package/mock/oidc.js.map +1 -1
- package/package.json +1 -5
- package/react/react.d.ts +1 -7
- package/react/react.js +8 -59
- package/react/react.js.map +1 -1
- package/src/core/Oidc.ts +27 -14
- package/src/core/createOidc.ts +121 -119
- package/src/core/handleOidcCallback.ts +2 -55
- package/src/core/loginOrGoToAuthServer.ts +10 -11
- package/src/core/loginSilent.ts +4 -4
- package/src/core/oidcClientTsUserToTokens.ts +129 -82
- package/src/mock/oidc.ts +16 -6
- package/src/react/react.tsx +11 -72
- package/src/tools/readExpirationTimeInJwt.ts +4 -5
- package/tools/readExpirationTimeInJwt.js +4 -4
- package/tools/readExpirationTimeInJwt.js.map +1 -1
- package/vendor/frontend/oidc-client-ts-and-jwt-decode.js +1 -1
- package/core/debug966975.d.ts +0 -7
- package/core/debug966975.js +0 -88
- package/core/debug966975.js.map +0 -1
- package/src/core/debug966975.ts +0 -85
package/core/debug966975.d.ts
DELETED
package/core/debug966975.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
-
if (!m) return o;
|
|
5
|
-
var i = m.call(o), r, ar = [], e;
|
|
6
|
-
try {
|
|
7
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
-
}
|
|
9
|
-
catch (error) { e = { error: error }; }
|
|
10
|
-
finally {
|
|
11
|
-
try {
|
|
12
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
-
}
|
|
14
|
-
finally { if (e) throw e.error; }
|
|
15
|
-
}
|
|
16
|
-
return ar;
|
|
17
|
-
};
|
|
18
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
-
if (ar || !(i in from)) {
|
|
21
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
-
ar[i] = from[i];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.debug966975 = void 0;
|
|
29
|
-
var getUserEnvironmentInfo_1 = require("../tools/getUserEnvironmentInfo");
|
|
30
|
-
var LOCAL_STORAGE_KEY = "oidc-spa_966975_diagnostic";
|
|
31
|
-
var appInstanceId = Math.random().toString(36).slice(2);
|
|
32
|
-
function log(message) {
|
|
33
|
-
var logEntry = {
|
|
34
|
-
appInstanceId: appInstanceId,
|
|
35
|
-
time: Date.now(),
|
|
36
|
-
message: message
|
|
37
|
-
};
|
|
38
|
-
var value = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
39
|
-
var value_parsed = value === null ? [] : JSON.parse(value);
|
|
40
|
-
if (value_parsed.length === 100) {
|
|
41
|
-
value_parsed.shift();
|
|
42
|
-
}
|
|
43
|
-
value_parsed.push(logEntry);
|
|
44
|
-
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(value_parsed));
|
|
45
|
-
}
|
|
46
|
-
function report() {
|
|
47
|
-
var logEntries = (function () {
|
|
48
|
-
var value = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
49
|
-
if (value === null) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
return JSON.parse(value);
|
|
53
|
-
})();
|
|
54
|
-
localStorage.removeItem(LOCAL_STORAGE_KEY);
|
|
55
|
-
var report = __spreadArray(__spreadArray([
|
|
56
|
-
(0, getUserEnvironmentInfo_1.getUserEnvironmentInfo)()
|
|
57
|
-
], __read(logEntries.map(function (_a) {
|
|
58
|
-
var appInstanceId = _a.appInstanceId, time = _a.time, message = _a.message;
|
|
59
|
-
return "".concat(appInstanceId, " (").concat(time, "): ").concat(message);
|
|
60
|
-
})), false), [
|
|
61
|
-
getOidcLocalStorageDump()
|
|
62
|
-
], false).join("\n");
|
|
63
|
-
var key_report = "".concat(LOCAL_STORAGE_KEY, "_report_b64");
|
|
64
|
-
localStorage.setItem(key_report, btoa(report));
|
|
65
|
-
console.warn([
|
|
66
|
-
"If you see this message there's been unexpected behavior in oidc-spa",
|
|
67
|
-
"It is a hard to reproduce case, could you please open an issue on https://github.com/keycloakify/oidc-spa",
|
|
68
|
-
"and include the value of `localStorage[\"".concat(key_report, "\"]` in the message?"),
|
|
69
|
-
"Alternatively, you can send an email at joseph.garrone@protonmail.com",
|
|
70
|
-
"Thanks in advance for helping me figure this out"
|
|
71
|
-
].join(" "));
|
|
72
|
-
}
|
|
73
|
-
exports.debug966975 = {
|
|
74
|
-
log: log,
|
|
75
|
-
report: report
|
|
76
|
-
};
|
|
77
|
-
function getOidcLocalStorageDump() {
|
|
78
|
-
var entries = [];
|
|
79
|
-
for (var i = 0; i < localStorage.length; i++) {
|
|
80
|
-
var key = localStorage.key(i);
|
|
81
|
-
if (key && key.startsWith("oidc.")) {
|
|
82
|
-
var value = localStorage.getItem(key);
|
|
83
|
-
entries.push("".concat(key, " = ").concat(value));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return entries.join("\n");
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=debug966975.js.map
|
package/core/debug966975.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug966975.js","sourceRoot":"","sources":["../src/core/debug966975.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAAyE;AAEzE,IAAM,iBAAiB,GAAG,4BAA4B,CAAC;AACvD,IAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAQ1D,SAAS,GAAG,CAAC,OAAe;IACxB,IAAM,QAAQ,GAAa;QACvB,aAAa,eAAA;QACb,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE;QAChB,OAAO,SAAA;KACV,CAAC;IAEF,IAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEtD,IAAM,YAAY,GAAe,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEzE,IAAI,YAAY,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC9B,YAAY,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE5B,YAAY,CAAC,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,MAAM;IACX,IAAM,UAAU,GAAe,CAAC;QAC5B,IAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAEtD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;Y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G,gBAAM,KAAK,CAAE,CAAC,CAAC;QACtC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC"}
|
package/src/core/debug966975.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { getUserEnvironmentInfo } from "../tools/getUserEnvironmentInfo";
|
|
2
|
-
|
|
3
|
-
const LOCAL_STORAGE_KEY = "oidc-spa_966975_diagnostic";
|
|
4
|
-
const appInstanceId = Math.random().toString(36).slice(2);
|
|
5
|
-
|
|
6
|
-
type LogEntry = {
|
|
7
|
-
appInstanceId: string;
|
|
8
|
-
time: number;
|
|
9
|
-
message: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function log(message: string) {
|
|
13
|
-
const logEntry: LogEntry = {
|
|
14
|
-
appInstanceId,
|
|
15
|
-
time: Date.now(),
|
|
16
|
-
message
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const value = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
20
|
-
|
|
21
|
-
const value_parsed: LogEntry[] = value === null ? [] : JSON.parse(value);
|
|
22
|
-
|
|
23
|
-
if (value_parsed.length === 100) {
|
|
24
|
-
value_parsed.shift();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
value_parsed.push(logEntry);
|
|
28
|
-
|
|
29
|
-
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(value_parsed));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function report() {
|
|
33
|
-
const logEntries: LogEntry[] = (() => {
|
|
34
|
-
const value = localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
35
|
-
|
|
36
|
-
if (value === null) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return JSON.parse(value);
|
|
41
|
-
})();
|
|
42
|
-
|
|
43
|
-
localStorage.removeItem(LOCAL_STORAGE_KEY);
|
|
44
|
-
|
|
45
|
-
const report = [
|
|
46
|
-
getUserEnvironmentInfo(),
|
|
47
|
-
...logEntries.map(
|
|
48
|
-
({ appInstanceId, time, message }) => `${appInstanceId} (${time}): ${message}`
|
|
49
|
-
),
|
|
50
|
-
getOidcLocalStorageDump()
|
|
51
|
-
].join("\n");
|
|
52
|
-
|
|
53
|
-
const key_report = `${LOCAL_STORAGE_KEY}_report_b64`;
|
|
54
|
-
|
|
55
|
-
localStorage.setItem(key_report, btoa(report));
|
|
56
|
-
|
|
57
|
-
console.warn(
|
|
58
|
-
[
|
|
59
|
-
"If you see this message there's been unexpected behavior in oidc-spa",
|
|
60
|
-
"It is a hard to reproduce case, could you please open an issue on https://github.com/keycloakify/oidc-spa",
|
|
61
|
-
`and include the value of \`localStorage["${key_report}"]\` in the message?`,
|
|
62
|
-
"Alternatively, you can send an email at joseph.garrone@protonmail.com",
|
|
63
|
-
"Thanks in advance for helping me figure this out"
|
|
64
|
-
].join(" ")
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export const debug966975 = {
|
|
69
|
-
log,
|
|
70
|
-
report
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
function getOidcLocalStorageDump(): string {
|
|
74
|
-
const entries: string[] = [];
|
|
75
|
-
|
|
76
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
77
|
-
const key = localStorage.key(i);
|
|
78
|
-
if (key && key.startsWith("oidc.")) {
|
|
79
|
-
const value = localStorage.getItem(key);
|
|
80
|
-
entries.push(`${key} = ${value}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return entries.join("\n");
|
|
85
|
-
}
|