k2hr3-api 1.0.38 → 1.0.40

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.
Files changed (65) hide show
  1. package/ChangeLog +12 -0
  2. package/README.md +31 -31
  3. package/app.js +6 -10
  4. package/bin/run.sh +21 -21
  5. package/bin/www +1 -1
  6. package/config/k2hr3-init.sh.templ +5 -5
  7. package/eslint.config.mjs +68 -0
  8. package/lib/cacerts.js +8 -7
  9. package/lib/dummyuserapi.js +1 -1
  10. package/lib/ipwatch.js +1 -1
  11. package/lib/k2hr3acrutil.js +12 -14
  12. package/lib/k2hr3apiutil.js +5 -5
  13. package/lib/k2hr3cryptutil.js +2 -0
  14. package/lib/k2hr3dkc.js +25 -28
  15. package/lib/k2hr3template.js +54 -52
  16. package/lib/k2hr3tokens.js +4 -4
  17. package/lib/k8soidc.js +3 -3
  18. package/lib/openstackapiv2.js +51 -52
  19. package/lib/openstackapiv3.js +86 -87
  20. package/lib/openstackep.js +46 -46
  21. package/package.json +8 -8
  22. package/routes/acr.js +66 -110
  23. package/routes/debugVerify.js +12 -14
  24. package/routes/extdata.js +24 -40
  25. package/routes/list.js +24 -36
  26. package/routes/policy.js +72 -120
  27. package/routes/resource.js +110 -165
  28. package/routes/role.js +177 -295
  29. package/routes/service.js +54 -90
  30. package/routes/userTokens.js +1 -1
  31. package/routes/userdata.js +12 -20
  32. package/routes/version.js +39 -23
  33. package/tests/auto_control_subprocess.sh +9 -9
  34. package/tests/auto_init_config_json.sh +3 -3
  35. package/tests/auto_resource.js +417 -478
  36. package/tests/auto_role.js +55 -71
  37. package/tests/auto_template.sh +4 -4
  38. package/tests/auto_version.js +39 -23
  39. package/tests/k2hdkc_test_load.sh +9 -9
  40. package/tests/k2hr3template_test.sh +12 -12
  41. package/tests/k2hr3template_test_vars.js +60 -62
  42. package/tests/manual_acr_delete.js +11 -12
  43. package/tests/manual_acr_get.js +9 -10
  44. package/tests/manual_acr_postput.js +12 -13
  45. package/tests/manual_extdata_get.js +5 -6
  46. package/tests/manual_list_gethead.js +12 -13
  47. package/tests/manual_policy_delete.js +12 -13
  48. package/tests/manual_policy_gethead.js +27 -27
  49. package/tests/manual_policy_postput.js +21 -23
  50. package/tests/manual_resource_delete.js +11 -15
  51. package/tests/manual_resource_gethead.js +11 -14
  52. package/tests/manual_resource_postput.js +18 -21
  53. package/tests/manual_role_delete.js +22 -28
  54. package/tests/manual_role_gethead.js +53 -53
  55. package/tests/manual_role_postput.js +28 -31
  56. package/tests/manual_service_delete.js +11 -13
  57. package/tests/manual_service_gethead.js +13 -15
  58. package/tests/manual_service_postput.js +10 -11
  59. package/tests/manual_test.sh +10 -10
  60. package/tests/manual_userdata_get.js +14 -15
  61. package/tests/manual_usertoken_gethead.js +12 -14
  62. package/tests/manual_usertoken_postput.js +23 -26
  63. package/tests/manual_version_get.js +12 -13
  64. package/tests/run_local_test_k2hdkc.sh +4 -4
  65. package/tests/test.sh +12 -12
@@ -115,34 +115,34 @@ function rawGetUserUnscopedTokenV3(uname, passwd, callback)
115
115
  //r3logger.dlog(keystone_ep);
116
116
 
117
117
  // build parameters for request
