@ahhaohho/auth-middleware 2.0.0 → 2.0.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahhaohho/auth-middleware",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Shared authentication and authorization middleware for ahhaohho microservices",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -3,12 +3,27 @@ const redisManager = require('../config/redis');
3
3
 
4
4
  /**
5
5
  * AWS Secrets Manager에서 JWT 키 가져오기
6
+ *
7
+ * JWT_AWS_ACCESS_KEY_ID, JWT_AWS_SECRET_ACCESS_KEY 환경변수가 설정되어 있으면
8
+ * 해당 자격 증명을 사용하고, 없으면 기본 AWS 자격 증명을 사용합니다.
6
9
  */
7
10
  class SecretManager {
8
11
  constructor() {
9
- this.client = new SecretsManagerClient({
12
+ // JWT 전용 AWS 자격 증명 설정 (선택적)
13
+ const clientConfig = {
10
14
  region: process.env.AWS_REGION || 'ap-northeast-2'
11
- });
15
+ };
16
+
17
+ // JWT 전용 자격 증명이 있으면 사용
18
+ if (process.env.JWT_AWS_ACCESS_KEY_ID && process.env.JWT_AWS_SECRET_ACCESS_KEY) {
19
+ clientConfig.credentials = {
20
+ accessKeyId: process.env.JWT_AWS_ACCESS_KEY_ID,
21
+ secretAccessKey: process.env.JWT_AWS_SECRET_ACCESS_KEY
22
+ };
23
+ console.log('[@ahhaohho/auth-middleware] Using JWT-specific AWS credentials');
24
+ }
25
+
26
+ this.client = new SecretsManagerClient(clientConfig);
12
27
  this.secretName = process.env.JWT_SECRET_NAME;
13
28
  }
14
29