@riocrypto/common-server 1.0.2302 → 1.0.2303
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.
|
@@ -82,7 +82,17 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
82
82
|
const payload = jsonwebtoken_1.default.verify(adminAccessToken, ADMIN_ACCESS_TOKEN_SECRET);
|
|
83
83
|
const adminAuth = yield AdminAuth.findById(payload.id);
|
|
84
84
|
if (adminAuth) {
|
|
85
|
-
|
|
85
|
+
// Check if token version matches (for server-side invalidation)
|
|
86
|
+
if (payload.tokenVersion !== undefined &&
|
|
87
|
+
adminAuth.tokenVersion !== undefined) {
|
|
88
|
+
if (payload.tokenVersion >= adminAuth.tokenVersion) {
|
|
89
|
+
req.adminAuth = adminAuth;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
// Backward compatibility for tokens without version
|
|
94
|
+
req.adminAuth = adminAuth;
|
|
95
|
+
}
|
|
86
96
|
}
|
|
87
97
|
}
|
|
88
98
|
catch (err) { }
|
|
@@ -15,6 +15,7 @@ interface AdminAuthAttrs {
|
|
|
15
15
|
previousPasswords?: string[];
|
|
16
16
|
authenticatorSecret?: string;
|
|
17
17
|
apiKeys?: APIKey[];
|
|
18
|
+
tokenVersion?: number;
|
|
18
19
|
}
|
|
19
20
|
interface AdminAuthDoc extends Document {
|
|
20
21
|
password: string;
|
|
@@ -31,6 +32,7 @@ interface AdminAuthDoc extends Document {
|
|
|
31
32
|
previousPasswords?: string[];
|
|
32
33
|
authenticatorSecret?: string;
|
|
33
34
|
apiKeys?: APIKey[];
|
|
35
|
+
tokenVersion?: number;
|
|
34
36
|
}
|
|
35
37
|
interface AdminAuthModel extends Model<AdminAuthDoc> {
|
|
36
38
|
build(attrs: AdminAuthAttrs): AdminAuthDoc;
|
package/build/models/auth.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ interface AuthAttrs {
|
|
|
10
10
|
apiKeys?: APIKey[];
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
tokenVersion?: number;
|
|
13
|
+
blacklistedTokens?: Array<{
|
|
14
|
+
jti: string;
|
|
15
|
+
exp: Date;
|
|
16
|
+
}>;
|
|
13
17
|
authenticator?: {
|
|
14
18
|
secret?: string;
|
|
15
19
|
verified?: boolean;
|
|
@@ -34,6 +38,10 @@ interface AuthDoc extends Document {
|
|
|
34
38
|
apiKeys?: APIKey[];
|
|
35
39
|
isDisabled?: boolean;
|
|
36
40
|
tokenVersion?: number;
|
|
41
|
+
blacklistedTokens?: Array<{
|
|
42
|
+
jti: string;
|
|
43
|
+
exp: Date;
|
|
44
|
+
}>;
|
|
37
45
|
authenticator?: {
|
|
38
46
|
secret?: string;
|
|
39
47
|
verified?: boolean;
|
package/build/models/auth.js
CHANGED
|
@@ -91,6 +91,18 @@ const buildAuth = (mongoose) => {
|
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
93
|
],
|
|
94
|
+
blacklistedTokens: [
|
|
95
|
+
{
|
|
96
|
+
jti: {
|
|
97
|
+
type: String,
|
|
98
|
+
required: true,
|
|
99
|
+
},
|
|
100
|
+
exp: {
|
|
101
|
+
type: Date,
|
|
102
|
+
required: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
94
106
|
}, {
|
|
95
107
|
toJSON: {
|
|
96
108
|
transform(doc, ret) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2303",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/secret-manager": "^5.3.0",
|
|
29
29
|
"@google-cloud/storage": "^6.9.5",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.7.0",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.2021",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.7.4",
|
|
34
34
|
"crypto-js": "^4.2.0",
|