@nsshunt/stsconfig 1.15.0 → 1.16.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
@@ -62,14 +62,6 @@ REST01_PROM_CLUSTER_PORT=3013
62
62
  REST01_SERVICE_NAME=STSRest01
63
63
  # STSREST01 Service Version
64
64
  REST01_SERVICE_VERSION=1.0.0
65
- # STSREST01 Service Credentials
66
- # -----------------------------
67
- # STSREST01 Server username email
68
- REST01_EMAIL=STSREST01ServiceUser@stsmda.com
69
- # STSREST01 Server username password
70
- REST01_PASSWORD=STSREST01ServiceUserPassword
71
- # STSREST01 Server username password file
72
- #REST01_PASSWORD_FILE
73
65
 
74
66
  # STS Instrument Manager Service endpoint
75
67
  IM_ENDPOINT=http://localhost
@@ -87,14 +79,6 @@ IM_PROM_CLUSTER_PORT=3011
87
79
  IM_SERVICE_NAME=STSInstrumentManager
88
80
  # STS Instrument Manager Service Version
89
81
  IM_SERVICE_VERSION=1.0.0
90
- # STS Instrument Manager Service Credentials
91
- # ------------------------------------------
92
- # STS Instrument Manager Service username email
93
- IM_EMAIL=STSInstrumentManagerServiceUser@stsmda.com
94
- # STS Instrument Manager Service username password
95
- IM_PASSWORD=STSInstrumentManagerServiceUserPassword
96
- # STS Instrument Manager Service username password file
97
- #IM_PASSWORD_FILE
98
82
 
99
83
  # STS Test Orchestrator Service endpoint
100
84
  TO_ENDPOINT=http://localhost
@@ -112,14 +96,6 @@ TO_PROM_CLUSTER_PORT=3014
112
96
  TO_SERVICE_NAME=STSTestOrchestrator
113
97
  # STS Test Orchestrator Service Version
114
98
  TO_SERVICE_VERSION=1.0.0
115
- # STS Test Orchestrator Service Credentials
116
- # ------------------------------------------
117
- # STS Test Orchestrator Service username email
118
- TO_EMAIL=STSTestOrchestratorServiceUser@stsmda.com
119
- # STS Test Orchestrator Service username password
120
- TO_PASSWORD=STSTestOrchestratorServiceUserPassword
121
- # STS Test Orchestrator Service username password file
122
- #TO_PASSWORD_FILE
123
99
 
124
100
  # Auth Server endpoint
125
101
  AS_ENDPOINT=http://localhost
@@ -137,14 +113,19 @@ AS_PROM_CLUSTER_PORT=3012
137
113
  AS_SERVICE_NAME=STSAuth
138
114
  # STSAuth Service Version
139
115
  AS_SERVICE_VERSION=1.0.0
140
- # STS Auth Service Credentials
141
- # ----------------------------
142
- # Auth Server username email
143
- AS_EMAIL=STSAuthServiceUser@stsmda.com
144
- # Auth Server username password
145
- AS_PASSWORD=STSAuthServiceUserPassword
146
- # Auth Server username password file
147
- #AS_PASSWORD_FILE
116
+ # Auth Server - JWKS Public End Point.
117
+ AS_JWKS_JSON_PATH=/.well-known/jwks.json
118
+ # Auth Server - JWKS key rotation time (seconds).
119
+ AS_JWKS_KEY_ROTATION_TIME=86400
120
+ # Auth Server - JWKS key purge time offset (seconds). Old keys (current keys are considered 'old' immediately after a key rotation) will be kept
121
+ # for asaccesstokenexpire + asjwkskeypurgetimeoffset seconds before purging from the JWKS.
122
+ AS_JWKS_KEY_PURGE_TIME_OFFSET=300
123
+ # Auth Server - JWKS key count. Defines the number of active keys within the JWKS. Note that the actual key count may be double this value as current
124
+ # keys are rotated to old keys prior to old key purge. Old keys will be kept for asaccesstokenexpire + asjwkskeypurgetimeoffset seconds before removal from the JWKS.
125
+ # This is to ensure that any tokens signed by a current key that is then expired can still be validated within the life of the issued token.
126
+ AS_JWKS_KEY_COUNT=4
127
+ # Auth Server - JWKS Access token timeout.
128
+ AS_ACCESS_TOKEN_EXPIRE=43200
148
129
  # Auth Server - Private Key (when using JWT)
149
130
  AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key
150
131
  # Auth Server - Public Key (when using JWT)
@@ -158,14 +139,6 @@ TR_PROM_CLUSTER_PORT=3015
158
139
  TR_SERVICE_NAME=STSRestRunner
159
140
  # STS Test Runner Service Version
160
141
  TR_SERVICE_VERSION=1.0.0
161
- # STS Test Runner Credentials
162
- # ----------------------------
163
- # STS Test Runner username email
164
- TR_EMAIL=STSTestRunnerServiceUser@stsmda.com
165
- # STS Test Runner password
166
- TR_PASSWORD=STSTestRunnerServiceUserPassword
167
- # STS Test Runner password file
168
- #TR_PASSWORD_FILE
169
142
 
170
143
  # Duration (in ms) between each publish event.
171
144
  PUBLISH_INTERVAL=1000
package/.env-test-file-2 CHANGED
@@ -30,9 +30,12 @@ REST01_PROM_SUPPORT=false
30
30
  REST01_PROM_CLUSTER_PORT=30130
31
31
  REST01_SERVICE_NAME=STSRest01-c
32
32
  REST01_SERVICE_VERSION=1.0.0-c
33
- REST01_EMAIL=K6TestUser@sts-c
34
- REST01_PASSWORD=K6TestUserPassword-c
35
- REST01_PASSWORD_FILE=testpasswordfile
33
+ REST01_API_IDENTIFIER=xyz
34
+ REST01_API_IDENTIFIER_FILE=testapiidentifierFile
35
+ REST01_CLIENT_ID=xyz
36
+ REST01_CLIENT_ID_FILE=testclientidfile
37
+ REST01_CLIENT_SECRET=xyz
38
+ REST01_CLIENT_SECRET_FILE=testclientsecretfile
36
39
 
37
40
  IM_ENDPOINT=http://localhost-c
38
41
  IM_HOST_PORT=30010
@@ -42,9 +45,12 @@ IM_PROM_SUPPORT=false
42
45
  IM_PROM_CLUSTER_PORT=30110
43
46
  IM_SERVICE_NAME=STSInstrumentManager-c
44
47
  IM_SERVICE_VERSION=1.0.0-c
