@docupace/pipeline 1.0.21 → 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 +25 -14
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,8 +165,8 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
163
165
|
let connectAllowedCallbacksUrls,
|
|
164
166
|
connectlAllowedLogoutUrls;
|
|
165
167
|
|
|
166
|
-
let connectClientMetadata,
|
|
167
|
-
connectCallbacks,
|
|
168
|
+
let connectClientMetadata,
|
|
169
|
+
connectCallbacks,
|
|
168
170
|
connectAddons;
|
|
169
171
|
// Configure URLs based on environment
|
|
170
172
|
if (env === 'prd') {
|
|
@@ -212,7 +214,7 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
212
214
|
connectCallbacks = [
|
|
213
215
|
`${siteUrl}/connect/samlCallback?client_name=auth0`
|
|
214
216
|
];
|
|
215
|
-
|
|
217
|
+
|
|
216
218
|
connectAddons = {
|
|
217
219
|
"samlp": {
|
|
218
220
|
"audience": `${siteUrl}/connect`,
|
|
@@ -242,7 +244,7 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
242
244
|
allowed_logout_urls: uiAllowedLogoutUrls,
|
|
243
245
|
});
|
|
244
246
|
|
|
245
|
-
|
|
247
|
+
|
|
246
248
|
//TODO: move to separate function for connect
|
|
247
249
|
console.log('connect_allowed_callbacks_urls ->', connectAllowedCallbacksUrls);
|
|
248
250
|
console.log('connect_allowed_logout_urls ->', connectlAllowedLogoutUrls);
|
|
@@ -301,13 +303,22 @@ async function templateAuth0(siteUrl, coreApiContext, env, filePaths, deployUI,
|
|
|
301
303
|
]);
|
|
302
304
|
|
|
303
305
|
// MFA configuration
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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
|
+
}
|
|
311
322
|
|
|
312
323
|
console.log('Template configuration completed.');
|
|
313
324
|
} catch (err) {
|
|
@@ -576,7 +587,7 @@ ingress:
|
|
|
576
587
|
}
|
|
577
588
|
|
|
578
589
|
|
|
579
|
-
export async function configureFromSite(fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain) {
|
|
590
|
+
export async function configureFromSite(fromSite, toSite, fromEnv,toEnv, deployUI, deployGraphQLServer, useNewDomain, configureMFA) {
|
|
580
591
|
console.log(`Configuring Auth0 tenants and ArgoCD apps for site: ${toSite} in env: ${toEnv} from site: ${fromSite}`);
|
|
581
592
|
// Common Secrets
|
|
582
593
|
const commonSecretsPath = getVaultSecretsConfigs(toSite).commonSecretsPath;
|
|
@@ -660,7 +671,7 @@ export async function configureFromSite(fromSite, toSite, fromEnv,toEnv, deployU
|
|
|
660
671
|
CONNECT_URL = `${oldUrl}_ui`;
|
|
661
672
|
}
|
|
662
673
|
|
|
663
|
-
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);
|
|
664
675
|
await importAuth0Templates('./auth0-site-setup/template', auth0Domain, auth0ClientId, auth0ClientSecret);
|
|
665
676
|
|
|
666
677
|
if (deployUI === 'true') {
|