@docupace/pipeline 1.0.20 → 1.0.22
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/package.json +1 -1
- package/src/auth0/cli.js +3 -3
- package/src/auth0/configure.js +26 -12
package/package.json
CHANGED
package/src/auth0/cli.js
CHANGED
|
@@ -18,10 +18,10 @@ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
|
|
|
18
18
|
const program = new Command();
|
|
19
19
|
|
|
20
20
|
program
|
|
21
|
-
.command('configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain>')
|
|
21
|
+
.command('configureFromSite <fromSite> <toSite> <fromEnv> <toEnv> <deployUI> <deployGraphQLServer> <useNewDomain> <configureMFA>')
|
|
22
22
|
.description('Configure the Auth0 tenants in env for the given site')
|
|
23
|
-
.action(async (fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain) => {
|
|
24
|
-
await configureFromSite(fromSite, toSite, fromEnv, toEnv, deployUI, deployGraphQLServer, useNewDomain);
|
|
23
|
+
.action(async (fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA) => {
|
|
24
|
+
await configureFromSite(fromSite, toSite, fromEnv, toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
program
|
package/src/auth0/configure.js
CHANGED
|
@@ -3,6 +3,8 @@ import path from 'path';
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import crypto from 'crypto';
|
|
5
5
|
import { deploy } from 'auth0-deploy-cli';
|
|
6
|
+
import { exec } from 'child_process';
|
|
7
|
+
import { promisify } from 'node:util';
|
|
6
8
|
|
|
7
9
|
import {
|
|
8
10
|
cloneEnvRepository,
|
|
@@ -154,7 +156,7 @@ async function replaceInFile(filePath, replacements) {
|
|
|
154
156
|
await fs.promises.writeFile(filePath, content, 'utf8');
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI, deployGraphQLServer, commonSecrets) {
|
|
159
|
+
async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI, deployGraphQLServer, commonSecrets, configureMFA) {
|
|
158
160
|
try {
|
|
159
161
|
let uiAllowedCallbacksUrls,
|
|
160
162
|
uiAllowedLogoutUrls;
|
|
@@ -163,6 +165,9 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
163
165
|
let connectAllowedCallbacksUrls,
|
|
164
166
|
connectlAllowedLogoutUrls;
|
|
165
167
|
|
|
168
|
+
let connectClientMetadata,
|
|
169
|
+
connectCallbacks,
|
|
170
|
+
connectAddons;
|
|
166
171
|
// Configure URLs based on environment
|
|
167
172
|
if (env === 'prd') {
|
|
168
173
|
uiAllowedCallbacksUrls = [`${siteUrl}/api/auth/callback`];
|
|
@@ -209,7 +214,7 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
209
214
|
connectCallbacks = [
|
|
210
215
|
`${siteUrl}/connect/samlCallback?client_name=auth0`
|
|
211
216
|
];
|
|
212
|
-
|
|
217
|
+
|
|
213
218
|
connectAddons = {
|
|
214
219
|
"samlp": {
|
|
215
220
|
"audience": `${siteUrl}/connect`,
|
|
@@ -239,7 +244,7 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
239
244
|
allowed_logout_urls: uiAllowedLogoutUrls,
|
|
240
245
|
});
|
|
241
246
|
|
|
242
|
-
|
|
247
|
+
|
|
243
248
|
//TODO: move to separate function for connect
|
|
244
249
|
console.log('connect_allowed_callbacks_urls ->', connectAllowedCallbacksUrls);
|
|
245
250
|
console.log('connect_allowed_logout_urls ->', connectlAllowedLogoutUrls);
|
|
@@ -298,13 +303,22 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
298
303
|
]);
|
|
299
304
|
|
|
300
305
|
// MFA configuration
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
306
|
+
const execAsync = promisify(exec);
|
|
307
|
+
try {
|
|
308
|
+
console.log('Template configuration started...');
|
|
309
|
+
if (configureMFA === 'ENABLED') {
|
|
310
|
+
console.log('AUTH0 MFA is enabled');
|
|
311
|
+
await execAsync('rsync -av auth0-site-setup/templateMFA/ auth0-site-setup/template/');
|
|
312
|
+
} else {
|
|
313
|
+
console.log('AUTH0 MFA is disabled');
|
|
314
|
+
await execAsync('rsync -av auth0-site-setup/templateNoMFA/ auth0-site-setup/template/');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
console.log('Template configuration completed.');
|
|
318
|
+
} catch (err) {
|
|
319
|
+
console.error('Error configuring Auth0 templates:', err);
|
|
320
|
+
throw err;
|
|
321
|
+
}
|
|
308
322
|
|
|
309
323
|
console.log('Template configuration completed.');
|
|
310
324
|
} catch (err) {
|
|
@@ -573,7 +587,7 @@ ingress:
|
|
|
573
587
|
}
|
|
574
588
|
|
|
575
589
|
|
|
576
|
-
export async function configureFromSite(fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain) {
|
|
590
|
+
export async function configureFromSite(fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA) {
|
|
577
591
|
console.log(`Configuring Auth0 tenants and ArgoCD apps for site: ${toSite} in env: ${toEnv} from site: ${fromSite}`);
|
|
578
592
|
// Common Secrets
|
|
579
593
|
const commonSecretsPath = getVaultSecretsConfigs(toSite).commonSecretsPath;
|
|
@@ -657,7 +671,7 @@ export async function configureFromSite(fromSite, toSite, fromEnv,toEnv, deployU
|
|
|
657
671
|
CONNECT_URL = `${oldUrl}_ui`;
|
|
658
672
|
}
|
|
659
673
|
|
|
660
|
-
await templateAuth0(SITE_HOST, CORE_API_CONTEXT, toEnv, filePaths, deployUI, deployGraphQLServer, commonSecrets);
|
|
674
|
+
await templateAuth0(SITE_HOST, CORE_API_CONTEXT, toEnv, filePaths, deployUI, deployGraphQLServer, commonSecrets, configureMFA);
|
|
661
675
|
await importAuth0Templates('./auth0-site-setup/template', auth0Domain, auth0ClientId, auth0ClientSecret);
|
|
662
676
|
|
|
663
677
|
if (deployUI === 'true') {
|