@deephaven/js-plugin-auth-keycloak 0.2.0 → 0.2.1-alpha-pivots.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.
Files changed (2) hide show
  1. package/dist/index.js +26 -43
  2. package/package.json +15 -18
package/dist/index.js CHANGED
@@ -3,17 +3,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require$$1 = require("react");
4
4
  const authPlugins = require("@deephaven/auth-plugins");
5
5
  const jsapiComponents = require("@deephaven/jsapi-components");
6
- const log$1 = require("@deephaven/log");
6
+ const Log = require("@deephaven/log");
7
7
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
8
- var jsxRuntimeExports = {};
9
- var jsxRuntime = {
10
- get exports() {
11
- return jsxRuntimeExports;
12
- },
13
- set exports(v) {
14
- jsxRuntimeExports = v;
15
- }
16
- };
8
+ function getDefaultExportFromCjs(x) {
9
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
10
+ }
11
+ var jsxRuntime = { exports: {} };
17
12
  var reactJsxRuntime_production_min = {};
18
13
  /*
19
14
  object-assign
@@ -104,20 +99,16 @@ function q(c, a, k) {
104
99
  void 0 !== k && (e = "" + k);
105
100
  void 0 !== a.key && (e = "" + a.key);
106
101
  void 0 !== a.ref && (l = a.ref);
107
- for (b in a)
108
- n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
109
- if (c && c.defaultProps)
110
- for (b in a = c.defaultProps, a)
111
- void 0 === d[b] && (d[b] = a[b]);
102
+ for (b in a) n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
103
+ if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
112
104
  return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
113
105
  }
114
106
  reactJsxRuntime_production_min.jsx = q;
115
107
  reactJsxRuntime_production_min.jsxs = q;
116
- (function(module2) {
117
- {
118
- module2.exports = reactJsxRuntime_production_min;
119
- }
120
- })(jsxRuntime);
108
+ {
109
+ jsxRuntime.exports = reactJsxRuntime_production_min;
110
+ }
111
+ var jsxRuntimeExports = jsxRuntime.exports;
121
112
  var base64Js = {};
122
113
  base64Js.byteLength = byteLength;
123
114
  base64Js.toByteArray = toByteArray;
@@ -138,8 +129,7 @@ function getLens(b64) {
138
129
  throw new Error("Invalid string. Length must be a multiple of 4");
139
130
  }
140
131
  var validLen = b64.indexOf("=");
141
- if (validLen === -1)
142
- validLen = len2;
132
+ if (validLen === -1) validLen = len2;
143
133
  var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
144
134
  return [validLen, placeHoldersLen];
145
135
  }
@@ -212,15 +202,7 @@ function fromByteArray(uint8) {
212
202
  }
213
203
  return parts.join("");
214
204
  }
215
- var sha256Exports = {};
216
- var sha256$1 = {
217
- get exports() {
218
- return sha256Exports;
219
- },
220
- set exports(v) {
221
- sha256Exports = v;
222
- }
223
- };
205
+ var sha256$1 = { exports: {} };
224
206
  /**
225
207
  * [js-sha256]{@link https://github.com/emn178/js-sha256}
226
208
  *
@@ -727,7 +709,8 @@ var sha256$1 = {
727
709
  }
728
710
  })();
729
711
  })(sha256$1);
730
- const sha256 = sha256Exports;
712
+ var sha256Exports = sha256$1.exports;
713
+ const sha256 = /* @__PURE__ */ getDefaultExportFromCjs(sha256Exports);
731
714
  if (typeof Promise === "undefined") {
732
715
  throw Error("Keycloak requires an environment that supports Promises. Make sure that you include the appropriate polyfill.");
733
716
  }
@@ -1192,7 +1175,7 @@ function Keycloak(config) {
1192
1175
  logInfo("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set");
1193
1176
  return true;
1194
1177
  }
