@nsshunt/stsconfig 1.17.2 → 1.20.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/.env-default CHANGED
@@ -103,8 +103,18 @@ AS_ENDPOINT=http://localhost
103
103
  AS_HOST_PORT=3002
104
104
  # Auth Server port (client port to access the service)
105
105
  AS_PORT=3002
106
- # Auth Server endpoint
107
- AS_API_ROOT=/stsauth/v1
106
+ # Auth Server API root.
107
+ AS_API_ROOT=/stsauth/v1.0
108
+ # Auth Server OAuth2 API root.
109
+ AS_OAUTH_API_ROOT=/oauth2/v2.0
110
+ # Auth Server Admin API root.
111
+ AS_ADMIN_API_ROOT=/admin/v1.0
112
+ # Auth Server API Identifier.
113
+ AS_API_IDENTIFIER=https://stsmda.com.au/stsauthapi/v1.0/
114
+ # Auth Server OAuth API Identifier.
115
+ AS_OAUTH_API_IDENTIFIER=https://stsmda.com.au/stsauthoauthapi/v2.0/
116
+ # Auth Server Administration API Identifier.
117
+ AS_ADMIN_API_IDENTIFIER=https://stsmda.com.au/stsauthadminapi/v1.0/
108
118
  # Auth Server Prometheus metric support
109
119
  AS_PROM_SUPPORT=true
110
120
  # Auth Prometheus Cluster Server port (port used for cluster prometheus scrapes)
@@ -131,6 +141,23 @@ AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key
131
141
  # Auth Server - Public Key (when using JWT)
132
142
  AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key
133
143
 
144
+ # STSBroker Server endpoint
145
+ BROKER_ENDPOINT=http://localhost
146
+ # STSBroker Server port (listen port for the service)
147
+ BROKER_HOST_PORT=3006
148
+ # STSBroker Server port (client port to access the service)
149
+ BROKER_PORT=3006
150
+ # STSBroker Server endpoint
151
+ BROKER_APIROOT=/stsbroker/v1.0
152
+ # STSBroker Prometheus metric support
153
+ BROKER_PROM_SUPPORT=true
154
+ # STSBroker Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
155
+ BROKER_PROM_CLUSTER_PORT=3016
156
+ # STSBroker Service Name
157
+ BROKER_SERVICE_NAME=STSBroker
158
+ # STSBroker Service Version
159
+ BROKER_SERVICE_VERSION=1.0.0
160
+
134
161
  # STS Test Runner Prometheus metric support
135
162
  TR_PROM_SUPPORT=true
136
163
  # STS Test Runner Cluster Server port (port used for cluster prometheus scrapes)
@@ -226,3 +253,32 @@ HTTPS_SERVER_KEY_PATH=/var/lib/sts/stsglobalresources/keys/server.key
226
253
 
227
254
  # HTTPS server cert path.
228
255
  HTTPS_SERVER_CERT_PATH=/var/lib/sts/stsglobalresources/keys/server.cert
256
+
257
+ # Maximum number of RSA keys in the JWKS store
258
+ TS_JWKS_KEYS=3
259
+
260
+ # File path for JWKS store data. This file will contain the public and private keys for the JWKS store.
261
+ TS_JWKS_STORE_PATH=/var/lib/sts/stsglobalresources/.stsauthprivate/jwks-private.json
262
+
263
+ # File path for JWKS public store data. This file will contain only the public signing keys for the JWKS store.
264
+ TS_JWKS_STORE_PUBLIC_PATH=/var/lib/sts/stsglobalresources/.well-known/jwks.json
265
+
266
+ # JWKS Authentication Configuration Settings
267
+ # Ref: https://github.com/auth0/node-jwks-rsa
268
+ # Enables a LRU cache. Ref: https://github.com/auth0/node-jwks-rsa#caching
269
+ JWKS_AUTH_CONFIG_CACHE=true
270
+
271
+ # Maximum number of LRU cache entries. Ref: https://github.com/auth0/node-jwks-rsa#caching
272
+ JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES=5
273
+
274
+ # Maximum age of LRU cache entries. Ref: https://github.com/auth0/node-jwks-rsa#caching
275
+ JWKS_AUTH_CONFIG_CACHE_MAX_AGE=600000
276
+
277
+ # Enforce rate limiting for jwks public endpoint query. Ref: https://github.com/auth0/node-jwks-rsa#rate-limiting
278
+ JWKS_AUTH_CONFIG_RATE_LIMIT=true
279
+
280
+ # Enforce rate limiting maximum number of requests per minute. Ref: https://github.com/auth0/node-jwks-rsa#rate-limiting
281
+ JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE=10
282
+
283
+ # Timeout for the public endpoint query. Note: This will be ignored if an http/https agent is specified.
284
+ JWKS_AUTH_CONFIG_TIMEOUT=30000
package/.env-test-file-2 CHANGED
@@ -70,9 +70,15 @@ TO_CLIENT_SECRET_FILE=testclientsecretfile
70
70
  AS_ENDPOINT=http://localhost-c