45
- IM_EMAIL=K6TestUser@sts-c
46
- IM_PASSWORD=K6TestUserPassword-c
47
- IM_PASSWORD_FILE=testpasswordfile
48
+ IM_API_IDENTIFIER=xyz
49
+ IM_API_IDENTIFIER_FILE=testapiidentifierFile
50
+ IM_CLIENT_ID=xyz
51
+ IM_CLIENT_ID_FILE=testclientidfile
52
+ IM_CLIENT_SECRET=xyz
53
+ IM_CLIENT_SECRET_FILE=testclientsecretfile
48
54
 
49
55
  TO_ENDPOINT=http://localhost-c
50
56
  TO_HOST_PORT=30040
@@ -54,21 +60,32 @@ TO_PROM_SUPPORT=false
54
60
  TO_PROM_CLUSTER_PORT=30140
55
61
  TO_SERVICE_NAME=STSTestOrchestrator-c
56
62
  TO_SERVICE_VERSION=1.0.0-c
57
- TO_EMAIL=K6TestUser@sts-c
58
- TO_PASSWORD=K6TestUserPassword-c
59
- TO_PASSWORD_FILE=testpasswordfile
63
+ TO_API_IDENTIFIER=xyz
64
+ TO_API_IDENTIFIER_FILE=testapiidentifierFile
65
+ TO_CLIENT_ID=xyz
66
+ TO_CLIENT_ID_FILE=testclientidfile
67
+ TO_CLIENT_SECRET=xyz
68
+ TO_CLIENT_SECRET_FILE=testclientsecretfile
60
69
 
61
70
  AS_ENDPOINT=http://localhost-c
62
71
  AS_HOST_PORT=30020
63
72
  AS_PORT=30020
64
73
  AS_APIROOT=/stsauth/v1-c
74
+ AS_API_IDENTIFIER=xyz
75
+ AS_API_IDENTIFIER_FILE=testapiidentifierFile
65
76
  AS_PROM_SUPPORT=false
66
77
  AS_PROM_CLUSTER_PORT=30120
67
78
  AS_SERVICE_NAME=STSAuth-c
68
79
  AS_SERVICE_VERSION=1.0.0-c
69
- AS_EMAIL=K6TestUser@sts-c
70
- AS_PASSWORD=K6TestUserPassword-c
71
- AS_PASSWORD_FILE=testpasswordfile
80
+ AS_CLIENT_ID=xyz
81
+ AS_CLIENT_ID_FILE=testclientidfile
82
+ AS_CLIENT_SECRET=xyz
83
+ AS_CLIENT_SECRET_FILE=testclientsecretfile
84
+ AS_JWKS_JSON_PATH=/.well-known/jwks.json-c
85
+ AS_JWKS_KEY_ROTATION_TIME=864000
86
+ AS_JWKS_KEY_PURGE_TIME_OFFSET=3000
87
+ AS_JWKS_KEY_COUNT=40
88
+ AS_ACCESS_TOKEN_EXPIRE=432000
72
89
  AS_PRIVATE_KEY_PATH=/var/lib/sts/stsglobalresources/keys/private.key-c
73
90
  AS_PUBLIC_KEY_PATH=/var/lib/sts/stsglobalresources/keys/public.key-c
74
91
 
@@ -76,9 +93,10 @@ TR_PROM_SUPPORT=false
76
93
  TR_PROM_CLUSTER_PORT=30150
77
94
  TR_SERVICE_NAME=STSRestRunner-c
78
95
  TR_SERVICE_VERSION=1.0.0-c
79
- TR_EMAIL=K6TestUser@sts-c
80
- TR_PASSWORD=K6TestUserPassword-c
81
- TR_PASSWORD_FILE=testpasswordfile
96
+ TR_CLIENT_ID=xyz
97
+ TR_CLIENT_ID_FILE=testclientidfile
98
+ TR_CLIENT_SECRET=xyz
99
+ TR_CLIENT_SECRET_FILE=testclientsecretfile
82
100
 
83
101
  PUBLISH_INTERVAL=10000
84
102
  PUBLISH_TIMEOUT=7500
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nsshunt/stsconfig",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "",
5
5
  "main": "stsconfig.js",
