apf-node-common 2.0.1 → 3.0.0
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/index.js +2 -1
- package/package.json +1 -2
- package/utils/AccessInterceptor.js +26 -26
package/index.js
CHANGED
|
@@ -154,7 +154,8 @@ module.exports.AWSUsagePlanAndApiKey = {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
module.exports.AccessInterceptor = {
|
|
157
|
-
authorize: AccessInterceptor.authorize
|
|
157
|
+
// authorize: AccessInterceptor.authorize,
|
|
158
|
+
authorizeWithOpenApiJson: AccessInterceptor.authorizeWithOpenApiJson
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
module.exports.HashIds = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apf-node-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"moment": "^2.24.0",
|
|
22
22
|
"moment-timezone": "^0.5.27",
|
|
23
23
|
"path-to-regexp": "^6.1.0",
|
|
24
|
-
"swagger-jsdoc": "^3.4.0",
|
|
25
24
|
"winston": "^3.2.1",
|
|
26
25
|
"winston-aws-cloudwatch": "^3.0.0",
|
|
27
26
|
"winston-daily-rotate-file": "^4.5.0"
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
const { pathToRegexp } = require('path-to-regexp')
|
|
2
|
-
const swaggerJSDoc = require('swagger-jsdoc');
|
|
3
|
-
|
|
4
|
-
function authorize(req, res, options, httpContext, next) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
1
|
+
const { pathToRegexp } = require('path-to-regexp');
|
|
2
|
+
// const swaggerJSDoc = require('swagger-jsdoc');
|
|
3
|
+
|
|
4
|
+
// function authorize(req, res, options, httpContext, next) {
|
|
5
|
+
// console.log('AccessInterceptor -> authorize');
|
|
6
|
+
// /*var options = {
|
|
7
|
+
// swaggerDefinition: swaggerDefinition,
|
|
8
|
+
// apis: ['swagger/*.js']
|
|
9
|
+
// };*/
|
|
10
|
+
|
|
11
|
+
// const swaggerSpec = swaggerJSDoc(options)
|
|
12
|
+
// const swaggerJson = JSON.parse(JSON.stringify(swaggerSpec))
|
|
13
|
+
// try {
|
|
14
|
+
// const isAllowed = validateAccess(swaggerJson, req, httpContext, res);
|
|
15
|
+
// if (isAllowed === false) {
|
|
16
|
+
// return isAllowed
|
|
17
|
+
// }
|
|
18
|
+
// return true;
|
|
19
|
+
|
|
20
|
+
// } catch (error) {
|
|
21
|
+
// console.log(error);
|
|
22
|
+
// return error;
|
|
23
|
+
// }
|
|
24
|
+
// next();
|
|
25
|
+
// }
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Authorize request based on swagger specification
|
|
@@ -111,5 +111,5 @@ function getReplacePath(path) {
|
|
|
111
111
|
str = str.replace(/}/g, '');
|
|
112
112
|
return str
|
|
113
113
|
}
|
|
114
|
-
exports.authorize = authorize;
|
|
114
|
+
// exports.authorize = authorize;
|
|
115
115
|
exports.authorizeWithOpenApiJson = authorizeWithOpenApiJson;
|