k2hr3-api 1.0.42 → 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.
Files changed (149) hide show
  1. package/config/k2hr3-init.sh.templ +4 -4
  2. package/dist/.gitkeep +0 -0
  3. package/dist/src/app.js +262 -0
  4. package/{bin → dist/src/bin}/run.sh +1 -1
  5. package/dist/src/bin/watcher.js +113 -0
  6. package/dist/src/bin/www.js +217 -0
  7. package/dist/src/lib/basicipcheck.js +392 -0
  8. package/dist/src/lib/cacerts.js +106 -0
  9. package/dist/src/lib/dbglogging.js +190 -0
  10. package/dist/src/lib/dummyuserapi.js +719 -0
  11. package/dist/src/lib/ipwatch.js +354 -0
  12. package/dist/src/lib/k2hr3acrutil.js +532 -0
  13. package/dist/src/lib/k2hr3apiutil.js +1444 -0
  14. package/dist/src/lib/k2hr3cliutil.js +183 -0
  15. package/dist/src/lib/k2hr3config.js +832 -0
  16. package/dist/src/lib/k2hr3cryptutil.js +258 -0
  17. package/dist/src/lib/k2hr3dkc.js +12121 -0
  18. package/dist/src/lib/k2hr3extdata.js +198 -0
  19. package/dist/src/lib/k2hr3keys.js +207 -0
  20. package/dist/src/lib/k2hr3resutil.js +111 -0
  21. package/dist/src/lib/k2hr3template.js +6546 -0
  22. package/dist/src/lib/k2hr3tokens.js +2643 -0
  23. package/dist/src/lib/k2hr3userdata.js +296 -0
  24. package/dist/src/lib/k8soidc.js +1000 -0
  25. package/dist/src/lib/openstackapiv2.js +695 -0
  26. package/dist/src/lib/openstackapiv3.js +932 -0
  27. package/dist/src/lib/openstackep.js +667 -0
  28. package/{tests/auto_common.js → dist/src/lib/types.js} +4 -38
  29. package/dist/src/routes/acr.js +704 -0
  30. package/dist/src/routes/debugVerify.js +294 -0
  31. package/dist/src/routes/extdata.js +219 -0
  32. package/dist/src/routes/list.js +264 -0
  33. package/dist/src/routes/policy.js +840 -0
  34. package/dist/src/routes/resource.js +1489 -0
  35. package/dist/src/routes/role.js +2627 -0
  36. package/dist/src/routes/service.js +908 -0
  37. package/dist/src/routes/tenant.js +1141 -0
  38. package/dist/src/routes/userTokens.js +482 -0
  39. package/dist/src/routes/userdata.js +212 -0
  40. package/dist/src/routes/version.js +103 -0
  41. package/package.json +152 -121
  42. package/ChangeLog +0 -378
  43. package/app.js +0 -292
  44. package/bin/watcher +0 -122
  45. package/bin/www +0 -180
  46. package/eslint.config.mjs +0 -68
  47. package/lib/basicipcheck.js +0 -376
  48. package/lib/cacerts.js +0 -71
  49. package/lib/dbglogging.js +0 -151
  50. package/lib/dummyuserapi.js +0 -766
  51. package/lib/ipwatch.js +0 -379
  52. package/lib/k2hr3acrutil.js +0 -516
  53. package/lib/k2hr3apiutil.js +0 -1494
  54. package/lib/k2hr3cliutil.js +0 -191
  55. package/lib/k2hr3config.js +0 -826
  56. package/lib/k2hr3cryptutil.js +0 -254
  57. package/lib/k2hr3dkc.js +0 -12632
  58. package/lib/k2hr3extdata.js +0 -198
  59. package/lib/k2hr3keys.js +0 -234
  60. package/lib/k2hr3resutil.js +0 -100
  61. package/lib/k2hr3template.js +0 -6925
  62. package/lib/k2hr3tokens.js +0 -2799
  63. package/lib/k2hr3userdata.js +0 -312
  64. package/lib/k8soidc.js +0 -1012
  65. package/lib/openstackapiv2.js +0 -764
  66. package/lib/openstackapiv3.js +0 -1032
  67. package/lib/openstackep.js +0 -553
  68. package/routes/acr.js +0 -738
  69. package/routes/debugVerify.js +0 -263
  70. package/routes/extdata.js +0 -232
  71. package/routes/list.js +0 -270
  72. package/routes/policy.js +0 -869
  73. package/routes/resource.js +0 -1441
  74. package/routes/role.js +0 -2664
  75. package/routes/service.js +0 -894
  76. package/routes/tenant.js +0 -1095
  77. package/routes/userTokens.js +0 -511
  78. package/routes/userdata.js +0 -218
  79. package/routes/version.js +0 -108
  80. package/templ/Dockerfile.templ +0 -71
  81. package/tests/auto_acr.js +0 -1101
  82. package/tests/auto_acr_spec.js +0 -79
  83. package/tests/auto_all_spec.js +0 -142
  84. package/tests/auto_control_subprocess.sh +0 -243
  85. package/tests/auto_extdata.js +0 -220
  86. package/tests/auto_extdata_spec.js +0 -79
  87. package/tests/auto_init_config_json.sh +0 -275
  88. package/tests/auto_k2hdkc_server.ini +0 -109
  89. package/tests/auto_k2hdkc_slave.ini +0 -83
  90. package/tests/auto_list.js +0 -439
  91. package/tests/auto_list_spec.js +0 -79
  92. package/tests/auto_policy.js +0 -1579
  93. package/tests/auto_policy_spec.js +0 -79
  94. package/tests/auto_resource.js +0 -10956
  95. package/tests/auto_resource_spec.js +0 -79
  96. package/tests/auto_role.js +0 -6150
  97. package/tests/auto_role_spec.js +0 -79
  98. package/tests/auto_service.js +0 -770
  99. package/tests/auto_service_spec.js +0 -79
  100. package/tests/auto_subprocesses.js +0 -114
  101. package/tests/auto_template.sh +0 -126
  102. package/tests/auto_tenant.js +0 -1100
  103. package/tests/auto_tenant_spec.js +0 -79
  104. package/tests/auto_token_util.js +0 -219
  105. package/tests/auto_userdata.js +0 -292
  106. package/tests/auto_userdata_spec.js +0 -79
  107. package/tests/auto_usertokens.js +0 -565
  108. package/tests/auto_usertokens_spec.js +0 -79
  109. package/tests/auto_version.js +0 -127
  110. package/tests/auto_version_spec.js +0 -79
  111. package/tests/auto_watcher.js +0 -157
  112. package/tests/auto_watcher_spec.js +0 -79
  113. package/tests/k2hdkc_test.data +0 -986
  114. package/tests/k2hdkc_test_load.sh +0 -255
  115. package/tests/k2hr3template_test.js +0 -187
  116. package/tests/k2hr3template_test.sh +0 -339
  117. package/tests/k2hr3template_test_async.js +0 -216
  118. package/tests/k2hr3template_test_template.result +0 -7117
  119. package/tests/k2hr3template_test_template.txt +0 -3608
  120. package/tests/k2hr3template_test_vars.js +0 -194
  121. package/tests/manual_acr_delete.js +0 -143
  122. package/tests/manual_acr_get.js +0 -297
  123. package/tests/manual_acr_postput.js +0 -215
  124. package/tests/manual_allusertenant_get.js +0 -113
  125. package/tests/manual_extdata_get.js +0 -191
  126. package/tests/manual_k2hr3keys_get.js +0 -84
  127. package/tests/manual_list_gethead.js +0 -230
  128. package/tests/manual_policy_delete.js +0 -132
  129. package/tests/manual_policy_gethead.js +0 -275
  130. package/tests/manual_policy_postput.js +0 -297
  131. package/tests/manual_resource_delete.js +0 -433
  132. package/tests/manual_resource_gethead.js +0 -423
  133. package/tests/manual_resource_postput.js +0 -487
  134. package/tests/manual_role_delete.js +0 -404
  135. package/tests/manual_role_gethead.js +0 -547
  136. package/tests/manual_role_postput.js +0 -544
  137. package/tests/manual_service_delete.js +0 -153
  138. package/tests/manual_service_gethead.js +0 -178
  139. package/tests/manual_service_postput.js +0 -348
  140. package/tests/manual_tenant_delete.js +0 -186
  141. package/tests/manual_tenant_gethead.js +0 -268
  142. package/tests/manual_tenant_postput.js +0 -293
  143. package/tests/manual_test.sh +0 -352
  144. package/tests/manual_userdata_get.js +0 -173
  145. package/tests/manual_usertoken_gethead.js +0 -136
  146. package/tests/manual_usertoken_postput.js +0 -310
  147. package/tests/manual_version_get.js +0 -127
  148. package/tests/run_local_test_k2hdkc.sh +0 -174
  149. package/tests/test.sh +0 -333
