@multiplatform.one/keycloak-js 6.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/LICENSE +201 -0
- package/README.md +29 -0
- package/dist/keycloak-authz.d.ts +143 -0
- package/dist/keycloak-authz.js +296 -0
- package/dist/keycloak.d.ts +692 -0
- package/dist/keycloak.js +2192 -0
- package/package.json +43 -0
- package/patches/README.md +34 -0
- package/patches/timeout-overflow.patch +11 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@multiplatform.one/keycloak-js",
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"description": "Keycloak JS adapter vendored and patched (e.g. timeout overflow fix). Built from upstream keycloak-js at build time.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://gitlab.com/bitspur/frappe/multiplatform.one"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"patches",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./dist/keycloak.js",
|
|
17
|
+
"types": "./dist/keycloak.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/keycloak.d.ts",
|
|
21
|
+
"import": "./dist/keycloak.js",
|
|
22
|
+
"default": "./dist/keycloak.js"
|
|
23
|
+
},
|
|
24
|
+
"./authz": {
|
|
25
|
+
"types": "./dist/keycloak-authz.d.ts",
|
|
26
|
+
"import": "./dist/keycloak-authz.js",
|
|
27
|
+
"default": "./dist/keycloak-authz.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"js-sha256": "^0.11.1",
|
|
35
|
+
"jwt-decode": "^4.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"keycloak-js": "26.2.4"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "node scripts/vendorAndPatch.mjs"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Patches for keycloak-js
|
|
2
|
+
|
|
3
|
+
This directory is the **only** keycloak-js source stored in the repo. The npm `build` script vendors upstream keycloak-js from `node_modules` and applies every `*.patch` file here (in alphabetical order), then writes the result to `dist/`.
|
|
4
|
+
|
|
5
|
+
## Adding a patch
|
|
6
|
+
|
|
7
|
+
1. **Create the patch file** against the **keycloak-js package root** (same layout as `node_modules/keycloak-js`). Paths in the patch should be relative to that root (e.g. `lib/keycloak.js`).
|
|
8
|
+
|
|
9
|
+
**From your existing fork (e.g. GitLab):**
|
|
10
|
+
- Check out upstream keycloak-js and your patched version.
|
|
11
|
+
- From the keycloak-js root:
|
|
12
|
+
`diff -u dist/keycloak.mjs upstream/dist/keycloak.mjs > timeout-overflow.patch`
|
|
13
|
+
(or use `git diff` if both are in git and paths match.)
|
|
14
|
+
|
|
15
|
+
**From node_modules:**
|
|
16
|
+
- Copy `node_modules/keycloak-js` to a temp dir, make your fix, then:
|
|
17
|
+
`diff -ru keycloak-js-orig keycloak-js-patched > patches/your-fix.patch`
|
|
18
|
+
- Edit the patch so paths are relative to the keycloak-js root (e.g. `a/lib/keycloak.js`, `b/lib/keycloak.js` → `lib/keycloak.js` if needed for `patch -p1`).
|
|
19
|
+
|
|
20
|
+
2. **Name the file** `*.patch` and put it in this directory. Patches are applied in alphabetical order.
|
|
21
|
+
|
|
22
|
+
3. **Run** `pnpm build` in this package (or from root with a filter). The script will vendor keycloak-js, apply all patches, and output to `dist/`.
|
|
23
|
+
|
|
24
|
+
## Upgrading upstream
|
|
25
|
+
|
|
26
|
+
1. Bump the `keycloak-js` version in `package.json` under `devDependencies`.
|
|
27
|
+
2. Run `pnpm install`.
|
|
28
|
+
3. Re-apply or re-create patches (they may need manual adjustment if upstream changed).
|
|
29
|
+
4. Run `pnpm build` and test (e.g. in siwe-keycloak).
|
|
30
|
+
5. Bump this package’s version (e.g. `24.0.6-patch.1`) and publish.
|
|
31
|
+
|
|
32
|
+
## Current patches
|
|
33
|
+
|
|
34
|
+
- **timeout-overflow.patch** — Caps the token-expiry `setTimeout` delay to `2147483647` ms (2^31−1). Prevents 32-bit overflow when `expiresIn` is very large (e.g. long-lived tokens), which would cause the timer to fire immediately or behave incorrectly.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
--- a/lib/keycloak.js
|
|
2
|
+
+++ b/lib/keycloak.js
|
|
3
|
+
@@ -1576,7 +1576,7 @@
|
|
4
|
+
if (expiresIn <= 0) {
|
|
5
|
+
this.onTokenExpired()
|
|
6
|
+
} else {
|
|
7
|
+
- this.tokenTimeoutHandle = window.setTimeout(this.onTokenExpired, expiresIn)
|
|
8
|
+
+ this.tokenTimeoutHandle = window.setTimeout(this.onTokenExpired, Math.min(expiresIn, 2147483647))
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|