71
71
  AS_HOST_PORT=30020
72
72
  AS_PORT=30020
73
- AS_API_ROOT=/stsauth/v1-c
73
+ AS_API_ROOT=/stsauth/v1.0-c
74
+ AS_OAUTH_API_ROOT=/oauth2/v2.0-c
75
+ AS_ADMIN_API_ROOT=/admin/v1.0-c
74
76
  AS_API_IDENTIFIER=xyz
75
77
  AS_API_IDENTIFIER_FILE=testapiidentifierFile
78
+ AS_OAUTH_API_IDENTIFIER=xyz
79
+ AS_OAUTH_API_IDENTIFIER_FILE=testapiidentifierFile
80
+ AS_ADMIN_API_IDENTIFIER=xyz
81
+ AS_ADMIN_API_IDENTIFIER_FILE=testapiidentifierFile
76
82
  AS_PROM_SUPPORT=false
77
83
  AS_PROM_CLUSTER_PORT=30120
78
84
  AS_SERVICE_NAME=STSAuth-c
@@ -89,6 +95,21 @@ AS_ACCESS_TOKEN_EXPIRE=432000
89
95
  AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key-c
90
96
  AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key-c
91
97
 
98
+ BROKER_ENDPOINT=http://localhost-c
99
+ BROKER_HOST_PORT=3006-c
100
+ BROKER_PORT=3006-c
101
+ BROKER_APIROOT=/stsbroker/v1.0-c
102
+ BROKER_PROM_SUPPORT=false
103
+ BROKER_PROM_CLUSTER_PORT=3016-c
104
+ BROKER_SERVICE_NAME=STSBroker-c
105
+ BROKER_SERVICE_VERSION=1.0.0-c
106
+ BROKER_API_IDENTIFIER=xyz
107
+ BROKER_API_IDENTIFIER_FILE=testapiidentifierFile
108
+ BROKER_CLIENT_ID=xyz
109
+ BROKER_CLIENT_ID_FILE=testclientidfile
110
+ BROKER_CLIENT_SECRET=xyz
111
+ BROKER_CLIENT_SECRET_FILE=testclientsecretfile
112
+
92
113
  TR_PROM_SUPPORT=false
93
114
  TR_PROM_CLUSTER_PORT=30150
94
115
  TR_SERVICE_NAME=STSRestRunner-c
@@ -121,3 +142,14 @@ IGNORE_SOCKETIO=false
121
142
  MODEL_PURGE_UPDATE_TIMEOUT=50000
122
143
  HTTPS_SERVER_KEY_PATH=/var/lib/sts/stsglobalresources/keys/server.key-c
123
144
  HTTPS_SERVER_CERT_PATH=/var/lib/sts/stsglobalresources/keys/server.cert-c
145
+
146
+ TS_JWKS_KEYS=30
147
+ TS_JWKS_STORE_PATH=xyz
148
+ TS_JWKS_STORE_PATH_FILE=testclientsecretfile
149
+ TS_JWKS_STORE_PUBLIC_PATH=/var/lib/sts/stsglobalresources/.well-known/jwks.json-c
150
+ JWKS_AUTH_CONFIG_CACHE=false
151
+ JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES=50
152
+ JWKS_AUTH_CONFIG_CACHE_MAX_AGE=6000000
153
+ JWKS_AUTH_CONFIG_RATE_LIMIT=false
154
+ JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE=100
155
+ JWKS_AUTH_CONFIG_TIMEOUT=300000
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsconfig",
3
- "version": "1.17.2",
3
+ "version": "1.20.0",
4
4
  "description": "",