@@ -1,511 +0,0 @@
1
- /*
2
- * K2HR3 REST API
3
- *
4
- * Copyright 2017 Yahoo Japan Corporation.
5
- *
6
- * K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
7
- * common management information for the cloud.
8
- * K2HR3 can dynamically manage information as "who", "what", "operate".
9
- * These are stored as roles, resources, policies in K2hdkc, and the
10
- * client system can dynamically read and modify these information.
11
- *
12
- * For the full copyright and license information, please view
13
- * the license file that was distributed with this source code.
14
- *
15
- * AUTHOR: Takeshi Nakatani
16
- * CREATE: Wed Jun 8 2017
17
- * REVISION:
18
- *
19
- */
20
-
21
- 'use strict';
22
-
23
- var express = require('express');
24
- var router = express.Router();
25
-
26
- var r3token = require('../lib/k2hr3tokens');
27
- var apiutil = require('../lib/k2hr3apiutil');
28
- var resutil = require('../lib/k2hr3resutil');
29
-
30
- // Debug logging objects
31
- var r3logger = require('../lib/dbglogging');
32
-
33
- //
34
- // Common utility function
35
- //
36
- function rawCommonGetUserToken(req, res, unscopedToken, otherToken, username, passwd, tenant)
37
- {
38
- // arguments
39
- var _req = req;
40
- var _res = res;
41
- var _unscopedToken = apiutil.getSafeString(unscopedToken);
42
- var _otherToken = apiutil.getSafeString(otherToken);
43
- var _username = apiutil.getSafeString(username);
44
- var _passwd = apiutil.getSafeString(passwd);
45
- var _tenant = apiutil.getSafeString(tenant);
46
- var error;
47
-
48
- if(!apiutil.isSafeString(_unscopedToken) && !apiutil.isSafeString(_otherToken)){
49
- //
50
- // Get token from User Credentials
51
- //
52
- if(!apiutil.isSafeString(username)){
53
- error = {
54
- result: false,
55
- message: 'Some parameter(user name or unscoped token) is wrong.'
56
- };
57
- r3logger.elog(error.message);
58
- resutil.errResponse(req, res, 400, error); // 400: Bad Request
59
- return;
60
- }
61
-
62
- r3token.getUserToken(_username, _passwd, _tenant, function(err, token)
63
- {
64
- if(null !== err){
65
- var error = {
66
- result: false,
67
- message: 'could not get scoped user token for user=' + _username + ', tenant=' + _tenant + ' by ' + err.message
68
- };
69
- r3logger.elog(error.message);
70
- resutil.errResponse(_req, _res, 404, error); // 404: Not Found
71
- return;
72
- }
73
- r3logger.dlog('get user token jsonres = ' + JSON.stringify(token));
74
-
75
- var result = { result: true,
76
- message: 'succeed',
77
- scoped: apiutil.isSafeString(_tenant),
78
- token: token
79
- };
80
- _res.status(201); // 201: Created
81
- _res.send(JSON.stringify(result));
82
- });
83
-
84
- }else if(apiutil.isSafeString(_unscopedToken)){
85
- //
86
- // Get Scoped token from Unscoped token
87
- //
88
- if(!apiutil.isSafeString(username)){
89
- error = {
90
- result: false,
91
- message: 'Some parameter(user name or unscoped token) is wrong.'
92
- };
93
- r3logger.elog(error.message);
94
- resutil.errResponse(req, res, 400, error); // 400: Bad Request
95
- return;
96
- }
97
-
98
- r3token.getScopedUserToken(_unscopedToken, _username, _tenant, function(err, token)
99
- {
100
- if(null !== err){
101
- var error = {
102
- result: false,
103
- message: 'could not get scoped user token for user=' + _username + ', tenant=' + _tenant + ' by ' + err.message
104
- };
105
- r3logger.elog(error.message);
106
- resutil.errResponse(_req, _res, 404, error); // 404: Not Found
107
- return;
108
- }
109
- r3logger.dlog('get user token jsonres = ' + JSON.stringify(token));
110
-
111
- var result = {
112
- result: true,
113
- message: 'succeed',
114
- scoped: apiutil.isSafeString(_tenant),
115
- token: token
116
- };
117
-
118
- _res.status(201); // 201: Created
119
- _res.send(JSON.stringify(result));
120
- });
121
-
122
- }else if(apiutil.isSafeString(_otherToken)){
123
- //
124
- // Get Scoped/Unscoped token from other token
125
- //
126
- r3token.getUserTokenByToken(_otherToken, _tenant, function(err, token)
127
- {
128
- if(null !== err){
129
- var error = {
130
- result: false,
131
- message: 'could not get scoped user token for other token, tenant=' + _tenant + ' by ' + err.message
132
- };
133
- r3logger.elog(error.message);
134
- resutil.errResponse(_req, _res, 404, error); // 404: Not Found
135
- return;
136
- }
137
- r3logger.dlog('get user token jsonres = ' + JSON.stringify(token));
138
-
139
- var result = {
140
- result: true,
141
- message: 'succeed',
142
- scoped: apiutil.isSafeString(_tenant),
143
- token: token
144
- };
145
- _res.status(201); // 201: Created
146
- _res.send(JSON.stringify(result));
147
- });
148
- }
149
- }
150
-
151
- //
152
- // Common utility function
153
- //
154
- function rawGetUnscopedUserToken(req)
155
- {
156
- // check unscoped token in request
157
- var resobj = r3token.checkToken(req, false, true);
158
- if(!resobj.result){
159
- return resobj;
160
- }
161
-
162
- if( !apiutil.isSafeString(resobj.token) ||
163
- !apiutil.compareCaseString('user', resobj.token_type) ||
164
- !apiutil.isSafeEntity(resobj.token_info) ||
165
- !apiutil.isSafeString(resobj.token_info.user) ||
166
- false !== resobj.token_info.scoped )
167
- {
168
- return {
169
- result: false,
170
- status: 400, // 400: Bad Request
171
- message: 'could not get unscoped user token in request.'
172
- };
173
- }
174
-
175
- return {
176
- result: true,
177
- status: 200,
178
- message: null,
179
- token: resobj.token,
180
- username: resobj.token_info.user
181
- };
182
- }
183
-
184
- // Mountpath : '/v1/user/tokens'
185
- // POST '/v1/user/tokens' : post(create) user token on version 1
186
- // response body : result => true/false
187
- // message => messages
188
- // scoped => true/false
189
- // token => token(unscoped or scoped)
190
- //
191
- router.post('/', function(req, res, next) // eslint-disable-line no-unused-vars
192
- {
193
- r3logger.dlog('CALL:', req.method, req.url);
194
-
195
- res.type('application/json; charset=utf-8');
196
-
197
- var error;
198
- if( !apiutil.isSafeEntity(req) ||
199
- !apiutil.isSafeEntity(req.body) )
200
- {
201
- error = {
202
- result: false,
203
- message: 'POST body does not have auth key'
204
- };
205
- r3logger.elog(error.message);
206
- resutil.errResponse(req, res, 400, error); // 400: Bad Request
207
- return;
208
- }
209
-
210
- // arguments
211
- var tenant = apiutil.isSafeEntity(req.body.auth) ? apiutil.getSafeString(req.body.auth.tenantName) : null;
212
- var unscopedtoken = null;
213
- var otherToken = null;
214
- var username = null;
215
- var passwd = null;
216
-
217
- if(!apiutil.isSafeEntity(req.body.auth) || !apiutil.isSafeEntity(req.body.auth.passwordCredentials)){
218
- //
219
- // Token is required if no user credentials are specified.
220
- //
221
- // [NOTE]
222
- // There are two cases in this case:
223
- // (1) Specify the UnscopedToken registered in k2hr3 to get the ScopedToken(must specify the tenant name)
224
- // (2) Specify a token other than k2hr3 (OpenStack, etc.) and perform Unauthenticated Token after user authentication.
225
- // In this case, if tenant is specified, ScopedToken can be obtained directly.
226
- //
227
-
228
- // get unscoped token
229
- var resobj = rawGetUnscopedUserToken(req);
230
- if(resobj.result){
231
- //
232
- // (1) case of unscoped token registered in k2hr3
233
- //
234
- if(!apiutil.isSafeEntity(req.body.auth) || !apiutil.isSafeString(req.body.auth.tenantName)){
235
- error = {
236
- result: false,
237
- message: 'POST body does not have tenant name(or user credentials)'
238
- };
239
- r3logger.elog(error.message);
240
- resutil.errResponse(req, res, 400, error); // 400: Bad Request
241
- return;
242
- }
243
- username = resobj.username;
244
- unscopedtoken = resobj.token;
245
-
246
- }else{
247
- //
248
- // (2) get (un)scoped token from other a token other than k2hr3(OpenStack, etc.)
249
- //
250
- otherToken = r3token.getAuthTokenHeader(req, false);
251
- if(!apiutil.isSafeString(otherToken)){
252
- error = {
253
- result: false,
254
- message: resobj.message
255
- };
256
- r3logger.elog(resobj.message);
257
- resutil.errResponse(req, res, resobj.status, error); // 40X
258
- return;
259
- }
260
- }
261
- }else{
262
- //
263
- // case of user credentials
264
- //
265
- username = apiutil.getSafeString(req.body.auth.passwordCredentials.username);
266
- passwd = apiutil.getSafeString(req.body.auth.passwordCredentials.password); // password is allowed empty, it depends on the authentication system.
267
- }
268
-
269
- return rawCommonGetUserToken(req, res, unscopedtoken, otherToken, username, passwd, tenant);
270
- });
271
-
272
- // Mountpath : '/v1/user/tokens'
273
- // PUT '/v1/user/tokens' : put(create) user token on version 1
274
- // response body : result => true/false
275
- // message => messages
276
- // scoped => true/false
277
- // token => token(unscoped or scoped)
278
- //
279
- router.put('/', function(req, res, next) // eslint-disable-line no-unused-vars
280
- {
281
- r3logger.dlog('CALL:', req.method, req.url);
282
-
283
- res.type('application/json; charset=utf-8');
284
-
285
- var error;
286
- if( !apiutil.isSafeEntity(req) ||
287
- !apiutil.isSafeEntity(req.query) )
288
- {
289
- error = {
290
- result: false,
291
- message: 'PUT argument does not have any data'
292
- };
293
- r3logger.elog(error.message);
294
- resutil.errResponse(req, res, 400, error); // 400: Bad Request
295
- return;
296
- }
297
-
298
- // arguments
299
- var tenant = apiutil.getSafeString(req.query.tenantname);
300
- var unscopedtoken = null;
301
- var otherToken = null;
302
- var username = null;
303
- var passwd = null;
304
-
305
- if(!apiutil.isSafeString(req.query.username)){
306
- //
307
- // Token is required if no user credentials are specified.
308
- //
309
- // [NOTE]
310
- // There are two cases in this case:
311
- // (1) Specify the UnscopedToken registered in k2hr3 to get the ScopedToken(must specify the tenant name)
312
- // (2) Specify a token other than k2hr3 (OpenStack, etc.) and perform Unauthenticated Token after user authentication.
313
- // In this case, if tenant is specified, ScopedToken can be obtained directly.
314
- //
315
-
316
- // get unscoped token
317
- var resobj = rawGetUnscopedUserToken(req);
318
- if(resobj.result){
319
- //
320
- // (1) case of unscoped token registered in k2hr3
321
- //
322
- if(!apiutil.isSafeString(req.query.tenantname)){
323
- error = {
324
- result: false,
325
- message: 'POST body does not have tenant name(or user credentials)'
326
- };
327
- r3logger.elog(error.message);
328
- resutil.errResponse(req, res, 400, error); // 400: Bad Request
329
- return;
330
- }
331
-
332
- username = resobj.username;
333
- unscopedtoken = resobj.token;
334
-
335
- }else{
336
- //
337
- // (2) get (un)scoped token from other a token other than k2hr3(OpenStack, etc.)
338
- //
339
- otherToken = r3token.getAuthTokenHeader(req, false);
340
- if(!apiutil.isSafeString(otherToken)){
341
- error = {
342
- result: false,
343
- message: resobj.message
344
- };
345
- r3logger.elog(resobj.message);
346
- resutil.errResponse(req, res, resobj.status, error); // 40X
347
- return;
348
- }
349
- }
350
- }else{
351
- //
352
- // case of user credentials
353
- //
354
- username = apiutil.getSafeString(req.query.username);
355
- passwd = apiutil.isSafeEntity(req.query.password) ? decodeURIComponent(apiutil.getSafeString(req.query.password)) : null; // password is allowed empty, it depends on the authentication system.
356
- }
357
-
358
- return rawCommonGetUserToken(req, res, unscopedtoken, otherToken, username, passwd, tenant);
359
- });
360
-
361
- //
362
- // Mountpath : '/v1/user/tokens'
363
- //
364
- // GET '/v1/user/tokens' : get user token on version 1
365
- // response body : result => true/false
366
- // message => messages
367
- // scoped => true/false
368
- // user => user name
369
- // tenants => [
370
- // {
371
- // name: "tenant name"
372
- // display: "display name"
373
- // id: "tenant id"
374
- // description: "tenant description"
375
- // },
376
- // ...
377
- // ]
378
- //
379
- // [NOTE]
380
- // If token is scoped, tenants array has only 1 element.
381
- // Which element has name and display member, but display is as same as name.
382
- // It is not real display name, because we take a cost getting it from APIs.
383
- //
384
- router.get('/', function(req, res, next)
385
- {
386
- r3logger.dlog('CALL:', req.method, req.url);
387
- if('HEAD' === req.method){
388
- // HEAD request comes here, so it should be routed to head function.
389
- next();
390
- return;
391
- }
392
-
393
- var _res = res;
394
- var _req = req;
395
- var result;
396
-
397
- _res.type('application/json; charset=utf-8');
398
-
399
- //------------------------------
400
- // get token
401
- //------------------------------
402
- var token_result = r3token.checkToken(_req, false, true); // not scope check, user token
403
- if(!token_result.result){
404
- r3logger.elog(token_result.message);
405
- var _status = token_result.status;
406
- delete token_result.status;
407
- resutil.errResponse(_req, _res, _status, token_result);
408
- return;
409
- }
410
- var token_info = token_result.token_info;
411
-
412
- // build response body
413
- if(token_info.scoped){
414
- // scoped token
415
- result = {
416
- result: true,
417
- message: 'succeed',
418
- scoped: true,
419
- user: token_info.user,
420
- tenants: [
421
- {
422
- name: token_info.tenant,
423
- display: token_info.display,
424
- id: token_info.id,
425
- description: token_info.description
426
- }
427
- ]
428
- };
429
- _res.status(200); // 200: OK
430
- _res.send(JSON.stringify(result));
431
-
432
- }else{
433
- // check and initialize tenant list
434
- r3token.initializeTenantList(token_result.token, token_info.user, function(error, tenant_list)
435
- {
436
- if(null !== error){
437
- var result = {
438
- result: false,
439
- message: 'failed to get tenant list for user (' + token_info.user + ') by unscoped token(' + token_result.token + ')'
440
- };
441
- r3logger.elog(result.message);
442
- resutil.errResponse(_req, _res, 404, result); // 404: Not Found
443
- return;
444
- }
445
-
446
- // reget tenant list
447
- tenant_list = r3token.getTenantList(token_info.user);
448
- if(null === tenant_list || apiutil.isEmptyArray(tenant_list)){
449
- result = {
450
- result: false,
451
- message: 'token(' + token_result.token + ') for user (' + token_info.user + ') does not have any tenant.'
452
- };
453
- r3logger.elog(result.message);
454
- resutil.errResponse(_req, _res, 404, result); // 404: Not Found
455
- return;
456
- }
457
-
458
- result = {
459
- result: true,
460
- message: 'succeed',
461
- scoped: false,
462
- user: token_info.user,
463
- tenants: tenant_list
464
- };
465
- _res.status(200); // 200: OK
466
- _res.send(JSON.stringify(result));
467
- });
468
- }
469
- });
470
-
471
- // Mountpath : '/v1/user/tokens'
472
- // HEAD '/v1/user/tokens' : check user token on version 1
473
- // response body : no
474
- //
475
- router.head('/', function(req, res, next) // eslint-disable-line no-unused-vars
476
- {
477
- r3logger.dlog('CALL:', req.method, req.url);
478
-
479
- var _res = res;
480
- var _req = req;
481
-
482
- _res.type('application/json; charset=utf-8');
483
-
484
- //------------------------------
485
- // get token
486
- //------------------------------
487
- var token_result = r3token.checkToken(_req, false, true); // not scope check, user token
488
- if(!token_result.result){
489
- r3logger.elog(token_result.message);
490
- resutil.errResponse(_req, _res, token_result.status);
491
- return;
492
- }
493
- var token_info = token_result.token_info;
494
-
495
- // token is not expired and it is safe.
496
- r3logger.mlog(r3logger.dump(token_info));
497
-
498
- _res.status(204); // 204: No Content
499
- _res.send();
500
- });
501
-
502
- module.exports = router;
503
-
504
- /*
505
- * Local variables:
506
- * tab-width: 4
507
- * c-basic-offset: 4
508
- * End:
509
- * vim600: noexpandtab sw=4 ts=4 fdm=marker
510
- * vim<600: noexpandtab sw=4 ts=4
511
- */