1195
- var expiresIn = kc.tokenParsed["exp"] - Math.ceil(new Date().getTime() / 1e3) + kc.timeSkew;
1178
+ var expiresIn = kc.tokenParsed["exp"] - Math.ceil((/* @__PURE__ */ new Date()).getTime() / 1e3) + kc.timeSkew;
1196
1179
  if (minValidity) {
1197
1180
  if (isNaN(minValidity)) {
1198
1181
  throw "Invalid minValidity";
@@ -1229,12 +1212,12 @@ function Keycloak(config) {
1229
1212
  req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1230
1213
  req.withCredentials = true;
1231
1214
  params += "&client_id=" + encodeURIComponent(kc.clientId);
1232
- var timeLocal = new Date().getTime();
1215
+ var timeLocal = (/* @__PURE__ */ new Date()).getTime();
1233
1216
  req.onreadystatechange = function() {
1234
1217
  if (req.readyState == 4) {
1235
1218
  if (req.status == 200) {
1236
1219
  logInfo("[KEYCLOAK] Token refreshed");
1237
- timeLocal = (timeLocal + new Date().getTime()) / 2;
1220
+ timeLocal = (timeLocal + (/* @__PURE__ */ new Date()).getTime()) / 2;
1238
1221
  var tokenResponse = JSON.parse(req.responseText);
1239
1222
  setToken(tokenResponse["access_token"], tokenResponse["refresh_token"], tokenResponse["id_token"], timeLocal);
1240
1223
  kc.onAuthRefreshSuccess && kc.onAuthRefreshSuccess();
@@ -1300,7 +1283,7 @@ function Keycloak(config) {
1300
1283
  var code2 = oauth.code;
1301
1284
  var error = oauth.error;
1302
1285
  var prompt = oauth.prompt;
1303
- var timeLocal = new Date().getTime();
1286
+ var timeLocal = (/* @__PURE__ */ new Date()).getTime();
1304
1287
  if (oauth["kc_action_status"]) {
1305
1288
  kc.onActionUpdate && kc.onActionUpdate(oauth["kc_action_status"]);
1306
1289
  }
@@ -1343,7 +1326,7 @@ function Keycloak(config) {
1343
1326
  req.send(params);
1344
1327
  }
1345
1328
  function authSuccess(accessToken, refreshToken, idToken, fulfillPromise) {
1346
- timeLocal = (timeLocal + new Date().getTime()) / 2;
1329
+ timeLocal = (timeLocal + (/* @__PURE__ */ new Date()).getTime()) / 2;
1347
1330
  setToken(accessToken, refreshToken, idToken, timeLocal);
1348
1331
  if (useNonce && (kc.tokenParsed && kc.tokenParsed.nonce != oauth.storedNonce || kc.refreshTokenParsed && kc.refreshTokenParsed.nonce != oauth.storedNonce || kc.idTokenParsed && kc.idTokenParsed.nonce != oauth.storedNonce)) {
1349
1332
  logInfo("[KEYCLOAK] Invalid nonce, clearing token");
@@ -1539,7 +1522,7 @@ function Keycloak(config) {
1539
1522
  if (kc.timeSkew != null) {
1540
1523
  logInfo("[KEYCLOAK] Estimated time difference between browser and server is " + kc.timeSkew + " seconds");
1541
1524
  if (kc.onTokenExpired) {
1542
- var expiresIn = (kc.tokenParsed["exp"] - new Date().getTime() / 1e3 + kc.timeSkew) * 1e3;
1525
+ var expiresIn = (kc.tokenParsed["exp"] - (/* @__PURE__ */ new Date()).getTime() / 1e3 + kc.timeSkew) * 1e3;
1543
1526
  logInfo("[KEYCLOAK] Token expires in " + Math.round(expiresIn / 1e3) + " s");
1544
1527
  if (expiresIn <= 0) {
1545
1528
  kc.onTokenExpired();
@@ -1704,7 +1687,7 @@ function Keycloak(config) {
1704
1687
  var timeoutHandle = null;
1705
1688
  var timeoutPromise = new Promise(function(resolve, reject) {
1706
1689
  timeoutHandle = setTimeout(function() {
1707
- reject({ "error": errorMessage || "Promise is not settled within timeout of " + timeout + "ms" });
1690
+ reject({ "error": errorMessage });
1708
1691
  }, timeout);
1709
1692
  });
1710
1693
  return Promise.race([promise, timeoutPromise]).finally(function() {
@@ -2057,7 +2040,7 @@ function Keycloak(config) {
2057
2040
  localStorage.removeItem("kc-test");
2058
2041
  var cs = this;
2059
2042
  function clearExpired() {
2060
- var time = new Date().getTime();
2043
+ var time = (/* @__PURE__ */ new Date()).getTime();
2061
2044
  for (var i3 = 0; i3 < localStorage.length; i3++) {
2062
2045
  var key = localStorage.key(i3);
2063
2046
  if (key && key.indexOf("kc-callback-") == 0) {
@@ -2091,7 +2074,7 @@ function Keycloak(config) {
2091
2074
  cs.add = function(state) {
2092
2075
  clearExpired();
2093
2076
  var key = "kc-callback-" + state.state;
2094
- state.expires = new Date().getTime() + 60 * 60 * 1e3;
2077
+ state.expires = (/* @__PURE__ */ new Date()).getTime() + 60 * 60 * 1e3;
2095
2078
  localStorage.setItem(key, JSON.stringify(state));
2096
2079
  };
2097
2080
  };
@@ -2117,7 +2100,7 @@ function Keycloak(config) {
2117
2100
  setCookie(key, "", cookieExpiration(-100));
2118
2101
  };
2119
2102
  var cookieExpiration = function(minutes) {
2120
- var exp = new Date();
2103
+ var exp = /* @__PURE__ */ new Date();
2121
2104
  exp.setTime(exp.getTime() + minutes * 60 * 1e3);
2122
2105
  return exp;
2123
2106
  };
@@ -2155,7 +2138,7 @@ function Keycloak(config) {
2155
2138
  };
2156
2139
  }
2157
2140
  }
2158
- const log = log$1.Log.module("@deephaven/js-plugin-auth-keycloak.AuthPluginKeycloak");
2141
+ const log = Log.module("@deephaven/js-plugin-auth-keycloak.AuthPluginKeycloak");
2159
2142
  const OIDC_AUTH_TYPE = "io.deephaven.authentication.oidc.OidcAuthenticationHandler";
2160
2143
  const BASE_URL_PROPERTY = "authentication.oidc.keycloak.url";
2161
2144
  const REALM_PROPERTY = "authentication.oidc.keycloak.realm";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/js-plugin-auth-keycloak",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-alpha-pivots.0+3672c45",
4
4
  "description": "Deephaven Keycloak authentication plugin",
5
5
  "keywords": [
6
6
  "Deephaven",
@@ -15,35 +15,32 @@
15
15
  "main": "dist/index.js",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/deephaven/deephaven-js-plugins"
18
+ "url": "git+https://github.com/deephaven/deephaven-plugins"
19
19
  },
20
20
  "bugs": {
21
- "url": "https://github.com/deephaven/deephaven-js-plugins/issues"
21
+ "url": "https://github.com/deephaven/deephaven-plugins/issues"
22
22
  },
23
- "homepage": "https://github.com/deephaven/deephaven-js-plugins",
23
+ "homepage": "https://github.com/deephaven/deephaven-plugins",
24
24
  "scripts": {
25
25
  "start": "vite build --watch",
26
- "build": "vite build"
26
+ "build": "vite build",
27
+ "update-dh-packages": "node ../../../../tools/update-dh-packages.mjs"
27
28
  },
28
29
  "devDependencies": {
29
- "@types/plotly.js": "^2.12.18",
30
30
  "@types/react": "^17.0.2",
31
- "@vitejs/plugin-react-swc": "^3.0.0",
32
- "react": "^17.0.2",
33
- "typescript": "^4.5.4",
34
- "vite": "~4.1.4"
31
+ "react": "^17.0.2"
35
32
  },
36
33
  "peerDependencies": {
37
34
  "react": "^17.0.2"
38
35
  },
39
36
  "dependencies": {
40
- "@deephaven/auth-plugins": "^0.38.0",
41
- "@deephaven/components": "^0.38.0",
42
- "@deephaven/jsapi-bootstrap": "^0.38.0",
43
- "@deephaven/jsapi-components": "^0.38.0",
44
- "@deephaven/jsapi-types": "^0.38.0",
45
- "@deephaven/log": "^0.38.0",
46
- "@deephaven/utils": "^0.38.0",
37
+ "@deephaven/auth-plugins": "^0.40.0",
38
+ "@deephaven/components": "^0.40.0",
39
+ "@deephaven/jsapi-bootstrap": "^0.40.0",
40
+ "@deephaven/jsapi-components": "^0.40.0",
41
+ "@deephaven/jsapi-types": "^0.40.0",
42
+ "@deephaven/log": "^0.40.0",
43
+ "@deephaven/utils": "^0.40.0",
47
44
  "keycloak-js": "^21.0.2"
48
45
  },
49
46
  "publishConfig": {
@@ -52,5 +49,5 @@
52
49
  "files": [
53
50
  "dist"
54
51
  ],
55
- "gitHead": "8e77e7d23f2504358efae0b7adfe8eb686344215"
52
+ "gitHead": "3672c455111ffff5975520efd83e89f0f0476d2e"
56
53
  }