118
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
119
- var body = { 'auth': {
120
- 'identity': {
121
- 'password': {
122
- 'user': {
123
- 'domain': {
124
- 'id': 'default'
125
- },
126
- 'password': _passwd,
127
- 'name': _uname
128
- }
129
- },
130
- 'methods': ['password']
131
- }
132
- }
133
- };
118
+ var body = {
119
+ 'auth': {
120
+ 'identity': {
121
+ 'password': {
122
+ 'user': {
123
+ 'domain': {
124
+ 'id': 'default'
125
+ },
126
+ 'password': _passwd,
127
+ 'name': _uname
128
+ }
129
+ },
130
+ 'methods': ['password']
131
+ }
132
+ }
133
+ };
134
134
  var strbody = JSON.stringify(body);
135
135
  var headers = {
136
- 'Content-Type': 'application/json',
137
- 'Content-Length': strbody.length
138
- };
139
- var options = { 'host': keystone_ep.hostname,
140
- 'port': keystone_ep.port,
141
- 'path': keystone_ep.pathname + '/v3/auth/tokens',
142
- 'method': 'POST',
143
- 'headers': headers
144
- };
145
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
136
+ 'Content-Type': 'application/json',
137
+ 'Content-Length': strbody.length
138
+ };
139
+ var options = {
140
+ 'host': keystone_ep.hostname,
141
+ 'port': keystone_ep.port,
142
+ 'path': keystone_ep.pathname + '/v3/auth/tokens',
143
+ 'method': 'POST',
144
+ 'headers': headers
145
+ };
146
146
 
147
147
  var httpobj;
148
148
  if(apiutil.compareCaseString('https:', keystone_ep.protocol)){
@@ -314,28 +314,28 @@ function rawGetUserUnscopedTokenByOstokenV3(ostoken, callback)
314
314
  //r3logger.dlog(keystone_ep);
315
315
 
316
316
  // build parameters for request
317
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
318
- var body = { 'auth': {
319
- 'identity': {
320
- 'token': {
321
- 'id': _ostoken,
322
- },
323
- 'methods': ['token']
324
- }
325
- }
326
- };
317
+ var body = {
318
+ 'auth': {
319
+ 'identity': {
320
+ 'token': {
321
+ 'id': _ostoken,
322
+ },
323
+ 'methods': ['token']
324
+ }
325
+ }
326
+ };
327
327
  var strbody = JSON.stringify(body);
328
328
  var headers = {
329
- 'Content-Type': 'application/json',
330
- 'Content-Length': strbody.length
331
- };
332
- var options = { 'host': keystone_ep.hostname,
333
- 'port': keystone_ep.port,
334
- 'path': keystone_ep.pathname + '/v3/auth/tokens',
335
- 'method': 'POST',
336
- 'headers': headers
337
- };
338
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
329
+ 'Content-Type': 'application/json',
330
+ 'Content-Length': strbody.length
331
+ };
332
+ var options = {
333
+ 'host': keystone_ep.hostname,
334
+ 'port': keystone_ep.port,
335
+ 'path': keystone_ep.pathname + '/v3/auth/tokens',
336
+ 'method': 'POST',
337
+ 'headers': headers
338
+ };
339
339
 
340
340
  var httpobj;
341
341
  if(apiutil.compareCaseString('https:', keystone_ep.protocol)){
@@ -558,35 +558,35 @@ function rawGetUserScopedTokenV3(unscopedtoken, tenantid, callback)
558
558
  //r3logger.dlog(keystone_ep);
559
559
 
560
560
  // build parameters for request
561
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
562
- var body = { 'auth': {
563
- 'identity': {
564
- 'methods': [
565
- 'token'
566
- ],
567
- 'token': {
568
- 'id': _unscopedtoken
569
- }
570
- },
571
- 'scope': {
572
- 'project': {
573
- 'id': _tenantid
574
- }
575
- }
576
- }
577
- };
561
+ var body = {
562
+ 'auth': {
563
+ 'identity': {
564
+ 'methods': [
565
+ 'token'
566
+ ],
567
+ 'token': {
568
+ 'id': _unscopedtoken
569
+ }
570
+ },
571
+ 'scope': {
572
+ 'project': {
573
+ 'id': _tenantid
574
+ }
575
+ }
576
+ }
577
+ };
578
578
  var strbody = JSON.stringify(body);
579
579
  var headers = {
580
- 'Content-Type': 'application/json',
581
- 'Content-Length': strbody.length
582
- };
583
- var options = { 'host': keystone_ep.hostname,
584
- 'port': keystone_ep.port,
585
- 'path': keystone_ep.pathname + '/v3/auth/tokens',
586
- 'method': 'POST',
587
- 'headers': headers
588
- };
589
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
580
+ 'Content-Type': 'application/json',
581
+ 'Content-Length': strbody.length
582
+ };
583
+ var options = {
584
+ 'host': keystone_ep.hostname,
585
+ 'port': keystone_ep.port,
586
+ 'path': keystone_ep.pathname + '/v3/auth/tokens',
587
+ 'method': 'POST',
588
+ 'headers': headers
589
+ };
590
590
 