6
6
  "dependencies": {
@@ -45,7 +45,7 @@ describe("Test implicit config settings", () =>
45
45
 
46
46
  test('Checking default rest01 service config', async () =>
47
47
  {
48
- expect.assertions(11);
48
+ expect.assertions(14);
49
49
 
50
50
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
51
51
  let goptions = require('./stsconfig.js').$options;
@@ -58,14 +58,17 @@ describe("Test implicit config settings", () =>
58
58
  expect(goptions.rest01prometheusclusterport).toEqual('3013');
59
59
  expect(goptions.rest01servicename).toEqual('STSRest01');
60
60
  expect(goptions.rest01serviceversion).toEqual('1.0.0');
61
- expect(goptions.rest01email).toEqual('STSREST01ServiceUser@stsmda.com');
62
- expect(goptions.rest01password).toEqual('STSREST01ServiceUserPassword');
63
- expect(goptions.rest01passwordfile).toEqual(undefined);
61
+ expect(goptions.rest01apiidentifier).toEqual(undefined);
62
+ expect(goptions.rest01apiidentifierfile).toEqual(undefined);
63
+ expect(goptions.rest01clientid).toEqual(undefined);
64
+ expect(goptions.rest01clientidfile).toEqual(undefined);
65
+ expect(goptions.rest01clientsecret).toEqual(undefined);
66
+ expect(goptions.rest01clientsecretfile).toEqual(undefined);
64
67
  });
65
68
 
66
69
  test('Checking default instrument manager service config', async () =>
67
70
  {
68
- expect.assertions(11);
71
+ expect.assertions(14);
69
72
 
70
73
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
71
74
  let goptions = require('./stsconfig.js').$options;
@@ -78,14 +81,17 @@ describe("Test implicit config settings", () =>
78
81
  expect(goptions.imprometheusclusterport).toEqual('3011');
79
82
  expect(goptions.imservicename).toEqual('STSInstrumentManager');
80
83
  expect(goptions.imserviceversion).toEqual('1.0.0');
81
- expect(goptions.imemail).toEqual('STSInstrumentManagerServiceUser@stsmda.com');
82
- expect(goptions.impassword).toEqual('STSInstrumentManagerServiceUserPassword');
83
- expect(goptions.impasswordfile).toEqual(undefined);
84
+ expect(goptions.imapiidentifier).toEqual(undefined);
85
+ expect(goptions.imapiidentifierfile).toEqual(undefined);
86
+ expect(goptions.imclientid).toEqual(undefined);
87
+ expect(goptions.imclientidfile).toEqual(undefined);
88
+ expect(goptions.imclientsecret).toEqual(undefined);
89
+ expect(goptions.imclientsecretfile).toEqual(undefined);
84
90
  });
85
91
 
86
92
  test('Checking default test orchestrator service config', async () =>
87
93
  {
88
- expect.assertions(11);
94
+ expect.assertions(14);
89
95
 
90
96
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
91
97
  let goptions = require('./stsconfig.js').$options;
@@ -98,14 +104,17 @@ describe("Test implicit config settings", () =>
98
104
  expect(goptions.toprometheusclusterport).toEqual('3014');
99
105
  expect(goptions.toservicename).toEqual('STSTestOrchestrator');
100
106
  expect(goptions.toserviceversion).toEqual('1.0.0');
101
- expect(goptions.toemail).toEqual('STSTestOrchestratorServiceUser@stsmda.com');
102
- expect(goptions.topassword).toEqual('STSTestOrchestratorServiceUserPassword');
103
- expect(goptions.topasswordfile).toEqual(undefined);
107
+ expect(goptions.toapiidentifier).toEqual(undefined);
108
+ expect(goptions.toapiidentifierfile).toEqual(undefined);
109
+ expect(goptions.toclientid).toEqual(undefined);
110
+ expect(goptions.toclientidfile).toEqual(undefined);
111
+ expect(goptions.toclientsecret).toEqual(undefined);
112
+ expect(goptions.toclientsecretfile).toEqual(undefined);
104
113
  });
105
114
 
106
115
  test('Checking default authentication service config', async () =>
107
116
  {
108
- expect.assertions(13);
117
+ expect.assertions(21);
109
118
 
110
119
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
111
120
  let goptions = require('./stsconfig.js').$options;
@@ -118,16 +127,24 @@ describe("Test implicit config settings", () =>
118
127
  expect(goptions.asprometheusclusterport).toEqual('3012');
119
128
  expect(goptions.asservicename).toEqual('STSAuth');
120
129
  expect(goptions.asserviceversion).toEqual('1.0.0');
121
- expect(goptions.asemail).toEqual('STSAuthServiceUser@stsmda.com');
122
- expect(goptions.aspassword).toEqual('STSAuthServiceUserPassword');
123
- expect(goptions.aspasswordfile).toEqual(undefined);
124
130
  expect(goptions.asprivatekeypath).toEqual('/var/lib/sts/stsglobalresources/keys/private.key');
125
131
  expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key');
132
+ expect(goptions.asapiidentifier).toEqual(undefined);
133
+ expect(goptions.asapiidentifierfile).toEqual(undefined);
134
+ expect(goptions.asclientid).toEqual(undefined);
135
+ expect(goptions.asclientidfile).toEqual(undefined);
136
+ expect(goptions.asclientsecret).toEqual(undefined);
137
+ expect(goptions.asclientsecretfile).toEqual(undefined);
138
+ expect(goptions.asjwksjsonpath).toEqual('/.well-known/jwks.json');
139
+ expect(goptions.asjwkskeyrotationtime).toEqual(86400);
140
+ expect(goptions.asjwkskeypurgetimeoffset).toEqual(300);
141
+ expect(goptions.asjwkskeycount).toEqual(4);
142
+ expect(goptions.asaccesstokenexpire).toEqual(43200);
126
143
  });
127
144
 
128
145
  test('Checking default test runner service config', async () =>
129
146
  {
130
- expect.assertions(7);
147
+ expect.assertions(8);
131
148
 
132
149
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
133
150
  let goptions = require('./stsconfig.js').$options;
@@ -136,9 +153,10 @@ describe("Test implicit config settings", () =>
136
153
  expect(goptions.trprometheusclusterport).toEqual('3015');
137
154
  expect(goptions.trservicename).toEqual('STSRestRunner');
138
155
  expect(goptions.trserviceversion).toEqual('1.0.0');
139
- expect(goptions.tremail).toEqual('STSTestRunnerServiceUser@stsmda.com');
140
- expect(goptions.trpassword).toEqual('STSTestRunnerServiceUserPassword');
141
- expect(goptions.trpasswordfile).toEqual(undefined);
156
+ expect(goptions.trclientid).toEqual(undefined);
157
+ expect(goptions.trclientidfile).toEqual(undefined);
158
+ expect(goptions.trclientsecret).toEqual(undefined);
159
+ expect(goptions.trclientsecretfile).toEqual(undefined);
142
160
  });
143
161
 
144
162
  test('Checking default additional config items', async () =>
@@ -45,7 +45,7 @@ describe("Test configured settings", () =>
45
45
 
46
46
  test('Checking default rest01 service config', async () =>
47
47
  {
48
- expect.assertions(11);
48
+ expect.assertions(14);
49
49
 
50
50
  process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
51
51
  let goptions = require('./stsconfig.js').$options;
@@ -58,14 +58,17 @@ describe("Test configured settings", () =>
58
58
  expect(goptions.rest01prometheusclusterport).toEqual('30130');
59
59
  expect(goptions.rest01servicename).toEqual('STSRest01-c');
60
60
  expect(goptions.rest01serviceversion).toEqual('1.0.0-c');
61
- expect(goptions.rest01email).toEqual('K6TestUser@sts-c');
62
- expect(goptions.rest01password).toEqual('testfilepassword');
63
- expect(goptions.rest01passwordfile).toEqual('testpasswordfile');
61
+ expect(goptions.rest01apiidentifier).toEqual('testapiidentifierfilecontents');
62
+ expect(goptions.rest01apiidentifierfile).toEqual('testapiidentifierFile');
63
+ expect(goptions.rest01clientid).toEqual('testclientidfilecontents');
64
+ expect(goptions.rest01clientidfile).toEqual('testclientidfile'); // testclientidfile
65
+ expect(goptions.rest01clientsecret).toEqual('testclientsecretfilecontents');
66
+ expect(goptions.rest01clientsecretfile).toEqual('testclientsecretfile');
64
67
  });
65
68
 
66
69
  test('Checking default instrument manager service config', async () =>
67
70
  {
68
- expect.assertions(11);
71
+ expect.assertions(14);
69
72
 
70
73
  process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
71
74
  let goptions = require('./stsconfig.js').$options;
@@ -78,14 +81,17 @@ describe("Test configured settings", () =>
78
81
  expect(goptions.imprometheusclusterport).toEqual('30110');
79
82
  expect(goptions.imservicename).toEqual('STSInstrumentManager-c');
80
83
  expect(goptions.imserviceversion).toEqual('1.0.0-c');
81
- expect(goptions.imemail).toEqual('K6TestUser@sts-c');
82
- expect(goptions.impassword).toEqual('testfilepassword');
83
- expect(goptions.impasswordfile).toEqual('testpasswordfile');
84
+ expect(goptions.imapiidentifier).toEqual('testapiidentifierfilecontents');
85
+ expect(goptions.imapiidentifierfile).toEqual('testapiidentifierFile');
86
+ expect(goptions.imclientid).toEqual('testclientidfilecontents');
87
+ expect(goptions.imclientidfile).toEqual('testclientidfile'); // testclientidfile
88
+ expect(goptions.imclientsecret).toEqual('testclientsecretfilecontents');
89
+ expect(goptions.imclientsecretfile).toEqual('testclientsecretfile');
84
90
  });
85
91
 
86
92
  test('Checking default test orchestrator service config', async () =>
87
93
  {
88
- expect.assertions(11);
94
+ expect.assertions(14);
89
95
 
90
96
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
91
97
  let goptions = require('./stsconfig.js').$options;
@@ -98,14 +104,17 @@ describe("Test configured settings", () =>
98
104
  expect(goptions.toprometheusclusterport).toEqual('30140');
99
105
  expect(goptions.toservicename).toEqual('STSTestOrchestrator-c');
100
106
  expect(goptions.toserviceversion).toEqual('1.0.0-c');
101
- expect(goptions.toemail).toEqual('K6TestUser@sts-c');
102
- expect(goptions.topassword).toEqual('testfilepassword');
103
- expect(goptions.topasswordfile).toEqual('testpasswordfile');
107
+ expect(goptions.toapiidentifier).toEqual('testapiidentifierfilecontents');
108
+ expect(goptions.toapiidentifierfile).toEqual('testapiidentifierFile');
109
+ expect(goptions.toclientid).toEqual('testclientidfilecontents');
110
+ expect(goptions.toclientidfile).toEqual('testclientidfile'); // testclientidfile
111
+ expect(goptions.toclientsecret).toEqual('testclientsecretfilecontents');
112
+ expect(goptions.toclientsecretfile).toEqual('testclientsecretfile');
104
113
  });
105
114
 
106
115
  test('Checking default authentication service config', async () =>
107
116
  {
108
- expect.assertions(13);
117
+ expect.assertions(21);
109
118
 
110
119
  process.env.STSENVFILE = './.env-test-file-2'; // Empty environment file
111
120
  let goptions = require('./stsconfig.js').$options;
@@ -118,16 +127,24 @@ describe("Test configured settings", () =>
118
127
  expect(goptions.asprometheusclusterport).toEqual('30120');
119
128
  expect(goptions.asservicename).toEqual('STSAuth-c');
120
129
  expect(goptions.asserviceversion).toEqual('1.0.0-c');
121
- expect(goptions.asemail).toEqual('K6TestUser@sts-c');
122
- expect(goptions.aspassword).toEqual('testfilepassword');
123
- expect(goptions.aspasswordfile).toEqual('testpasswordfile');
124
130
  expect(goptions.asprivatekeypath).toEqual('/var/lib/sts/stsglobalresources/keys/private.key-c');
125
131
  expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key-c');
132
+ expect(goptions.asapiidentifier).toEqual('testapiidentifierfilecontents');
133
+ expect(goptions.asapiidentifierfile).toEqual('testapiidentifierFile');
134
+ expect(goptions.asclientid).toEqual('testclientidfilecontents');
135
+ expect(goptions.asclientidfile).toEqual('testclientidfile'); // testclientidfile
136
+ expect(goptions.asclientsecret).toEqual('testclientsecretfilecontents');
137
+ expect(goptions.asclientsecretfile).toEqual('testclientsecretfile');
138
+ expect(goptions.asjwksjsonpath).toEqual('/.well-known/jwks.json-c');
139
+ expect(goptions.asjwkskeyrotationtime).toEqual(864000);
140
+ expect(goptions.asjwkskeypurgetimeoffset).toEqual(3000);
141
+ expect(goptions.asjwkskeycount).toEqual(40);
142
+ expect(goptions.asaccesstokenexpire).toEqual(432000);
126
143
  });
127
144
 
128
145
  test('Checking default test runner service config', async () =>
129
146
  {
130
- expect.assertions(7);
147
+ expect.assertions(8);
131
148
 
132
149
  process.env.STSENVFILE = './.env-test-file-1'; // Empty environment file
133
150
  let goptions = require('./stsconfig.js').$options;
@@ -136,9 +153,10 @@ describe("Test configured settings", () =>
136
153
  expect(goptions.trprometheusclusterport).toEqual('30150');
137
154
  expect(goptions.trservicename).toEqual('STSRestRunner-c');
138
155
  expect(goptions.trserviceversion).toEqual('1.0.0-c');
139
- expect(goptions.tremail).toEqual('K6TestUser@sts-c');
140
- expect(goptions.trpassword).toEqual('testfilepassword');
141
- expect(goptions.trpasswordfile).toEqual('testpasswordfile');
156
+ expect(goptions.trclientid).toEqual('testclientidfilecontents');
157
+ expect(goptions.trclientidfile).toEqual('testclientidfile'); // testclientidfile
158
+ expect(goptions.trclientsecret).toEqual('testclientsecretfilecontents');
159
+ expect(goptions.trclientsecretfile).toEqual('testclientsecretfile');
142
160
  });
143
161
 
144
162
  test('Checking default additional config items', async () =>
@@ -45,7 +45,7 @@ describe("Test explicit default config settings", () =>
45
45
 
46
46
  test('Checking default rest01 service config', async () =>
47
47
  {
48
- expect.assertions(11);
48
+ expect.assertions(14);
49
49
 
50
50
  process.env.STSENVFILE = './.env-default'; // Empty environment file
51
51
  let goptions = require('./stsconfig.js').$options;
@@ -58,14 +58,17 @@ describe("Test explicit default config settings", () =>
58
58
  expect(goptions.rest01prometheusclusterport).toEqual('3013');
59
59
  expect(goptions.rest01servicename).toEqual('STSRest01');
60
60
  expect(goptions.rest01serviceversion).toEqual('1.0.0');
61
- expect(goptions.rest01email).toEqual('STSREST01ServiceUser@stsmda.com');
62
- expect(goptions.rest01password).toEqual('STSREST01ServiceUserPassword');
63
- expect(goptions.rest01passwordfile).toEqual(undefined);
61
+ expect(goptions.rest01apiidentifier).toEqual(undefined);
62
+ expect(goptions.rest01apiidentifierfile).toEqual(undefined);
63
+ expect(goptions.rest01clientid).toEqual(undefined);
64
+ expect(goptions.rest01clientidfile).toEqual(undefined);
65
+ expect(goptions.rest01clientsecret).toEqual(undefined);
66
+ expect(goptions.rest01clientsecretfile).toEqual(undefined);
64
67
  });
65
68
 
66
69
  test('Checking default instrument manager service config', async () =>
67
70
  {
68
- expect.assertions(11);
71
+ expect.assertions(14);
69
72
 
70
73
  process.env.STSENVFILE = './.env-default'; // Empty environment file
71
74
  let goptions = require('./stsconfig.js').$options;
@@ -78,14 +81,17 @@ describe("Test explicit default config settings", () =>
78
81
  expect(goptions.imprometheusclusterport).toEqual('3011');
79
82
  expect(goptions.imservicename).toEqual('STSInstrumentManager');
80
83
  expect(goptions.imserviceversion).toEqual('1.0.0');
81
- expect(goptions.imemail).toEqual('STSInstrumentManagerServiceUser@stsmda.com');
82
- expect(goptions.impassword).toEqual('STSInstrumentManagerServiceUserPassword');
83
- expect(goptions.impasswordfile).toEqual(undefined);
84
+ expect(goptions.imapiidentifier).toEqual(undefined);
85
+ expect(goptions.imapiidentifierfile).toEqual(undefined);
86
+ expect(goptions.imclientid).toEqual(undefined);
87
+ expect(goptions.imclientidfile).toEqual(undefined);
88
+ expect(goptions.imclientsecret).toEqual(undefined);
89
+ expect(goptions.imclientsecretfile).toEqual(undefined);
84
90
  });
85
91
 
86
92
  test('Checking default test orchestrator service config', async () =>
87
93
  {
88
- expect.assertions(11);
94
+ expect.assertions(14);
89
95
 
90
96
  process.env.STSENVFILE = './.env-default'; // Empty environment file
91
97
  let goptions = require('./stsconfig.js').$options;
@@ -98,14 +104,17 @@ describe("Test explicit default config settings", () =>
98
104
  expect(goptions.toprometheusclusterport).toEqual('3014');
99
105
  expect(goptions.toservicename).toEqual('STSTestOrchestrator');
100
106
  expect(goptions.toserviceversion).toEqual('1.0.0');
101
- expect(goptions.toemail).toEqual('STSTestOrchestratorServiceUser@stsmda.com');
102
- expect(goptions.topassword).toEqual('STSTestOrchestratorServiceUserPassword');
103
- expect(goptions.topasswordfile).toEqual(undefined);
107
+ expect(goptions.toapiidentifier).toEqual(undefined);
108
+ expect(goptions.toapiidentifierfile).toEqual(undefined);
109
+ expect(goptions.toclientid).toEqual(undefined);
110
+ expect(goptions.toclientidfile).toEqual(undefined);
111
+ expect(goptions.toclientsecret).toEqual(undefined);
112
+ expect(goptions.toclientsecretfile).toEqual(undefined);
104
113
  });
105
114
 
106
115
  test('Checking default authentication service config', async () =>
107
116
  {
108
- expect.assertions(13);
117
+ expect.assertions(21);
109
118
 
110
119
  process.env.STSENVFILE = './.env-default'; // Empty environment file
111
120
  let goptions = require('./stsconfig.js').$options;
@@ -118,16 +127,24 @@ describe("Test explicit default config settings", () =>
118
127
  expect(goptions.asprometheusclusterport).toEqual('3012');
119
128
  expect(goptions.asservicename).toEqual('STSAuth');
120
129
  expect(goptions.asserviceversion).toEqual('1.0.0');
121
- expect(goptions.asemail).toEqual('STSAuthServiceUser@stsmda.com');
122
- expect(goptions.aspassword).toEqual('STSAuthServiceUserPassword');
123
- expect(goptions.aspasswordfile).toEqual(undefined);
124
130
  expect(goptions.asprivatekeypath).toEqual('/var/lib/sts/stsglobalresources/keys/private.key');
125
131
  expect(goptions.aspublickeypath).toEqual('/var/lib/sts/stsglobalresources/keys/public.key');
132
+ expect(goptions.asapiidentifier).toEqual(undefined);
133
+ expect(goptions.asapiidentifierfile).toEqual(undefined);
134
+ expect(goptions.asclientid).toEqual(undefined);
135
+ expect(goptions.asclientidfile).toEqual(undefined);
136
+ expect(goptions.asclientsecret).toEqual(undefined);
137
+ expect(goptions.asclientsecretfile).toEqual(undefined);
138
+ expect(goptions.asjwksjsonpath).toEqual('/.well-known/jwks.json');
139
+ expect(goptions.asjwkskeyrotationtime).toEqual(86400);
140
+ expect(goptions.asjwkskeypurgetimeoffset).toEqual(300);
141
+ expect(goptions.asjwkskeycount).toEqual(4);
142
+ expect(goptions.asaccesstokenexpire).toEqual(43200);
126
143
  });
127
144
 
128
145
  test('Checking default test runner service config', async () =>
129
146
  {
130
- expect.assertions(7);
147
+ expect.assertions(8);
131
148
 
132
149
  process.env.STSENVFILE = './.env-default'; // Empty environment file
133
150
  let goptions = require('./stsconfig.js').$options;
@@ -136,9 +153,10 @@ describe("Test explicit default config settings", () =>
136
153
  expect(goptions.trprometheusclusterport).toEqual('3015');
137
154
  expect(goptions.trservicename).toEqual('STSRestRunner');
138
155
  expect(goptions.trserviceversion).toEqual('1.0.0');
139
- expect(goptions.tremail).toEqual('STSTestRunnerServiceUser@stsmda.com');
140
- expect(goptions.trpassword).toEqual('STSTestRunnerServiceUserPassword');
141
- expect(goptions.trpasswordfile).toEqual(undefined);
156
+ expect(goptions.trclientid).toEqual(undefined);
157
+ expect(goptions.trclientidfile).toEqual(undefined);
158
+ expect(goptions.trclientsecret).toEqual(undefined);
159
+ expect(goptions.trclientsecretfile).toEqual(undefined);
142
160
  });
143
161
 
144
162
  test('Checking default additional config items', async () =>
package/stsconfig.js CHANGED
@@ -76,8 +76,6 @@ const defconfig =
76
76
  ,rest01apiidentifier: process.env.REST01_API_IDENTIFIER
77
77
  // STSREST01 API Identifier file. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
78
78
  ,rest01apiidentifierfile: process.env.REST01_API_IDENTIFIER_FILE
79
- // STSREST01 API Permissions file. These are all the permissions (scopes) that this API uses. Format is JSON.
80
- ,rest01apipermissionsfile: process.env.REST01_API_PERMISSIONS_FILE
81
79
  // STSREST01 Prometheus metric support
82
80
  ,rest01prometheussupport: (process.env.REST01_PROM_SUPPORT === undefined ? true : (process.env.REST01_PROM_SUPPORT === "true" ? true : false))
83
81
  // STSREST01 Cluster Server port (port used for cluster prometheus scrapes). Service will listen on this port at mount point /metrics
@@ -86,22 +84,16 @@ const defconfig =
86
84
  ,rest01servicename: (process.env.REST01_SERVICE_NAME === undefined ? "STSRest01" : process.env.REST01_SERVICE_NAME)
87
85
  // STSREST01 Service Version
88
86
  ,rest01serviceversion: (process.env.REST01_SERVICE_VERSION === undefined ? "1.0.0" : process.env.REST01_SERVICE_VERSION)
89
- // STSREST01 Service Credentials
90
- // -----------------------------
91
- // STSREST01 Server username email
92
- ,rest01email: (process.env.REST01_EMAIL === undefined ? "STSREST01ServiceUser@stsmda.com" : process.env.REST01_EMAIL)
93
- // STSREST01 Server username password
94
- ,rest01password: (process.env.REST01_PASSWORD === undefined ? "STSREST01ServiceUserPassword" : process.env.REST01_PASSWORD)
95
- // STSREST01 Server username password file
96
- ,rest01passwordfile: process.env.REST01_PASSWORD_FILE
97
87
  // STSREST01 Server client ID. Used for oauth2 client credentials flow.
98
88
  // Ref: https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow
99
89
  // Ref: https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-the-client-credentials-flow
100
90
  ,rest01clientid: process.env.REST01_CLIENT_ID
101
91
  // STSREST01 Server client ID file. Used for oauth2 client credentials flow.
102
92
  ,rest01clientidfile: process.env.REST01_CLIENT_ID_FILE
93
+ // STSREST01 Server client secret. Used for oauth2 client credentials flow.
94
+ ,rest01clientsecret: process.env.REST01_CLIENT_SECRET
103
95
  // STSREST01 Server client secret file. Used for oauth2 client credentials flow.
104
- ,rest01clientsecretfile: process.env.REST01_CLIENT_SECRET_PASSWORD_FILE
96
+ ,rest01clientsecretfile: process.env.REST01_CLIENT_SECRET_FILE
105
97
 
106
98
  // STS Instrument Manager Service endpoint
107
99
  ,imendpoint: (process.env.IM_ENDPOINT === undefined ? "http://localhost" : process.env.IM_ENDPOINT)
@@ -111,6 +103,10 @@ const defconfig =
111
103
  ,import: (process.env.IM_PORT === undefined ? "3001" : process.env.IM_PORT)
112
104
  // STS Instrument Manager Service endpoint
113
105
  ,imapiroot: (process.env.IM_APIROOT === undefined ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT)
106
+ // Instrument Manager API Identifier. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
107
+ ,imapiidentifier: process.env.IM_API_IDENTIFIER
108
+ // Instrument Manager API Identifier file. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
109
+ ,imapiidentifierfile: process.env.IM_API_IDENTIFIER_FILE
114
110
  // STS Instrument Manager Prometheus metric support
115
111
  ,imprometheussupport: (process.env.IM_PROM_SUPPORT === undefined ? true : (process.env.IM_PROM_SUPPORT === "true" ? true : false ))
116
112
  // STS Instrument Manager Cluster Server port (port used for cluster prometheus scrapes)
@@ -119,14 +115,14 @@ const defconfig =
119
115
  ,imservicename: (process.env.IM_SERVICE_NAME === undefined ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME)
120
116
  // STS Instrument Manager Service Version
121
117
  ,imserviceversion: (process.env.IM_SERVICE_VERSION === undefined ? "1.0.0" : process.env.IM_SERVICE_VERSION)
122
- // STS Instrument Manager Service Credentials
123
- // ------------------------------------------
124
- // STS Instrument Manager Service username email
125
- ,imemail: (process.env.IM_EMAIL === undefined ? "STSInstrumentManagerServiceUser@stsmda.com" : process.env.IM_EMAIL)
126
- // STS Instrument Manager Service username password
127
- ,impassword: (process.env.IM_PASSWORD === undefined ? "STSInstrumentManagerServiceUserPassword" : process.env.IM_PASSWORD)
128
- // STS Instrument Manager Service username password file
129
- ,impasswordfile: process.env.IM_PASSWORD_FILE
118
+ // STS Instrument Manager Server client ID. Used for oauth2 client credentials flow.
119
+ ,imclientid: process.env.IM_CLIENT_ID
120
+ // STS Instrument Manager Server client ID file. Used for oauth2 client credentials flow.
121
+ ,imclientidfile: process.env.IM_CLIENT_ID_FILE
122
+ // STS Instrument Manager Server client secret. Used for oauth2 client credentials flow.
123
+ ,imclientsecret: process.env.IM_CLIENT_SECRET
124
+ // STS Instrument Manager Server client secret file. Used for oauth2 client credentials flow.
125
+ ,imclientsecretfile: process.env.IM_CLIENT_SECRET_FILE
130
126
 
131
127
  // STS Test Orchestrator Service endpoint
132
128
  ,toendpoint: (process.env.TO_ENDPOINT === undefined ? "http://localhost" : process.env.TO_ENDPOINT)
@@ -136,6 +132,10 @@ const defconfig =
136
132
  ,toport: (process.env.TO_PORT === undefined ? "3004" : process.env.TO_PORT)
137
133
  // STS Test Orchestrator Service endpoint
138
134
  ,toapiroot: (process.env.TO_APIROOT === undefined ? "/ststestorchestrator/v1" : process.env.TO_APIROOT)
135
+ // Test Orchestrator API Identifier. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
136
+ ,toapiidentifier: process.env.TO_API_IDENTIFIER
137
+ // Test Orchestrator API Identifier file. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
138
+ ,toapiidentifierfile: process.env.TO_API_IDENTIFIER_FILE
139
139
  // STS Test Orchestrator Prometheus metric support
140
140
  ,toprometheussupport: (process.env.TO_PROM_SUPPORT === undefined ? true : (process.env.TO_PROM_SUPPORT === "true" ? true : false ))
141
141
  // STS Test Orchestrator Cluster Server port (port used for cluster prometheus scrapes)
@@ -144,14 +144,14 @@ const defconfig =
144
144
  ,toservicename: (process.env.TO_SERVICE_NAME === undefined ? "STSTestOrchestrator" : process.env.TO_SERVICE_NAME)
145
145
  // STS Test Orchestrator Service Version
146
146
  ,toserviceversion: (process.env.TO_SERVICE_VERSION === undefined ? "1.0.0" : process.env.TO_SERVICE_VERSION)
147
- // STS Test Orchestrator Service Credentials
148
- // ------------------------------------------
149
- // STS Test Orchestrator Service username email
150
- ,toemail: (process.env.TO_EMAIL === undefined ? "STSTestOrchestratorServiceUser@stsmda.com" : process.env.TO_EMAIL)
151
- // STS Test Orchestrator Service username password
152
- ,topassword: (process.env.TO_PASSWORD === undefined ? "STSTestOrchestratorServiceUserPassword" : process.env.TO_PASSWORD)
153
- // STS Test Orchestrator Service username password file
154
- ,topasswordfile: process.env.TO_PASSWORD_FILE
147
+ // STS Test Orchestrator Server client ID. Used for oauth2 client credentials flow.
148
+ ,toclientid: process.env.TO_CLIENT_ID
149
+ // STS Test Orchestrator Server client ID file. Used for oauth2 client credentials flow.
150
+ ,toclientidfile: process.env.TO_CLIENT_ID_FILE
151
+ // STS Test Orchestrator Server client secret. Used for oauth2 client credentials flow.
152
+ ,toclientsecret: process.env.TO_CLIENT_SECRET
153
+ // STS Test Orchestrator Server client secret file. Used for oauth2 client credentials flow.
154
+ ,toclientsecretfile: process.env.TO_CLIENT_SECRET_FILE
155
155
 
156
156
  // STS Auth Server
157
157
  // ---------------
@@ -165,6 +165,10 @@ const defconfig =
165
165
  ,asport: (process.env.AS_PORT === undefined ? "3002" : process.env.AS_PORT)
166
166
  // Auth Server endpoint
167
167
  ,asapiroot: (process.env.AS_APIROOT === undefined ? "/stsauth/v1" : process.env.AS_APIROOT)
168
+ // Auth Server API Identifier. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
169
+ ,asapiidentifier: process.env.AS_API_IDENTIFIER
170
+ // Auth Server API Identifier file. This value will be used as the audience parameter on authorization calls (OAuth2 client credentials flow).
171
+ ,asapiidentifierfile: process.env.AS_API_IDENTIFIER_FILE
168
172
  // Auth Server Prometheus metric support
169
173
  ,asprometheussupport: (process.env.AS_PROM_SUPPORT === undefined ? true : (process.env.AS_PROM_SUPPORT === "true" ? true : false ))
170
174
  // Auth Prometheus Cluster Server port (port used for cluster prometheus scrapes)
@@ -173,40 +177,27 @@ const defconfig =
173
177
  ,asservicename: (process.env.AS_SERVICE_NAME === undefined ? "STSAuth" : process.env.AS_SERVICE_NAME)
174
178
  // STSAuth Service Version
175
179
  ,asserviceversion: (process.env.AS_SERVICE_VERSION === undefined ? "1.0.0" : process.env.AS_SERVICE_VERSION)
176
- // STS Auth Service Credentials
177
- // ----------------------------
178
- // Auth Server username email
179
- ,asemail: (process.env.AS_EMAIL === undefined ? "STSAuthServiceUser@stsmda.com" : process.env.AS_EMAIL)
180
- // Auth Server username password
181
- ,aspassword: (process.env.AS_PASSWORD === undefined ? "STSAuthServiceUserPassword" : process.env.AS_PASSWORD)
182
- // Auth Server username password file
183
- ,aspasswordfile: process.env.AS_PASSWORD_FILE
184
-
185
- // Auth Server client ID. Used for oauth2 client credentials flow.
186
- // Ref: https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow
187
- // Ref: https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-the-client-credentials-flow
180
+ // STS Auth Server client ID. Used for oauth2 client credentials flow.
188
181
  ,asclientid: process.env.AS_CLIENT_ID
189
- // Auth Server client ID file. Used for oauth2 client credentials flow.
182
+ // STS Auth Server client ID file. Used for oauth2 client credentials flow.
190
183
  ,asclientidfile: process.env.AS_CLIENT_ID_FILE
191
- // Auth Server client secret file. Used for oauth2 client credentials flow.
192
- ,asclientsecretfile: process.env.AS_CLIENT_SECRET_PASSWORD_FILE
193
-
184
+ // STS Auth Server client secret. Used for oauth2 client credentials flow.
185
+ ,asclientsecret: process.env.AS_CLIENT_SECRET
186
+ // STS Auth Server client secret file. Used for oauth2 client credentials flow.
187
+ ,asclientsecretfile: process.env.AS_CLIENT_SECRET_FILE
194
188
  // Auth Server - JWKS Public End Point.
195
189
  ,asjwksjsonpath: (process.env.AS_JWKS_JSON_PATH === undefined ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH)
196
- // Auth Server - JWKS File Store. Auth server side private JWKS storage file.
197
- ,asjwksfilestore: (process.env.AS_JWKS_FILE_STORE === undefined ? "/run/secrets/jwks_store" : process.env.AS_JWKS_FILE_STORE)
198
190
  // Auth Server - JWKS key rotation time (seconds).
199
- ,asjwkskeyrotationtime: (process.env.AS_JWKS_KEY_ROTATION_TIME === undefined ? 86400 : process.env.AS_JWKS_KEY_ROTATION_TIME) // 24 Hour default
191
+ ,asjwkskeyrotationtime: (process.env.AS_JWKS_KEY_ROTATION_TIME === undefined ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME)) // 24 Hour default
200
192
  // Auth Server - JWKS key purge time offset (seconds). Old keys (current keys are considered 'old' immediately after a key rotation) will be kept
201
193
  // for asaccesstokenexpire + asjwkskeypurgetimeoffset seconds before purging from the JWKS.
202
- ,asjwkskeypurgetimeoffset: (process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === undefined ? 300 : process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET) // 5 Minutes
194
+ ,asjwkskeypurgetimeoffset: (process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === undefined ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET)) // 5 Minutes
203
195
  // Auth Server - JWKS key count. Defines the number of active keys within the JWKS. Note that the actual key count may be double this value as current
204
196
  // keys are rotated to old keys prior to old key purge. Old keys will be kept for asaccesstokenexpire + asjwkskeypurgetimeoffset seconds before removal from the JWKS.
205
197
  // This is to ensure that any tokens signed by a current key that is then expired can still be validated within the life of the issued token.
206
- ,asjwkskeycount: (process.env.AS_JWKS_KEY_COUNT === undefined ? 4 : process.env.AS_JWKS_KEY_COUNT)
198
+ ,asjwkskeycount: (process.env.AS_JWKS_KEY_COUNT === undefined ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT))
207
199
  // Auth Server - JWKS Access token timeout.
208
- ,asaccesstokenexpire: (process.env.AS_ACCESS_TOKEN_EXPIRE === undefined ? 43200 : process.env.AS_ACCESS_TOKEN_EXPIRE) // 12 Hour default
209
-
200
+ ,asaccesstokenexpire: (process.env.AS_ACCESS_TOKEN_EXPIRE === undefined ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE)) // 12 Hour default
210
201
  // Auth Server - [DEPRECATED] Private Key (when using JWT)
211
202
  ,asprivatekeypath: (process.env.AS_PRIVATE_KEY_PATH === undefined ? "/var/lib/sts/stsglobalresources/keys/private.key" : process.env.AS_PRIVATE_KEY_PATH)
212
203
  // Auth Server - [DEPRECATED] Public Key (when using JWT)
@@ -220,14 +211,14 @@ const defconfig =
220
211
  ,trservicename: (process.env.TR_SERVICE_NAME === undefined ? "STSRestRunner" : process.env.TR_SERVICE_NAME)
221
212
  // STS Test Runner Service Version
222
213
  ,trserviceversion: (process.env.TR_SERVICE_VERSION === undefined ? "1.0.0" : process.env.TR_SERVICE_VERSION)
223
- // STS Test Runner Credentials
224
- // ----------------------------
225
- // STS Test Runner username email
226
- ,tremail: (process.env.TR_EMAIL === undefined ? "STSTestRunnerServiceUser@stsmda.com" : process.env.TR_EMAIL)
227
- // STS Test Runner password
228
- ,trpassword: (process.env.TR_PASSWORD === undefined ? "STSTestRunnerServiceUserPassword" : process.env.TR_PASSWORD)
229
- // STS Test Runner password file
230
- ,trpasswordfile: process.env.TR_PASSWORD_FILE
214
+ // STS Test Runner Server client ID. Used for oauth2 client credentials flow.
215
+ ,trclientid: process.env.TR_CLIENT_ID
216
+ // STS Test Runner Server client ID file. Used for oauth2 client credentials flow.
217
+ ,trclientidfile: process.env.TR_CLIENT_ID_FILE
218
+ // STS Test Runner Server client secret. Used for oauth2 client credentials flow.
219
+ ,trclientsecret: process.env.TR_CLIENT_SECRET
220
+ // STS Test Runner Server client secret file. Used for oauth2 client credentials flow.
221
+ ,trclientsecretfile: process.env.TR_CLIENT_SECRET_FILE
231
222
 
232
223
  // Duration (in ms) between each publish event.
233
224
  ,publishinterval: (process.env.PUBLISH_INTERVAL === undefined ? 1000 : parseInt(process.env.PUBLISH_INTERVAL))
@@ -334,7 +325,7 @@ const defconfig =
334
325
  */
335
326
  }
336
327
 
337
- const ReadPasswordFile = (passwordFile) => {
328
+ const ReadFile = (passwordFile) => {
338
329
  try {
339
330
  accessSync(passwordFile, constants.R_OK);
340
331
  const data = readFileSync(passwordFile, 'utf8');
@@ -347,36 +338,32 @@ const ReadPasswordFile = (passwordFile) => {
347
338
  }
348
339
 
349
340
  // File based configuration settings. If a file is specified for a setting, this will be used. The non file version (if specified) will be ignored.
350
-
351
- // Database password file
352
- if (defconfig.dbpasswordfile !== undefined) {
353
- defconfig.dbpassword = ReadPasswordFile(defconfig.dbpasswordfile);
354
- }
355
-
356
- // Auth Server username password file
357
- if (defconfig.aspasswordfile !== undefined) {
358
- defconfig.aspassword = ReadPasswordFile(defconfig.aspasswordfile);
359
- }
360
-
361
- // STSREST01 Server username password file
362
- if (defconfig.rest01passwordfile !== undefined) {
363
- defconfig.rest01password = ReadPasswordFile(defconfig.rest01passwordfile);
364
- }
365
-
366
- // STS Test Runner password file
367
- if (defconfig.trpasswordfile !== undefined) {
368
- defconfig.trpassword = ReadPasswordFile(defconfig.trpasswordfile);
369
- }
370
-
371
- // STS Test Orchestrator Service username password file
372
- if (defconfig.topasswordfile !== undefined) {
373
- defconfig.topassword = ReadPasswordFile(defconfig.topasswordfile);
374
- }
375
-
376
- // STS Instrument Manager Service username password file
377
- if (defconfig.impasswordfile !== undefined) {
378
- defconfig.impassword = ReadPasswordFile(defconfig.impasswordfile);
379
- }
341
+ const fileconfig = [
342
+ { fileprop: 'dbpasswordfile', prop: 'dbpassword' },
343
+ // API identifier file processing
344
+ { fileprop: 'asapiidentifierfile', prop: 'asapiidentifier' },
345
+ { fileprop: 'rest01apiidentifierfile', prop: 'rest01apiidentifier' },
346
+ { fileprop: 'toapiidentifierfile', prop: 'toapiidentifier' },
347
+ { fileprop: 'imapiidentifierfile', prop: 'imapiidentifier' },
348
+ // Client ID file processing
349
+ { fileprop: 'asclientidfile', prop: 'asclientid' },
350
+ { fileprop: 'rest01clientidfile', prop: 'rest01clientid' },
351
+ { fileprop: 'toclientidfile', prop: 'toclientid' },
352
+ { fileprop: 'imclientidfile', prop: 'imclientid' },
353
+ { fileprop: 'trclientidfile', prop: 'trclientid' },
354
+ // Client secret file processing
355
+ { fileprop: 'asclientsecretfile', prop: 'asclientsecret' },
356
+ { fileprop: 'rest01clientsecretfile', prop: 'rest01clientsecret' },
357
+ { fileprop: 'toclientsecretfile', prop: 'toclientsecret' },
358
+ { fileprop: 'imclientsecretfile', prop: 'imclientsecret' },
359
+ { fileprop: 'trclientsecretfile', prop: 'trclientsecret' },
360
+ ]
361
+
362
+ fileconfig.forEach((v) => {
363
+ if (defconfig[v.fileprop] !== undefined) {
364
+ defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
365
+ }
366
+ });
380
367
 
381
368
  // Preference order is YAML file then .env file
382
369
  const $options = {
@@ -0,0 +1 @@
1
+ testapiidentifierfilecontents
@@ -0,0 +1 @@
1
+ testclientidfilecontents
@@ -0,0 +1 @@
1
+ testclientsecretfilecontents