@flink-app/jwt-auth-plugin 2.0.0-alpha.94 → 2.0.0-alpha.96
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/CHANGELOG.md +19 -0
- package/dist/FlinkJwtAuthPlugin.js +3 -2
- package/package.json +3 -3
- package/src/FlinkJwtAuthPlugin.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @flink-app/jwt-auth-plugin
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e431237: Add `iat` (issued-at) claim to generated JWTs.
|
|
8
|
+
|
|
9
|
+
`iat` is a standard JWT claim that records when the token was issued (Unix seconds). Adding it enables consumers to implement stateless force-logout / token-revocation patterns by storing a per-user "tokens-valid-from" timestamp and rejecting any token whose `iat` is older.
|
|
10
|
+
|
|
11
|
+
Backwards compatible — the claim is informational and does not affect verification of existing tokens. If a caller's payload already contains an `iat` field it takes precedence (useful for tests).
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @flink-app/flink@2.0.0-alpha.96
|
|
15
|
+
|
|
16
|
+
## 2.0.0-alpha.95
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- @flink-app/flink@2.0.0-alpha.95
|
|
21
|
+
|
|
3
22
|
## 2.0.0-alpha.94
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -170,7 +170,7 @@ function getTokenFromReq(req) {
|
|
|
170
170
|
}
|
|
171
171
|
function createToken(payload_1, _a, roles_1) {
|
|
172
172
|
return __awaiter(this, arguments, void 0, function (payload, _b, roles) {
|
|
173
|
-
var resolvedTTL, effectiveTTL;
|
|
173
|
+
var resolvedTTL, effectiveTTL, iat;
|
|
174
174
|
var _c;
|
|
175
175
|
var secret = _b.secret, algo = _b.algo, tokenTTL = _b.tokenTTL, resolveTokenTTL = _b.resolveTokenTTL;
|
|
176
176
|
return __generator(this, function (_d) {
|
|
@@ -179,7 +179,8 @@ function createToken(payload_1, _a, roles_1) {
|
|
|
179
179
|
}
|
|
180
180
|
resolvedTTL = resolveTokenTTL === null || resolveTokenTTL === void 0 ? void 0 : resolveTokenTTL(roles, payload);
|
|
181
181
|
effectiveTTL = (_c = resolvedTTL !== null && resolvedTTL !== void 0 ? resolvedTTL : tokenTTL) !== null && _c !== void 0 ? _c : 1000 * 60 * 60 * 24 * 365 * 100;
|
|
182
|
-
|
|
182
|
+
iat = Math.floor(Date.now() / 1000);
|
|
183
|
+
return [2 /*return*/, jwt_simple_1.default.encode(__assign({ iat: iat, exp: _calculateExpiration(effectiveTTL) }, payload), secret, algo)];
|
|
183
184
|
});
|
|
184
185
|
});
|
|
185
186
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flink-app/jwt-auth-plugin",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.96",
|
|
4
4
|
"description": "Flink plugin for JWT auth",
|
|
5
5
|
"author": "joel@frost.se",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"@types/node": "22.13.10",
|
|
20
20
|
"ts-node": "^10.9.2",
|
|
21
21
|
"tsc-watch": "^4.2.9",
|
|
22
|
-
"@flink-app/flink": "2.0.0-alpha.
|
|
22
|
+
"@flink-app/flink": "2.0.0-alpha.96"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@flink-app/flink": ">=2.0.0-alpha.
|
|
25
|
+
"@flink-app/flink": ">=2.0.0-alpha.96"
|
|
26
26
|
},
|
|
27
27
|
"gitHead": "4243e3b3cd6d4e1ca001a61baa8436bf2bbe4113",
|
|
28
28
|
"scripts": {
|
|
@@ -274,8 +274,9 @@ async function createToken(
|
|
|
274
274
|
|
|
275
275
|
const resolvedTTL = resolveTokenTTL?.(roles, payload);
|
|
276
276
|
const effectiveTTL = resolvedTTL ?? tokenTTL ?? 1000 * 60 * 60 * 24 * 365 * 100;
|
|
277
|
+
const iat = Math.floor(Date.now() / 1000);
|
|
277
278
|
|
|
278
|
-
return jwtSimple.encode({ exp: _calculateExpiration(effectiveTTL), ...payload }, secret, algo);
|
|
279
|
+
return jwtSimple.encode({ iat, exp: _calculateExpiration(effectiveTTL), ...payload }, secret, algo);
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
function _calculateExpiration(expiresInMs: number) {
|