@ahhaohho/auth-middleware 2.3.7 → 2.3.10
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/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahhaohho/auth-middleware",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.10",
|
|
4
4
|
"description": "Shared authentication and authorization middleware for ahhaohho microservices",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Warning: no test specified\" && exit 0",
|
|
8
|
+
"build": "echo \"No build step required\"",
|
|
8
9
|
"prepublishOnly": "echo \"Publishing package...\""
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
package/src/middleware/auth.js
CHANGED
|
@@ -177,7 +177,7 @@ async function authenticateHybrid(req, res, next) {
|
|
|
177
177
|
phoneNumber: refreshUser.phoneNumber
|
|
178
178
|
};
|
|
179
179
|
|
|
180
|
-
const accessExpiration = process.env.JWT_ACCESS_EXPIRATION || '
|
|
180
|
+
const accessExpiration = process.env.JWT_ACCESS_EXPIRATION || '1h';
|
|
181
181
|
const newAccessToken = await signToken(tokenData, { expiresIn: accessExpiration });
|
|
182
182
|
|
|
183
183
|
console.log('[@ahhaohho/auth-middleware] ✅ New access token generated for userId:', refreshUser.userId);
|
|
@@ -60,7 +60,7 @@ class SecretManager {
|
|
|
60
60
|
try {
|
|
61
61
|
// 1. Redis 캐시 확인
|
|
62
62
|
const redisClient = redisManager.getClient('keys');
|
|
63
|
-
const cachedKeys = await redisClient.get(`jwt-keys:${this.secretName}`);
|
|
63
|
+
const cachedKeys = await redisClient.get(`jwt-keys:${this.secretName}:${JWT_KEY_ENV || 'dev'}`);
|
|
64
64
|
|
|
65
65
|
if (cachedKeys) {
|
|
66
66
|
console.log('[@ahhaohho/auth-middleware] Using cached JWT keys from Redis');
|
|
@@ -108,7 +108,7 @@ class SecretManager {
|
|
|
108
108
|
|
|
109
109
|
// 3. Redis에 캐싱 (5분 TTL)
|
|
110
110
|
await redisClient.set(
|
|
111
|
-
`jwt-keys:${this.secretName}`,
|
|
111
|
+
`jwt-keys:${this.secretName}:${JWT_KEY_ENV || 'dev'}`,
|
|
112
112
|
JSON.stringify(keys),
|
|
113
113
|
'EX',
|
|
114
114
|
300 // 5분
|
|
@@ -126,7 +126,7 @@ class SecretManager {
|
|
|
126
126
|
*/
|
|
127
127
|
async invalidateCache() {
|
|
128
128
|
const redisClient = redisManager.getClient('keys');
|
|
129
|
-
await redisClient.del(`jwt-keys:${this.secretName}`);
|
|
129
|
+
await redisClient.del(`jwt-keys:${this.secretName}:${JWT_KEY_ENV || 'dev'}`);
|
|
130
130
|
console.log('[@ahhaohho/auth-middleware] JWT keys cache invalidated');
|
|
131
131
|
}
|
|
132
132
|
}
|