5
5
  "main": "stsconfig.js",
6
6
  "dependencies": {
@@ -114,7 +114,7 @@ describe("Test implicit config settings", () =>
114
114
 
115
115
  test('Checking default authentication service config', async () =>
116
116
  {
117
- expect.assertions(21);
117
+ expect.assertions(27);
118
118
 
119
119
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
120
120
  let goptions = require('./stsconfig.js').$options;
@@ -123,6 +123,8 @@ describe("Test implicit config settings", () =>
123
123
  expect(goptions.ashostport).toEqual('3002');
124
124
  expect(goptions.asport).toEqual('3002');
125
125
  expect(goptions.asapiroot).toEqual('/stsauth/v1.0');
126
+ expect(goptions.asoauthapiroot).toEqual('/oauth2/v2.0');
127
+ expect(goptions.asadminapiroot).toEqual('/admin/v1.0');
126
128
  expect(goptions.asprometheussupport).toEqual(true);
127
129
  expect(goptions.asprometheusclusterport).toEqual('3012');
128
130
  expect(goptions.asservicename).toEqual('STSAuth');
@@ -131,6 +133,10 @@ describe("Test implicit config settings", () =>
131
133
  expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key');
132
134
  expect(goptions.asapiidentifier).toEqual('https://stsmda.com.au/stsauthapi/v1.0/');
133
135
  expect(goptions.asapiidentifierfile).toEqual(undefined);
136
+ expect(goptions.asoauthapiidentifier).toEqual('https://stsmda.com.au/stsauthoauthapi/v2.0/');
137
+ expect(goptions.asoauthapiidentifierfile).toEqual(undefined);
138
+ expect(goptions.asadminapiidentifier).toEqual('https://stsmda.com.au/stsauthadminapi/v1.0/');
139
+ expect(goptions.asadminapiidentifierfile).toEqual(undefined);
134
140
  expect(goptions.asclientid).toEqual(undefined);
135
141
  expect(goptions.asclientidfile).toEqual(undefined);
136
142
  expect(goptions.asclientsecret).toEqual(undefined);
@@ -159,6 +165,29 @@ describe("Test implicit config settings", () =>
159
165
  expect(goptions.trclientsecretfile).toEqual(undefined);
160
166
  });
161
167
 
168
+ test('Checking default broker service config', async () =>
169
+ {
170
+ expect.assertions(14);
171
+
172
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
173
+ let goptions = require('./stsconfig.js').$options;
174
+
175
+ expect(goptions.brokerendpoint).toEqual('http://localhost');
176
+ expect(goptions.brokerhostport).toEqual('3006');
177
+ expect(goptions.brokerport).toEqual('3006');
178
+ expect(goptions.brokerapiroot).toEqual('/stsbroker/v1.0');
179
+ expect(goptions.brokerprometheussupport).toEqual(true);
180
+ expect(goptions.brokerprometheusclusterport).toEqual('3016');
181
+ expect(goptions.brokerservicename).toEqual('STSBroker');
182
+ expect(goptions.brokerserviceversion).toEqual('1.0.0');
183
+ expect(goptions.brokerapiidentifier).toEqual(undefined);
184
+ expect(goptions.brokerapiidentifierfile).toEqual(undefined);
185
+ expect(goptions.brokerclientid).toEqual(undefined);
186
+ expect(goptions.brokerclientidfile).toEqual(undefined);
187
+ expect(goptions.brokerclientsecret).toEqual(undefined);
188
+ expect(goptions.brokerclientsecretfile).toEqual(undefined);
189
+ });
190
+
162
191
  test('Checking default additional config items', async () =>
163
192
  {
164
193
  expect.assertions(22);
@@ -189,5 +218,24 @@ describe("Test implicit config settings", () =>
189
218
  expect(goptions.httpsserverkeypath).toEqual('/var/lib/sts/stsglobalresources/keys/server.key');
190
219
  expect(goptions.httpsservercertpath).toEqual('/var/lib/sts/stsglobalresources/keys/server.cert');
191
220
  });
221
+
222
+ test('Checking JWKS config items', async () =>
223
+ {
224
+ expect.assertions(10);
225
+
226
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
227
+ let goptions = require('./stsconfig.js').$options;
228
+
229
+ expect(goptions.tsjwkskeys).toEqual(3);
230
+ expect(goptions.tsjwksstorepath).toEqual('/var/lib/sts/stsglobalresources/.stsauthprivate/jwks-private.json');
231
+ expect(goptions.tsjwksstorepathfile).toEqual(undefined);
232
+ expect(goptions.tsjwksstorepublicpath).toEqual('/var/lib/sts/stsglobalresources/.well-known/jwks.json');
233
+ expect(goptions.jwksAuthConfigCache).toEqual(true);
234
+ expect(goptions.jwksAuthConfigCacheMaxEntries).toEqual(5);
235
+ expect(goptions.jwksAuthConfigCacheMaxAge).toEqual(600000);
236
+ expect(goptions.jwksAuthConfigRateLimit).toEqual(true);
237
+ expect(goptions.jwksAuthConfigRateLimitRequestsPerMinute).toEqual(10);
238
+ expect(goptions.jwksAuthConfigTimeout).toEqual(30000);
239
+ });
192
240
  });
193
241
 
@@ -114,7 +114,7 @@ describe("Test configured settings", () =>
114
114
 
115
115
  test('Checking default authentication service config', async () =>
116
116
  {
117
- expect.assertions(21);
117
+ expect.assertions(27);
118
118
 
119
119
  process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
120
120
  let goptions = require('./stsconfig.js').$options;
@@ -122,7 +122,9 @@ describe("Test configured settings", () =>
122
122
  expect(goptions.asendpoint).toEqual('http://localhost-c');
123
123
  expect(goptions.ashostport).toEqual('30020');
124
124
  expect(goptions.asport).toEqual('30020');
125
- expect(goptions.asapiroot).toEqual('/stsauth/v1-c');
125
+ expect(goptions.asapiroot).toEqual('/stsauth/v1.0-c');
126
+ expect(goptions.asoauthapiroot).toEqual('/oauth2/v2.0-c');
127
+ expect(goptions.asadminapiroot).toEqual('/admin/v1.0-c');
126
128
  expect(goptions.asprometheussupport).toEqual(false);
127
129
  expect(goptions.asprometheusclusterport).toEqual('30120');
128
130
  expect(goptions.asservicename).toEqual('STSAuth-c');
@@ -131,6 +133,10 @@ describe("Test configured settings", () =>
131
133
  expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key-c');
132
134
  expect(goptions.asapiidentifier).toEqual('testapiidentifierfilecontents');
133
135
  expect(goptions.asapiidentifierfile).toEqual('testapiidentifierFile');
136
+ expect(goptions.asoauthapiidentifier).toEqual('testapiidentifierfilecontents');
137
+ expect(goptions.asoauthapiidentifierfile).toEqual('testapiidentifierFile');
138
+ expect(goptions.asadminapiidentifier).toEqual('testapiidentifierfilecontents');
139
+ expect(goptions.asadminapiidentifierfile).toEqual('testapiidentifierFile');
134
140
  expect(goptions.asclientid).toEqual('testclientidfilecontents');
135
141
  expect(goptions.asclientidfile).toEqual('testclientidfile'); // testclientidfile
136
142
  expect(goptions.asclientsecret).toEqual('testclientsecretfilecontents');
@@ -159,6 +165,29 @@ describe("Test configured settings", () =>
159
165
  expect(goptions.trclientsecretfile).toEqual('testclientsecretfile');
160
166
  });
161
167
 
168
+ test('Checking default broker service config', async () =>
169
+ {
170
+ expect.assertions(14);
171
+
172
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
173
+ let goptions = require('./stsconfig.js').$options;
174
+
175
+ expect(goptions.brokerendpoint).toEqual('http://localhost-c');
176
+ expect(goptions.brokerhostport).toEqual('3006-c');
177
+ expect(goptions.brokerport).toEqual('3006-c');
178
+ expect(goptions.brokerapiroot).toEqual('/stsbroker/v1.0-c');
179
+ expect(goptions.brokerprometheussupport).toEqual(false);
180
+ expect(goptions.brokerprometheusclusterport).toEqual('3016-c');
181
+ expect(goptions.brokerservicename).toEqual('STSBroker-c');
182
+ expect(goptions.brokerserviceversion).toEqual('1.0.0-c');
183
+ expect(goptions.brokerapiidentifier).toEqual('testapiidentifierfilecontents');
184
+ expect(goptions.brokerapiidentifierfile).toEqual('testapiidentifierFile');
185
+ expect(goptions.brokerclientid).toEqual('testclientidfilecontents');
186
+ expect(goptions.brokerclientidfile).toEqual('testclientidfile'); // testclientidfile
187
+ expect(goptions.brokerclientsecret).toEqual('testclientsecretfilecontents');
188
+ expect(goptions.brokerclientsecretfile).toEqual('testclientsecretfile');
189
+ });
190
+
162
191
  test('Checking default additional config items', async () =>
163
192
  {
164
193
  expect.assertions(22);
@@ -189,5 +218,24 @@ describe("Test configured settings", () =>
189
218
  expect(goptions.httpsserverkeypath).toEqual('/var/lib/sts/stsglobalresources/keys/server.key-c');
190
219
  expect(goptions.httpsservercertpath).toEqual('/var/lib/sts/stsglobalresources/keys/server.cert-c');
191
220
  });
221
+
222
+ test('Checking JWKS config items', async () =>
223
+ {
224
+ expect.assertions(10);
225
+
226
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
227
+ let goptions = require('./stsconfig.js').$options;
228
+
229
+ expect(goptions.tsjwkskeys).toEqual(30);
230
+ expect(goptions.tsjwksstorepath).toEqual('testclientsecretfilecontents');
231
+ expect(goptions.tsjwksstorepathfile).toEqual('testclientsecretfile');
232
+ expect(goptions.tsjwksstorepublicpath).toEqual('/var/lib/sts/stsglobalresources/.well-known/jwks.json-c');
233
+ expect(goptions.jwksAuthConfigCache).toEqual(false);
234
+ expect(goptions.jwksAuthConfigCacheMaxEntries).toEqual(50);
235
+ expect(goptions.jwksAuthConfigCacheMaxAge).toEqual(6000000);
236
+ expect(goptions.jwksAuthConfigRateLimit).toEqual(false);
237
+ expect(goptions.jwksAuthConfigRateLimitRequestsPerMinute).toEqual(100);
238
+ expect(goptions.jwksAuthConfigTimeout).toEqual(300000);
239
+ });
192
240
  });
193
241
 
@@ -114,7 +114,7 @@ describe("Test explicit default config settings", () =>
114
114
 
115
115
  test('Checking default authentication service config', async () =>
116
116
  {
117
- expect.assertions(21);
117
+ expect.assertions(27);
118
118
 
119
119
  process.env.STSENVFILE = './.env-default'; // Empty environment file
120
120
  let goptions = require('./stsconfig.js').$options;
@@ -122,7 +122,9 @@ describe("Test explicit default config settings", () =>
122
122
  expect(goptions.asendpoint).toEqual('http://localhost');
123
123
  expect(goptions.ashostport).toEqual('3002');
124
124
  expect(goptions.asport).toEqual('3002');
125
- expect(goptions.asapiroot).toEqual('/stsauth/v1');
125
+ expect(goptions.asapiroot).toEqual('/stsauth/v1.0');
126
+ expect(goptions.asoauthapiroot).toEqual('/oauth2/v2.0');
127
+ expect(goptions.asadminapiroot).toEqual('/admin/v1.0');
126
128
  expect(goptions.asprometheussupport).toEqual(true);
127
129
  expect(goptions.asprometheusclusterport).toEqual('3012');
128
130
  expect(goptions.asservicename).toEqual('STSAuth');
@@ -131,6 +133,10 @@ describe("Test explicit default config settings", () =>
131
133
  expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key');
132
134
  expect(goptions.asapiidentifier).toEqual('https://stsmda.com.au/stsauthapi/v1.0/');
133
135
  expect(goptions.asapiidentifierfile).toEqual(undefined);
136
+ expect(goptions.asoauthapiidentifier).toEqual('https://stsmda.com.au/stsauthoauthapi/v2.0/');
137
+ expect(goptions.asoauthapiidentifierfile).toEqual(undefined);
138
+ expect(goptions.asadminapiidentifier).toEqual('https://stsmda.com.au/stsauthadminapi/v1.0/');
139
+ expect(goptions.asadminapiidentifierfile).toEqual(undefined);
134
140
  expect(goptions.asclientid).toEqual(undefined);
135
141
  expect(goptions.asclientidfile).toEqual(undefined);
136
142
  expect(goptions.asclientsecret).toEqual(undefined);
@@ -159,6 +165,29 @@ describe("Test explicit default config settings", () =>
159
165
  expect(goptions.trclientsecretfile).toEqual(undefined);
160
166
  });
161
167
 
168
+ test('Checking default broker service config', async () =>
169
+ {
170
+ expect.assertions(14);
171
+
172
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
173
+ let goptions = require('./stsconfig.js').$options;
174
+
175
+ expect(goptions.brokerendpoint).toEqual('http://localhost');
176
+ expect(goptions.brokerhostport).toEqual('3006');
177
+ expect(goptions.brokerport).toEqual('3006');
178
+ expect(goptions.brokerapiroot).toEqual('/stsbroker/v1.0');
179
+ expect(goptions.brokerprometheussupport).toEqual(true);
180
+ expect(goptions.brokerprometheusclusterport).toEqual('3016');
181
+ expect(goptions.brokerservicename).toEqual('STSBroker');
182
+ expect(goptions.brokerserviceversion).toEqual('1.0.0');
183
+ expect(goptions.brokerapiidentifier).toEqual(undefined);
184
+ expect(goptions.brokerapiidentifierfile).toEqual(undefined);
185
+ expect(goptions.brokerclientid).toEqual(undefined);
186
+ expect(goptions.brokerclientidfile).toEqual(undefined);
187
+ expect(goptions.brokerclientsecret).toEqual(undefined);
188
+ expect(goptions.brokerclientsecretfile).toEqual(undefined);
189
+ });
190
+
162
191
  test('Checking default additional config items', async () =>
163
192
  {
164
193
  expect.assertions(22);
@@ -189,5 +218,24 @@ describe("Test explicit default config settings", () =>
189
218
  expect(goptions.httpsserverkeypath).toEqual('/var/lib/sts/stsglobalresources/keys/server.key');
190
219
  expect(goptions.httpsservercertpath).toEqual('/var/lib/sts/stsglobalresources/keys/server.cert');
191
220
  });
221
+
222
+ test('Checking JWKS config items', async () =>
223
+ {
224
+ expect.assertions(10);
225
+
226
+ process.env.STSENVFILE = './.env-default'; // Empty environment file
227
+ let goptions = require('./stsconfig.js').$options;
228
+
229
+ expect(goptions.tsjwkskeys).toEqual(3);
230
+ expect(goptions.tsjwksstorepath).toEqual('/var/lib/sts/stsglobalresources/.stsauthprivate/jwks-private.json');
231
+ expect(goptions.tsjwksstorepathfile).toEqual(undefined);
232
+ expect(goptions.tsjwksstorepublicpath).toEqual('/var/lib/sts/stsglobalresources/.well-known/jwks.json');
233
+ expect(goptions.jwksAuthConfigCache).toEqual(true);
234
+ expect(goptions.jwksAuthConfigCacheMaxEntries).toEqual(5);
235
+ expect(goptions.jwksAuthConfigCacheMaxAge).toEqual(600000);
236
+ expect(goptions.jwksAuthConfigRateLimit).toEqual(true);
237
+ expect(goptions.jwksAuthConfigRateLimitRequestsPerMinute).toEqual(10);
238
+ expect(goptions.jwksAuthConfigTimeout).toEqual(30000);
239
+ });
192
240
  });
193
241
 
package/stsconfig.js CHANGED
@@ -163,11 +163,11 @@ const defconfig =
163
163
  ,ashostport: (process.env.AS_HOST_PORT === undefined ? "3002" : process.env.AS_HOST_PORT)
164
164
  // Auth Server port (client port to access the service)
165
165
  ,asport: (process.env.AS_PORT === undefined ? "3002" : process.env.AS_PORT)
166
- // Auth Server endpoint
166
+ // Auth Server API root.
167
167
  ,asapiroot: (process.env.AS_API_ROOT === undefined ? "/stsauth/v1.0" : process.env.AS_API_ROOT)
168
- // Auth Server API Identifier.
168
+ // Auth Server OAuth2 API root.
169
169
  ,asoauthapiroot: (process.env.AS_OAUTH_API_ROOT === undefined ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT)
170
- // Auth Server Admin API Identifier.
170
+ // Auth Server Admin API root.
171
171
  ,asadminapiroot: (process.env.AS_ADMIN_API_ROOT === undefined ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT)
172
172
  // Auth Server API Identifier.
173
173
  ,asapiidentifier: (process.env.AS_API_IDENTIFIER === undefined ? 'https://stsmda.com.au/stsauthapi/v1.0/' : process.env.AS_API_IDENTIFIER)
@@ -214,7 +214,41 @@ const defconfig =
214
214
  ,asprivatekeypath: (process.env.AS_PRIVATE_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/private.key" : process.env.AS_PRIVATE_KEY_PATH)
215
215
  // Auth Server - [DEPRECATED] Public Key (when using JWT)
216
216
  ,aspublickeypath: (process.env.AS_PUBLIC_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/public.key" : process.env.AS_PUBLIC_KEY_PATH)
217
-
217
+
218
+ // STS Broker Server
219
+ // ---------------
220
+ // The STS broker server is a BFF service used for STS SPAs. The service will use 1st party secured cookies for session management.
221
+ // The service also provides proxy API access to other STS and/or external services.
222
+ //
223
+ // STSBroker Server endpoint
224
+ ,brokerendpoint: (process.env.BROKER_ENDPOINT === undefined ? "http://localhost" : process.env.BROKER_ENDPOINT)
225
+ // STSBroker Server port (listen port for the service)
226
+ ,brokerhostport: (process.env.BROKER_HOST_PORT === undefined ? "3006" : process.env.BROKER_HOST_PORT)
227
+ // STSBroker Server port (client port to access the service)
228
+ ,brokerport: (process.env.BROKER_PORT === undefined ? "3006" : process.env.BROKER_PORT)
229
+ // STSBroker Server endpoint
230
+ ,brokerapiroot: (process.env.BROKER_APIROOT === undefined ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT)
231
+ // STSBroker API Identifier. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
232
+ ,brokerapiidentifier: process.env.BROKER_API_IDENTIFIER
233
+ // STSBroker API Identifier file. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
234
+ ,brokerapiidentifierfile: process.env.BROKER_API_IDENTIFIER_FILE
235
+ // STSBroker Prometheus metric support
236
+ ,brokerprometheussupport: (process.env.BROKER_PROM_SUPPORT === undefined ? true : (process.env.BROKER_PROM_SUPPORT === "true" ? true : false))
237
+ // STSBroker Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
238
+ ,brokerprometheusclusterport: (process.env.BROKER_PROM_CLUSTER_PORT === undefined ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT)
239
+ // STSBroker Service Name
240
+ ,brokerservicename: (process.env.BROKER_SERVICE_NAME === undefined ? "STSBroker" : process.env.BROKER_SERVICE_NAME)
241
+ // STSBroker Service Version
242
+ ,brokerserviceversion: (process.env.BROKER_SERVICE_VERSION === undefined ? "1.0.0" : process.env.BROKER_SERVICE_VERSION)
243
+ // STSBroker Server client ID. Used for oauth2 client credentials flow.
244
+ ,brokerclientid: process.env.BROKER_CLIENT_ID
245
+ // STSBroker Server client ID file. Used for oauth2 client credentials flow.
246
+ ,brokerclientidfile: process.env.BROKER_CLIENT_ID_FILE
247
+ // STSBroker Server client secret. Used for oauth2 client credentials flow.
248
+ ,brokerclientsecret: process.env.BROKER_CLIENT_SECRET
249
+ // STSBroker Server client secret file. Used for oauth2 client credentials flow.
250
+ ,brokerclientsecretfile: process.env.BROKER_CLIENT_SECRET_FILE
251
+
218
252
  // STS Test Runner Prometheus metric support
219
253
  ,trprometheussupport: (process.env.TR_PROM_SUPPORT === undefined ? true : (process.env.TR_PROM_SUPPORT === "true" ? true : false ))
220
254
  // STS Test Runner Cluster Server port (port used for cluster prometheus scrapes)
@@ -355,6 +389,26 @@ const defconfig =
355
389
  ,tsjwksstorepathfile: process.env.TS_JWKS_STORE_PATH_FILE
356
390
  // File path for JWKS public store data. This file will contain only the public signing keys for the JWKS store.
357
391
  ,tsjwksstorepublicpath: (process.env.TS_JWKS_STORE_PUBLIC_PATH === undefined ? "/var/lib/sts/stsglobalresources/.well-known/jwks.json" : process.env.TS_JWKS_STORE_PUBLIC_PATH)
392
+
393
+ // JWKS Authentication Configuration Settings
394
+ // Ref: https://github.com/auth0/node-jwks-rsa
395
+ // Enables a LRU cache. Ref: https://github.com/auth0/node-jwks-rsa#caching
396
+ ,jwksAuthConfigCache: (process.env.JWKS_AUTH_CONFIG_CACHE === undefined ? true : (process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false ))
397
+
398
+ // Maximum number of LRU cache entries. Ref: https://github.com/auth0/node-jwks-rsa#caching
399
+ ,jwksAuthConfigCacheMaxEntries: (process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === undefined ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES))
400
+
401
+ // Maximum age of LRU cache entries. Ref: https://github.com/auth0/node-jwks-rsa#caching
402
+ ,jwksAuthConfigCacheMaxAge: (process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === undefined ? 600000 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE))
403
+
404
+ // Enforce rate limiting for jwks public endpoint query. Ref: https://github.com/auth0/node-jwks-rsa#rate-limiting
405
+ ,jwksAuthConfigRateLimit: (process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === undefined ? true : (process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false ))
406
+
407
+ // Enforce rate limiting maximum number of requests per minute. Ref: https://github.com/auth0/node-jwks-rsa#rate-limiting
408
+ ,jwksAuthConfigRateLimitRequestsPerMinute: (process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE === undefined ? 10 : parseInt(process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE))
409
+
410
+ // Timeout for the public endpoint query. Note: This will be ignored if an http/https agent is specified.
411
+ ,jwksAuthConfigTimeout: (process.env.JWKS_AUTH_CONFIG_TIMEOUT === undefined ? 30000 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT))
358
412
  }
359
413
 
360
414
  const ReadFile = (passwordFile) => {
@@ -374,18 +428,23 @@ const fileconfig = [
374
428
  { fileprop: 'dbpasswordfile', prop: 'dbpassword' },
375
429
  // API identifier file processing
376
430
  { fileprop: 'asapiidentifierfile', prop: 'asapiidentifier' },
431
+ { fileprop: 'asoauthapiidentifierfile', prop: 'asoauthapiidentifier' },
432
+ { fileprop: 'asadminapiidentifierfile', prop: 'asadminapiidentifier' },
377
433
  { fileprop: 'rest01apiidentifierfile', prop: 'rest01apiidentifier' },
434
+ { fileprop: 'brokerapiidentifierfile', prop: 'brokerapiidentifier' },
378
435
  { fileprop: 'toapiidentifierfile', prop: 'toapiidentifier' },
379
436
  { fileprop: 'imapiidentifierfile', prop: 'imapiidentifier' },
380
437
  // Client ID file processing
381
438
  { fileprop: 'asclientidfile', prop: 'asclientid' },
382
439
  { fileprop: 'rest01clientidfile', prop: 'rest01clientid' },
440
+ { fileprop: 'brokerclientidfile', prop: 'brokerclientid' },
383
441
  { fileprop: 'toclientidfile', prop: 'toclientid' },
384
442
  { fileprop: 'imclientidfile', prop: 'imclientid' },
385
443
  { fileprop: 'trclientidfile', prop: 'trclientid' },
386
444
  // Client secret file processing
387
445
  { fileprop: 'asclientsecretfile', prop: 'asclientsecret' },
388
446
  { fileprop: 'rest01clientsecretfile', prop: 'rest01clientsecret' },
447
+ { fileprop: 'brokerclientsecretfile', prop: 'brokerclientsecret' },
389
448
  { fileprop: 'toclientsecretfile', prop: 'toclientsecret' },
390
449
  { fileprop: 'imclientsecretfile', prop: 'imclientsecret' },
391
450
  { fileprop: 'trclientsecretfile', prop: 'trclientsecret' },