591
591
  var httpobj;
592
592
  if(apiutil.compareCaseString('https:', keystone_ep.protocol)){
@@ -871,19 +871,18 @@ function rawGetUserTenantListV3(unscopedtoken, userid, callback)
871
871
  //r3logger.dlog(keystone_ep);
872
872
 
873
873
  // build parameters for request
874
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
875
- var headers = {
876
- 'Content-Type': 'application/json',
877
- 'X-Auth-Token': _unscopedtoken,
878
- 'Content-Length': 0
879
- };
880
- var options = { 'host': keystone_ep.hostname,
881
- 'port': keystone_ep.port,
882
- 'path': keystone_ep.pathname + '/v3/users/' + _userid + '/projects',
883
- 'method': 'GET',
884
- 'headers': headers
885
- };
886
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
874
+ var headers = {
875
+ 'Content-Type': 'application/json',
876
+ 'X-Auth-Token': _unscopedtoken,
877
+ 'Content-Length': 0
878
+ };
879
+ var options = {
880
+ 'host': keystone_ep.hostname,
881
+ 'port': keystone_ep.port,
882
+ 'path': keystone_ep.pathname + '/v3/users/' + _userid + '/projects',
883
+ 'method': 'GET',
884
+ 'headers': headers
885
+ };
887
886
 
888
887
  var httpobj;
889
888
  if(apiutil.compareCaseString('https:', keystone_ep.protocol)){
@@ -1010,7 +1009,7 @@ exports.verifyUserTokenPublisher = function(token_seed)
1010
1009
  //
1011
1010
  // tenant is not used.
1012
1011
  //
1013
- exports.verifyUserToken = function(user, tenant, token, token_seed) // eslint-disable-line no-unused-vars
1012
+ exports.verifyUserToken = function(user, tenant, token, token_seed)
1014
1013
  {
1015
1014
  return rawVerifyUserTokenV3(user, token, token_seed);
1016
1015
  };
@@ -178,56 +178,56 @@ function rawTestKeystoneEndpoint(epallmap, region, endpoint, is_v3, timeout, las
178
178
  var headers;
179
179
  var options;
180
180
  if(!_is_v3){
181
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
182
- body = { 'auth': {
183
- 'tenantName': '', // unscoped token for test
184
- 'passwordCredentials': {
185
- 'username': '', // user name is empty for testing
186
- 'password': '' // unauthorized passwd
187
- }
188
- }
189
- };
181
+ body = {
182
+ 'auth': {
183
+ 'tenantName': '', // unscoped token for test
184
+ 'passwordCredentials': {
185
+ 'username': '', // user name is empty for testing
186
+ 'password': '' // unauthorized passwd
187
+ }
188
+ }
189
+ };
190
190
  strbody = JSON.stringify(body);
191
191
  headers = {
192
- 'Content-Type': 'application/json',
193
- 'Content-Length': strbody.length
194
- };
195
- options = { 'host': ep.hostname,
196
- 'port': ep.port,
197
- 'path': '/v2.0/tokens',
198
- 'method': 'POST',
199
- 'headers': headers
200
- };
201
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
192
+ 'Content-Type': 'application/json',
193
+ 'Content-Length': strbody.length
194
+ };
195
+ options = {
196
+ 'host': ep.hostname,
197
+ 'port': ep.port,
198
+ 'path': '/v2.0/tokens',
199
+ 'method': 'POST',
200
+ 'headers': headers
201
+ };
202
202
  }else{
203
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
204
- body = { 'auth': {
205
- 'identity': {
206
- 'password': {
207
- 'user': {
208
- 'domain': {
209
- 'id': 'default'
210
- },
211
- 'name': '', // user name is empty for testing
212
- 'password': '' // unauthorized passwd
213
- }
214
- },
215
- 'methods': ['password']
216
- }
203
+ body = {
204
+ 'auth': {
205
+ 'identity': {
206
+ 'password': {
207
+ 'user': {
208
+ 'domain': {
209
+ 'id': 'default'
210
+ },
211
+ 'name': '', // user name is empty for testing
212
+ 'password': '' // unauthorized passwd
217
213
  }
218
- };
214
+ },
215
+ 'methods': ['password']
216
+ }
217
+ }
218
+ };
219
219
  strbody = JSON.stringify(body);
220
220
  headers = {
221
- 'Content-Type': 'application/json',
222
- 'Content-Length': strbody.length
223
- };
224
- options = { 'host': ep.hostname,
225
- 'port': ep.port,
226
- 'path': '/v3/auth/tokens',
227
- 'method': 'POST',
228
- 'headers': headers
229
- };
230
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
221
+ 'Content-Type': 'application/json',
222
+ 'Content-Length': strbody.length
223
+ };
224
+ options = {
225
+ 'host': ep.hostname,
226
+ 'port': ep.port,
227
+ 'path': '/v3/auth/tokens',
228
+ 'method': 'POST',
229
+ 'headers': headers
230
+ };
231
231
  }
232
232
 
233
233
  var httpobj;
@@ -242,7 +242,7 @@ function rawTestKeystoneEndpoint(epallmap, region, endpoint, is_v3, timeout, las
242
242
  httpobj = http;
243
243
  }
244
244
 
245
- var req = httpobj.request(options, function(res) // eslint-disable-line no-unused-vars
245
+ var req = httpobj.request(options, function(res)
246
246
  {
247
247
  var body = ''; // eslint-disable-line no-unused-vars
248
248
  var status = res.statusCode;
@@ -254,7 +254,7 @@ function rawTestKeystoneEndpoint(epallmap, region, endpoint, is_v3, timeout, las
254
254
  res.on('data', function(chunk)
255
255
  {
256
256
  //r3logger.dlog('response chunk: ' + chunk);
257
- body += chunk; // eslint-disable-line no-unused-vars
257
+ body += chunk;
258
258
  });
259
259
 
260
260
  res.on('end', function(res) // eslint-disable-line no-unused-vars
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "k2hr3-api",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "dependencies": {
5
- "@kubernetes/client-node": "^0.22.3",
5
+ "@kubernetes/client-node": "^1.0.0",
6
6
  "body-parser": "^1.20.3",
7
7
  "config": "^3.3.12",
8
8
  "cookie-parser": "~1.4.7",
9
9
  "dateformat": "^4.6.3",
10
- "debug": "~4.3.7",
10
+ "debug": "~4.4.0",
11
11
  "express": "^4.21.2",
12
12
  "jose": "^5.9.6",
13
- "k2hdkc": "^1.0.11",
13
+ "k2hdkc": "^1.0.13",
14
14
  "morgan": "~1.10.0",
15
- "rotating-file-stream": "^3.2.5"
15
+ "rotating-file-stream": "^3.2.6"
16
16
  },
17
17
  "bin": {
18
18
  "k2hr3-api": "./bin/www",
@@ -30,8 +30,8 @@
30
30
  "devDependencies": {
31
31
  "chai": "^4.5.0",
32
32
  "chai-http": "^4.4.0",
33
- "eslint": "^8.57.1",
34
- "mocha": "^11.0.1",
33
+ "eslint": "^9.20.1",
34
+ "mocha": "^11.1.0",
35
35
  "nyc": "^17.1.0"
36
36
  },
37
37
  "scripts": {
@@ -162,7 +162,7 @@
162
162
  "Takeshi Nakatani <ggtakec@gmail.com> (https://github.com/ggtakec)"
163
163
  ],
164
164
  "contributors": [
165
- "Hirotaka Wakabayashi <hiwakaba@yahoo-corp.jp> (https://github.com/hiwakaba)"
165
+ "Hirotaka Wakabayashi <hiwakaba@lycorp.co.jp> (https://github.com/hiwakaba)"
166
166
  ],
167
167
  "license": "MIT"
168
168
  }