@chevre/domain 21.30.0-alpha.27 → 21.30.0-alpha.28

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.
@@ -47,7 +47,14 @@ export declare const credentials: {
47
47
  };
48
48
  jwt: {
49
49
  secret: string;
50
+ /**
51
+ * トークン発行時の発行者
52
+ */
50
53
  issuer: string;
54
+ /**
55
+ * トークン検証時の発行者リスト
56
+ */
57
+ issuers: string[];
51
58
  version: string;
52
59
  };
53
60
  };
@@ -54,7 +54,19 @@ exports.credentials = {
54
54
  },
55
55
  jwt: {
56
56
  secret: process.env.TOKEN_SECRET,
57
- issuer: process.env.RESOURCE_SERVER_IDENTIFIER,
57
+ // RESOURCE_SERVER_IDENTIFIERとは分離して指定可能に拡張(2024-05-02~)
58
+ /**
59
+ * トークン発行時の発行者
60
+ */
61
+ issuer: (typeof process.env.TOKEN_ISSUER_BY_AUTHORIZATION === 'string')
62
+ ? process.env.TOKEN_ISSUER_BY_AUTHORIZATION
63
+ : process.env.RESOURCE_SERVER_IDENTIFIER,
64
+ /**
65
+ * トークン検証時の発行者リスト
66
+ */
67
+ issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
68
+ ? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
69
+ : [],
58
70
  version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02' // 追加(2024-05-02~)
59
71
  }
60
72
  };
@@ -76,7 +76,10 @@ function verifyToken(params) {
76
76
  }
77
77
  try {
78
78
  payload = yield new Promise((resolve, reject) => {
79
- jwt.verify(params.token, credentials_1.credentials.jwt.secret, Object.assign({ issuer: credentials_1.credentials.jwt.issuer }, (Array.isArray(params.audience)) ? { audience: params.audience } : undefined), (err, decoded) => {
79
+ jwt.verify(params.token, credentials_1.credentials.jwt.secret, Object.assign({
80
+ // 互換性維持のために複数対応(2024-05-02~)
81
+ // issuer: credentials.jwt.issuer,
82
+ issuer: credentials_1.credentials.jwt.issuers }, (Array.isArray(params.audience)) ? { audience: params.audience } : undefined), (err, decoded) => {
80
83
  if (err instanceof Error) {
81
84
  reject(err);
82
85
  }
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.30.0-alpha.27"
113
+ "version": "21.30.0-alpha.28"
114
114
  }