@samanbayaka/core-gtwy 0.0.2 → 0.0.4
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/CHANGELOG.md +14 -0
- package/index.mjs +3 -56
- package/package.json +2 -2
- package/src/access-token-validator.mjs +2 -2
package/CHANGELOG.md
CHANGED
package/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import * as tokenValidator from './src/access-token-validator.mjs'
|
|
|
11
11
|
* Regx pattern to allow cors sutes and cors origins
|
|
12
12
|
* @type {String}
|
|
13
13
|
*/
|
|
14
|
-
const patternTxt = (await core.getConfigs(`/config/sbk/
|
|
14
|
+
const patternTxt = (await core.getConfigs(`/config/sbk/gtwy/CORS`)) || undefined
|
|
15
15
|
const reqOriginRegex = patternTxt ? new RegExp(patternTxt, "i") : undefined
|
|
16
16
|
|
|
17
17
|
const gtwySchema = {
|
|
@@ -60,38 +60,6 @@ const gtwySchema = {
|
|
|
60
60
|
} : undefined,
|
|
61
61
|
|
|
62
62
|
routes: [
|
|
63
|
-
// // Public routes
|
|
64
|
-
// {
|
|
65
|
-
// path: "",
|
|
66
|
-
// authorization: false,
|
|
67
|
-
|
|
68
|
-
// onBeforeCall(ctx, route, req, res) {
|
|
69
|
-
// ctx.meta.method = req?.method
|
|
70
|
-
// ctx.meta.headers = req?.headers
|
|
71
|
-
// ctx.meta.cookies = req?.cookies
|
|
72
|
-
// },
|
|
73
|
-
|
|
74
|
-
// whitelist: [
|
|
75
|
-
// "gateway.apiDesc",
|
|
76
|
-
// "gateway.apiVer",
|
|
77
|
-
// /**
|
|
78
|
-
// * Access any actions in 'system' service
|
|
79
|
-
// */
|
|
80
|
-
// /^auth\.(?!listAliases$)\w+(?:\.\w+)*$/
|
|
81
|
-
// ],
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// aliases: {
|
|
85
|
-
// "GET /sbk/version": "gateway.apiVer",
|
|
86
|
-
// "GET /sbk/description": "gateway.apiDesc",
|
|
87
|
-
// },
|
|
88
|
-
|
|
89
|
-
// autoAliases: true,
|
|
90
|
-
// mergeParams: false,
|
|
91
|
-
// logging: false,
|
|
92
|
-
|
|
93
|
-
// },
|
|
94
|
-
|
|
95
63
|
/**
|
|
96
64
|
* Protected API routes
|
|
97
65
|
*/
|
|
@@ -163,29 +131,6 @@ const gtwySchema = {
|
|
|
163
131
|
},
|
|
164
132
|
|
|
165
133
|
|
|
166
|
-
// actions: {
|
|
167
|
-
// apiDesc:{
|
|
168
|
-
// openapi: {
|
|
169
|
-
// summary: "API Description",
|
|
170
|
-
// description: "Returns a textual description of the API."
|
|
171
|
-
// },
|
|
172
|
-
// handler: (ctx) => {
|
|
173
|
-
// return ctx.call("system.info.apiDesc")
|
|
174
|
-
// }
|
|
175
|
-
// },
|
|
176
|
-
|
|
177
|
-
// apiVer: {
|
|
178
|
-
// openapi: {
|
|
179
|
-
// summary: "API Version",
|
|
180
|
-
// description: "Returns the current version of the API."
|
|
181
|
-
// },
|
|
182
|
-
// handler: (ctx) => {
|
|
183
|
-
// return ctx.call("system.info.apiVer")
|
|
184
|
-
// },
|
|
185
|
-
// },
|
|
186
|
-
// },
|
|
187
|
-
|
|
188
|
-
|
|
189
134
|
methods: {
|
|
190
135
|
/**
|
|
191
136
|
* This overrides the errorHandler method found in the official file
|
|
@@ -201,6 +146,8 @@ const gtwySchema = {
|
|
|
201
146
|
authorize: tokenValidator.authorize,
|
|
202
147
|
},
|
|
203
148
|
}
|
|
149
|
+
|
|
150
|
+
|
|
204
151
|
export default {
|
|
205
152
|
...core,
|
|
206
153
|
schema: gtwySchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samanbayaka/core-gtwy",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"jsonwebtoken": "^9.0.3",
|
|
25
25
|
"jwks-rsa": "^4.0.1",
|
|
26
26
|
"moleculer-web": "^0.11.0",
|
|
27
|
-
"@samanbayaka/core": "0.0.
|
|
27
|
+
"@samanbayaka/core": "0.0.13"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -5,8 +5,8 @@ import jwksClient from "jwks-rsa"
|
|
|
5
5
|
|
|
6
6
|
import core from "@samanbayaka/core"
|
|
7
7
|
|
|
8
|
-
const ACCESS_ROLES = await core.getConfigs('/config/sbk/
|
|
9
|
-
const OPENID_CONFIG = await core.getConfigs('/config/sbk/
|
|
8
|
+
const ACCESS_ROLES = await core.getConfigs('/config/sbk/gtwy/yaml/roles')
|
|
9
|
+
const OPENID_CONFIG = await core.getConfigs('/config/sbk/gtwy/yaml/auth')
|
|
10
10
|
export const {clientId} = OPENID_CONFIG
|
|
11
11
|
|
|
12
12
|
/**
|