@atlasauth/cli 0.12.0 → 0.13.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/CHANGELOG.md +6 -0
- package/dist/args.d.ts +15 -0
- package/dist/args.js +7 -0
- package/dist/args.js.map +1 -1
- package/dist/commands/config.js +71 -6
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.js +84 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/pages.d.ts +14 -0
- package/dist/commands/pages.js +113 -0
- package/dist/commands/pages.js.map +1 -0
- package/dist/context.d.ts +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +58 -2
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/migrate/appwrite/plugin.d.ts +2 -0
- package/dist/migrate/appwrite/plugin.js +103 -0
- package/dist/migrate/appwrite/plugin.js.map +1 -0
- package/dist/migrate/authentik/plugin.d.ts +2 -0
- package/dist/migrate/authentik/plugin.js +135 -0
- package/dist/migrate/authentik/plugin.js.map +1 -0
- package/dist/migrate/azure-ad-b2c/plugin.d.ts +8 -0
- package/dist/migrate/azure-ad-b2c/plugin.js +165 -0
- package/dist/migrate/azure-ad-b2c/plugin.js.map +1 -0
- package/dist/migrate/cognito/plugin.d.ts +5 -0
- package/dist/migrate/cognito/plugin.js +170 -0
- package/dist/migrate/cognito/plugin.js.map +1 -0
- package/dist/migrate/corbado/plugin.d.ts +2 -0
- package/dist/migrate/corbado/plugin.js +63 -0
- package/dist/migrate/corbado/plugin.js.map +1 -0
- package/dist/migrate/entra-external-id/plugin.d.ts +8 -0
- package/dist/migrate/entra-external-id/plugin.js +12 -0
- package/dist/migrate/entra-external-id/plugin.js.map +1 -0
- package/dist/migrate/export/appwrite-config.d.ts +28 -0
- package/dist/migrate/export/appwrite-config.js +170 -0
- package/dist/migrate/export/appwrite-config.js.map +1 -0
- package/dist/migrate/export/appwrite.d.ts +51 -0
- package/dist/migrate/export/appwrite.js +288 -0
- package/dist/migrate/export/appwrite.js.map +1 -0
- package/dist/migrate/export/authentik-config.d.ts +45 -0
- package/dist/migrate/export/authentik-config.js +357 -0
- package/dist/migrate/export/authentik-config.js.map +1 -0
- package/dist/migrate/export/authentik.d.ts +110 -0
- package/dist/migrate/export/authentik.js +838 -0
- package/dist/migrate/export/authentik.js.map +1 -0
- package/dist/migrate/export/azure-config.d.ts +58 -0
- package/dist/migrate/export/azure-config.js +344 -0
- package/dist/migrate/export/azure-config.js.map +1 -0
- package/dist/migrate/export/azure.d.ts +85 -0
- package/dist/migrate/export/azure.js +373 -0
- package/dist/migrate/export/azure.js.map +1 -0
- package/dist/migrate/export/cognito-config.d.ts +25 -0
- package/dist/migrate/export/cognito-config.js +273 -0
- package/dist/migrate/export/cognito-config.js.map +1 -0
- package/dist/migrate/export/cognito.d.ts +103 -0
- package/dist/migrate/export/cognito.js +441 -0
- package/dist/migrate/export/cognito.js.map +1 -0
- package/dist/migrate/export/corbado-config.d.ts +20 -0
- package/dist/migrate/export/corbado-config.js +63 -0
- package/dist/migrate/export/corbado-config.js.map +1 -0
- package/dist/migrate/export/corbado.d.ts +37 -0
- package/dist/migrate/export/corbado.js +132 -0
- package/dist/migrate/export/corbado.js.map +1 -0
- package/dist/migrate/export/firebase-config.d.ts +24 -0
- package/dist/migrate/export/firebase-config.js +215 -0
- package/dist/migrate/export/firebase-config.js.map +1 -0
- package/dist/migrate/export/firebase.d.ts +102 -0
- package/dist/migrate/export/firebase.js +464 -0
- package/dist/migrate/export/firebase.js.map +1 -0
- package/dist/migrate/export/frontegg-config.d.ts +29 -0
- package/dist/migrate/export/frontegg-config.js +238 -0
- package/dist/migrate/export/frontegg-config.js.map +1 -0
- package/dist/migrate/export/frontegg.d.ts +67 -0
- package/dist/migrate/export/frontegg.js +410 -0
- package/dist/migrate/export/frontegg.js.map +1 -0
- package/dist/migrate/export/fusionauth-config.d.ts +26 -0
- package/dist/migrate/export/fusionauth-config.js +226 -0
- package/dist/migrate/export/fusionauth-config.js.map +1 -0
- package/dist/migrate/export/fusionauth.d.ts +99 -0
- package/dist/migrate/export/fusionauth.js +642 -0
- package/dist/migrate/export/fusionauth.js.map +1 -0
- package/dist/migrate/export/hanko-config.d.ts +27 -0
- package/dist/migrate/export/hanko-config.js +265 -0
- package/dist/migrate/export/hanko-config.js.map +1 -0
- package/dist/migrate/export/hanko.d.ts +52 -0
- package/dist/migrate/export/hanko.js +605 -0
- package/dist/migrate/export/hanko.js.map +1 -0
- package/dist/migrate/export/keycloak-config.d.ts +19 -0
- package/dist/migrate/export/keycloak-config.js +219 -0
- package/dist/migrate/export/keycloak-config.js.map +1 -0
- package/dist/migrate/export/keycloak.d.ts +155 -0
- package/dist/migrate/export/keycloak.js +878 -0
- package/dist/migrate/export/keycloak.js.map +1 -0
- package/dist/migrate/export/ldap.d.ts +53 -0
- package/dist/migrate/export/ldap.js +277 -0
- package/dist/migrate/export/ldap.js.map +1 -0
- package/dist/migrate/export/logto-config.d.ts +27 -0
- package/dist/migrate/export/logto-config.js +264 -0
- package/dist/migrate/export/logto-config.js.map +1 -0
- package/dist/migrate/export/logto.d.ts +150 -0
- package/dist/migrate/export/logto.js +809 -0
- package/dist/migrate/export/logto.js.map +1 -0
- package/dist/migrate/export/magic-config.d.ts +14 -0
- package/dist/migrate/export/magic-config.js +28 -0
- package/dist/migrate/export/magic-config.js.map +1 -0
- package/dist/migrate/export/magic.d.ts +31 -0
- package/dist/migrate/export/magic.js +93 -0
- package/dist/migrate/export/magic.js.map +1 -0
- package/dist/migrate/export/mini-yaml.d.ts +19 -0
- package/dist/migrate/export/mini-yaml.js +581 -0
- package/dist/migrate/export/mini-yaml.js.map +1 -0
- package/dist/migrate/export/nhost-config.d.ts +26 -0
- package/dist/migrate/export/nhost-config.js +360 -0
- package/dist/migrate/export/nhost-config.js.map +1 -0
- package/dist/migrate/export/nhost.d.ts +64 -0
- package/dist/migrate/export/nhost.js +304 -0
- package/dist/migrate/export/nhost.js.map +1 -0
- package/dist/migrate/export/onelogin.d.ts +22 -0
- package/dist/migrate/export/onelogin.js +123 -0
- package/dist/migrate/export/onelogin.js.map +1 -0
- package/dist/migrate/export/ory-config.d.ts +58 -0
- package/dist/migrate/export/ory-config.js +451 -0
- package/dist/migrate/export/ory-config.js.map +1 -0
- package/dist/migrate/export/ory.d.ts +81 -0
- package/dist/migrate/export/ory.js +555 -0
- package/dist/migrate/export/ory.js.map +1 -0
- package/dist/migrate/export/password-detect.d.ts +29 -0
- package/dist/migrate/export/password-detect.js +81 -0
- package/dist/migrate/export/password-detect.js.map +1 -0
- package/dist/migrate/export/pingone.d.ts +36 -0
- package/dist/migrate/export/pingone.js +218 -0
- package/dist/migrate/export/pingone.js.map +1 -0
- package/dist/migrate/export/pocketbase-config.d.ts +28 -0
- package/dist/migrate/export/pocketbase-config.js +180 -0
- package/dist/migrate/export/pocketbase-config.js.map +1 -0
- package/dist/migrate/export/pocketbase.d.ts +52 -0
- package/dist/migrate/export/pocketbase.js +243 -0
- package/dist/migrate/export/pocketbase.js.map +1 -0
- package/dist/migrate/export/project-files.d.ts +15 -0
- package/dist/migrate/export/project-files.js +43 -0
- package/dist/migrate/export/project-files.js.map +1 -0
- package/dist/migrate/export/propelauth-config.d.ts +18 -0
- package/dist/migrate/export/propelauth-config.js +58 -0
- package/dist/migrate/export/propelauth-config.js.map +1 -0
- package/dist/migrate/export/propelauth-harness.test-helper.d.ts +62 -0
- package/dist/migrate/export/propelauth-harness.test-helper.js +109 -0
- package/dist/migrate/export/propelauth-harness.test-helper.js.map +1 -0
- package/dist/migrate/export/propelauth.d.ts +48 -0
- package/dist/migrate/export/propelauth.js +255 -0
- package/dist/migrate/export/propelauth.js.map +1 -0
- package/dist/migrate/export/source-lines.d.ts +17 -0
- package/dist/migrate/export/source-lines.js +43 -0
- package/dist/migrate/export/source-lines.js.map +1 -0
- package/dist/migrate/export/sso-metadata.d.ts +47 -0
- package/dist/migrate/export/sso-metadata.js +180 -0
- package/dist/migrate/export/sso-metadata.js.map +1 -0
- package/dist/migrate/export/stytch-config.d.ts +22 -0
- package/dist/migrate/export/stytch-config.js +102 -0
- package/dist/migrate/export/stytch-config.js.map +1 -0
- package/dist/migrate/export/stytch.d.ts +68 -0
- package/dist/migrate/export/stytch.js +510 -0
- package/dist/migrate/export/stytch.js.map +1 -0
- package/dist/migrate/export/supabase-config.d.ts +48 -0
- package/dist/migrate/export/supabase-config.js +408 -0
- package/dist/migrate/export/supabase-config.js.map +1 -0
- package/dist/migrate/export/supabase.d.ts +86 -0
- package/dist/migrate/export/supabase.js +524 -0
- package/dist/migrate/export/supabase.js.map +1 -0
- package/dist/migrate/export/supertokens-config.d.ts +20 -0
- package/dist/migrate/export/supertokens-config.js +150 -0
- package/dist/migrate/export/supertokens-config.js.map +1 -0
- package/dist/migrate/export/supertokens.d.ts +125 -0
- package/dist/migrate/export/supertokens.js +464 -0
- package/dist/migrate/export/supertokens.js.map +1 -0
- package/dist/migrate/export/table.d.ts +35 -0
- package/dist/migrate/export/table.js +248 -0
- package/dist/migrate/export/table.js.map +1 -0
- package/dist/migrate/export/userfront-config.d.ts +15 -0
- package/dist/migrate/export/userfront-config.js +49 -0
- package/dist/migrate/export/userfront-config.js.map +1 -0
- package/dist/migrate/export/userfront.d.ts +38 -0
- package/dist/migrate/export/userfront.js +189 -0
- package/dist/migrate/export/userfront.js.map +1 -0
- package/dist/migrate/export/workos-config.d.ts +23 -0
- package/dist/migrate/export/workos-config.js +125 -0
- package/dist/migrate/export/workos-config.js.map +1 -0
- package/dist/migrate/export/workos.d.ts +46 -0
- package/dist/migrate/export/workos.js +272 -0
- package/dist/migrate/export/workos.js.map +1 -0
- package/dist/migrate/export/zitadel-config.d.ts +37 -0
- package/dist/migrate/export/zitadel-config.js +279 -0
- package/dist/migrate/export/zitadel-config.js.map +1 -0
- package/dist/migrate/export/zitadel.d.ts +82 -0
- package/dist/migrate/export/zitadel.js +447 -0
- package/dist/migrate/export/zitadel.js.map +1 -0
- package/dist/migrate/firebase/plugin.d.ts +2 -0
- package/dist/migrate/firebase/plugin.js +152 -0
- package/dist/migrate/firebase/plugin.js.map +1 -0
- package/dist/migrate/framework/builtins.js +35 -6
- package/dist/migrate/framework/builtins.js.map +1 -1
- package/dist/migrate/framework/orchestrator.js +3 -2
- package/dist/migrate/framework/orchestrator.js.map +1 -1
- package/dist/migrate/framework/plugin.d.ts +2 -0
- package/dist/migrate/frontegg/plugin.d.ts +2 -0
- package/dist/migrate/frontegg/plugin.js +78 -0
- package/dist/migrate/frontegg/plugin.js.map +1 -0
- package/dist/migrate/fusionauth/plugin.d.ts +2 -0
- package/dist/migrate/fusionauth/plugin.js +109 -0
- package/dist/migrate/fusionauth/plugin.js.map +1 -0
- package/dist/migrate/hanko/plugin.d.ts +2 -0
- package/dist/migrate/hanko/plugin.js +100 -0
- package/dist/migrate/hanko/plugin.js.map +1 -0
- package/dist/migrate/keycloak/plugin.d.ts +2 -0
- package/dist/migrate/keycloak/plugin.js +148 -0
- package/dist/migrate/keycloak/plugin.js.map +1 -0
- package/dist/migrate/ldap/plugin.d.ts +2 -0
- package/dist/migrate/ldap/plugin.js +73 -0
- package/dist/migrate/ldap/plugin.js.map +1 -0
- package/dist/migrate/logto/plugin.d.ts +2 -0
- package/dist/migrate/logto/plugin.js +131 -0
- package/dist/migrate/logto/plugin.js.map +1 -0
- package/dist/migrate/magic/plugin.d.ts +2 -0
- package/dist/migrate/magic/plugin.js +56 -0
- package/dist/migrate/magic/plugin.js.map +1 -0
- package/dist/migrate/nhost/plugin.d.ts +2 -0
- package/dist/migrate/nhost/plugin.js +115 -0
- package/dist/migrate/nhost/plugin.js.map +1 -0
- package/dist/migrate/oidc/plugin.d.ts +2 -0
- package/dist/migrate/oidc/plugin.js +73 -0
- package/dist/migrate/oidc/plugin.js.map +1 -0
- package/dist/migrate/onelogin/plugin.d.ts +2 -0
- package/dist/migrate/onelogin/plugin.js +61 -0
- package/dist/migrate/onelogin/plugin.js.map +1 -0
- package/dist/migrate/ory/plugin.d.ts +2 -0
- package/dist/migrate/ory/plugin.js +186 -0
- package/dist/migrate/ory/plugin.js.map +1 -0
- package/dist/migrate/ping-identity/plugin.d.ts +2 -0
- package/dist/migrate/ping-identity/plugin.js +100 -0
- package/dist/migrate/ping-identity/plugin.js.map +1 -0
- package/dist/migrate/pocketbase/plugin.d.ts +2 -0
- package/dist/migrate/pocketbase/plugin.js +99 -0
- package/dist/migrate/pocketbase/plugin.js.map +1 -0
- package/dist/migrate/propelauth/plugin.d.ts +2 -0
- package/dist/migrate/propelauth/plugin.js +65 -0
- package/dist/migrate/propelauth/plugin.js.map +1 -0
- package/dist/migrate/saml/plugin.d.ts +2 -0
- package/dist/migrate/saml/plugin.js +79 -0
- package/dist/migrate/saml/plugin.js.map +1 -0
- package/dist/migrate/stytch/plugin.d.ts +2 -0
- package/dist/migrate/stytch/plugin.js +97 -0
- package/dist/migrate/stytch/plugin.js.map +1 -0
- package/dist/migrate/supabase/plugin.d.ts +2 -0
- package/dist/migrate/supabase/plugin.js +149 -0
- package/dist/migrate/supabase/plugin.js.map +1 -0
- package/dist/migrate/supertokens/plugin.d.ts +2 -0
- package/dist/migrate/supertokens/plugin.js +114 -0
- package/dist/migrate/supertokens/plugin.js.map +1 -0
- package/dist/migrate/user-table/plugin.d.ts +2 -0
- package/dist/migrate/user-table/plugin.js +62 -0
- package/dist/migrate/user-table/plugin.js.map +1 -0
- package/dist/migrate/userfront/plugin.d.ts +2 -0
- package/dist/migrate/userfront/plugin.js +60 -0
- package/dist/migrate/userfront/plugin.js.map +1 -0
- package/dist/migrate/workos/plugin.d.ts +2 -0
- package/dist/migrate/workos/plugin.js +81 -0
- package/dist/migrate/workos/plugin.js.map +1 -0
- package/dist/migrate/zitadel/plugin.d.ts +2 -0
- package/dist/migrate/zitadel/plugin.js +114 -0
- package/dist/migrate/zitadel/plugin.js.map +1 -0
- package/dist/run.js +4 -0
- package/dist/run.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.azureAdB2cPlugin = void 0;
|
|
4
|
+
exports.readPolicyDir = readPolicyDir;
|
|
5
|
+
exports.azurePlugin = azurePlugin;
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const azure_1 = require("../export/azure");
|
|
9
|
+
const azure_config_1 = require("../export/azure-config");
|
|
10
|
+
const errors_1 = require("../../errors");
|
|
11
|
+
const project_files_1 = require("../export/project-files");
|
|
12
|
+
const plugin_kit_1 = require("../export/plugin-kit");
|
|
13
|
+
/**
|
|
14
|
+
* `atlas migrate azure-ad-b2c` and (through {@link azurePlugin})
|
|
15
|
+
* `atlas migrate entra-external-id` — a Microsoft customer-identity tenant
|
|
16
|
+
* through Microsoft Graph with an app registration the owner creates
|
|
17
|
+
* (client credentials). Users keyed by their object id with sign-in
|
|
18
|
+
* identities, federated links, custom attributes, groups and SMS / email
|
|
19
|
+
* factors; identity providers, user flows, custom policies (B2C), app
|
|
20
|
+
* registrations and groups as Atlas config; the JWT bridge preset; lazy
|
|
21
|
+
* migration (B2C ROPC user flow, External ID native authentication) — Graph
|
|
22
|
+
* never returns a password. The client secret is sent to Microsoft only.
|
|
23
|
+
*/
|
|
24
|
+
const TENANT = { flag: '--azure-tenant', env: 'AZURE_TENANT_ID', label: 'the tenant id (GUID) or domain (contoso.onmicrosoft.com)', required: true };
|
|
25
|
+
const CLIENT_ID = { flag: '--azure-client-id', env: 'AZURE_CLIENT_ID', label: 'the client id of an app registration with Graph User.Read.All (application)', required: false };
|
|
26
|
+
const CLIENT_SECRET = { flag: '--azure-client-secret', env: 'AZURE_CLIENT_SECRET', label: 'that app registration\'s client secret', required: false, secret: true };
|
|
27
|
+
const ACCESS_TOKEN = { flag: '--azure-graph-token', env: 'AZURE_GRAPH_TOKEN', label: 'a Microsoft Graph access token, instead of client credentials', required: false, secret: true };
|
|
28
|
+
const AUTH_METHODS = { flag: '--azure-auth-methods', env: 'AZURE_EXPORT_AUTH_METHODS', label: 'true to read each user\'s phone / email MFA methods (UserAuthenticationMethod.Read.All)', required: false };
|
|
29
|
+
const DIRECTORY_USERS = { flag: '--azure-directory-users', env: 'AZURE_EXPORT_DIRECTORY_USERS', label: 'true to also export admin / work accounts', required: false };
|
|
30
|
+
const GROUPS_AS = { flag: '--groups-as', env: 'ATLAS_MIGRATE_GROUPS_AS', label: 'how groups move: roles or skip', required: false };
|
|
31
|
+
const POLICY_DIR = { flag: '--b2c-policy-dir', env: 'B2C_POLICY_DIR', label: 'a folder with your B2C custom policy XML files (TrustFrameworkBase.xml, …)', required: false };
|
|
32
|
+
const APP_CLIENT_ID = { flag: '--azure-app-client-id', env: 'AZURE_APP_CLIENT_ID', label: 'your app\'s client id (the ID token audience; for lazy migration a public client)', required: false };
|
|
33
|
+
const SIGN_IN_POLICY = { flag: '--b2c-policy', env: 'B2C_POLICY', label: 'the user flow / custom policy that issued your users\' tokens (B2C_1_signupsignin)', required: false };
|
|
34
|
+
const ROPC_CLIENT_ID = { flag: '--b2c-ropc-client-id', env: 'B2C_ROPC_CLIENT_ID', label: 'the public client registration the ROPC user flow signs in with, when it is not your app\'s client id', required: false };
|
|
35
|
+
const ROPC_POLICY = { flag: '--b2c-ropc-policy', env: 'B2C_ROPC_POLICY', label: 'the ROPC user flow lazy migration checks passwords with (B2C_1_ROPC_Auth)', required: false };
|
|
36
|
+
const CUSTOM_DOMAIN = { flag: '--azure-custom-domain', env: 'AZURE_CUSTOM_DOMAIN', label: 'a custom domain in front of b2clogin.com / ciamlogin.com', required: false };
|
|
37
|
+
function graph(p) {
|
|
38
|
+
const tenant = (0, plugin_kit_1.need)(p, TENANT).trim();
|
|
39
|
+
const accessToken = p.credential(ACCESS_TOKEN);
|
|
40
|
+
const clientId = p.credential(CLIENT_ID);
|
|
41
|
+
const clientSecret = p.credential(CLIENT_SECRET);
|
|
42
|
+
if (!accessToken && !(clientId && clientSecret)) {
|
|
43
|
+
throw new errors_1.CliError('Microsoft Graph: pass an app registration\'s client id and secret (AZURE_CLIENT_ID, AZURE_CLIENT_SECRET) with the User.Read.All application permission, or a Graph access token (AZURE_GRAPH_TOKEN).');
|
|
44
|
+
}
|
|
45
|
+
return { tenant, accessToken, clientId, clientSecret };
|
|
46
|
+
}
|
|
47
|
+
/** The B2C custom policy files of a folder (`*.xml`), for the config report. */
|
|
48
|
+
function readPolicyDir(dir) {
|
|
49
|
+
const root = (0, node_path_1.resolve)(dir);
|
|
50
|
+
let names;
|
|
51
|
+
try {
|
|
52
|
+
names = (0, node_fs_1.readdirSync)(root);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
throw new errors_1.CliError(`Could not read the custom policy folder ${dir}: ${err.message}`);
|
|
56
|
+
}
|
|
57
|
+
return names
|
|
58
|
+
.filter((n) => n.toLowerCase().endsWith('.xml') && (0, node_fs_1.statSync)((0, node_path_1.join)(root, n)).isFile())
|
|
59
|
+
.sort()
|
|
60
|
+
.map((n) => ({ file: (0, node_path_1.basename)(n), text: (0, node_fs_1.readFileSync)((0, node_path_1.join)(root, n), 'utf8') }));
|
|
61
|
+
}
|
|
62
|
+
/** Tenant name of a domain argument (`contoso.onmicrosoft.com` → `contoso`), or undefined for a GUID. */
|
|
63
|
+
function tenantNameOf(raw) {
|
|
64
|
+
const m = raw ? /^([a-z0-9-]+)\.(onmicrosoft|b2clogin|ciamlogin)\.com$/i.exec(raw.trim()) : null;
|
|
65
|
+
return m ? m[1].toLowerCase() : undefined;
|
|
66
|
+
}
|
|
67
|
+
const GUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
68
|
+
/** The plugin for one of the two Microsoft customer-identity products. */
|
|
69
|
+
function azurePlugin(kind) {
|
|
70
|
+
const b2c = kind === 'b2c';
|
|
71
|
+
const label = b2c ? 'Azure AD B2C' : 'Microsoft Entra External ID';
|
|
72
|
+
const preset = b2c ? 'azure_ad_b2c' : 'entra_external_id';
|
|
73
|
+
const commonVars = (p, base) => {
|
|
74
|
+
const out = { ...base };
|
|
75
|
+
const tenant = p.credential({ ...TENANT, required: false })?.trim();
|
|
76
|
+
const name = tenantNameOf(tenant);
|
|
77
|
+
if (name)
|
|
78
|
+
out.tenant = name;
|
|
79
|
+
if (tenant && GUID.test(tenant))
|
|
80
|
+
out.tenant_id = tenant.toLowerCase();
|
|
81
|
+
const clientId = p.credential(APP_CLIENT_ID);
|
|
82
|
+
if (clientId)
|
|
83
|
+
out.client_id = clientId;
|
|
84
|
+
return out;
|
|
85
|
+
};
|
|
86
|
+
return {
|
|
87
|
+
vendor: b2c ? 'azure-ad-b2c' : 'entra-external-id',
|
|
88
|
+
source: preset,
|
|
89
|
+
label,
|
|
90
|
+
help: b2c
|
|
91
|
+
? 'Move an Azure AD B2C tenant: identity providers, user flows, custom policies (with file and line), custom attributes, app registrations and groups as Atlas config; consumer users keyed by object id with their sign-in names, social links, custom attributes, groups and SMS / email factors; a zero-logout bridge for B2C ID tokens; lazy migration through a ROPC user flow (Graph never returns passwords); and the MSAL code. Your app registration secret stays on this machine.'
|
|
92
|
+
: 'Move a Microsoft Entra External ID (external) tenant: identity providers, sign-up / sign-in flows, custom attributes, app registrations and groups as Atlas config; customers keyed by object id with their sign-in identities, social links, custom attributes, groups and SMS / email factors; a zero-logout bridge for External ID ID tokens; lazy migration through the native authentication API (Graph never returns passwords); and the MSAL code. Your app registration secret stays on this machine.',
|
|
93
|
+
config: {
|
|
94
|
+
reads: `your ${label} tenant via Microsoft Graph${b2c ? ' (and your custom policy files with --b2c-policy-dir)' : ''}`,
|
|
95
|
+
credentials: [TENANT, CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN, ...(b2c ? [POLICY_DIR] : [])],
|
|
96
|
+
async translate(p) {
|
|
97
|
+
const g = graph(p);
|
|
98
|
+
const dir = b2c ? p.credential(POLICY_DIR) : undefined;
|
|
99
|
+
const policies = dir ? readPolicyDir(dir) : [];
|
|
100
|
+
const snap = await (0, plugin_kit_1.vendorStep)(label, () => (0, azure_config_1.fetchAzureConfig)((0, azure_1.graphHttp)({ ...g, fetchImpl: p.fetch }), kind, g.tenant, policies));
|
|
101
|
+
return (0, azure_config_1.translateAzureConfig)(snap);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
export: {
|
|
105
|
+
reads: 'Microsoft Graph (users with their identities and extension attributes, groups, authentication methods)',
|
|
106
|
+
credentials: [TENANT, CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN, AUTH_METHODS, DIRECTORY_USERS],
|
|
107
|
+
limits: [
|
|
108
|
+
`${label} never returns passwords: Graph's password field is write-only. Every password moves by lazy migration, ${b2c ? 'through a ROPC user flow' : 'through the native authentication API'}, on the user's first Atlas sign-in.`,
|
|
109
|
+
'Authenticator-app (software OATH) secrets and FIDO2 keys are never exported: those users enrol again. SMS and email methods move with --set azure-auth-methods=true.',
|
|
110
|
+
'Sessions are not exported: the bridge exchanges the ID token your app holds (MSAL caches up to v3 are read in the browser; v4 caches are encrypted).',
|
|
111
|
+
...(b2c ? ['Federated identities that Graph keeps only as an alternativeSecurityId cannot be linked by id: those users relink by verified email on first sign-in.'] : []),
|
|
112
|
+
],
|
|
113
|
+
async run(p, writer, resume) {
|
|
114
|
+
const g = graph(p);
|
|
115
|
+
const groups = p.credential(GROUPS_AS) ?? 'roles';
|
|
116
|
+
if (groups !== 'roles' && groups !== 'skip')
|
|
117
|
+
throw new errors_1.CliError(`${label}: --groups-as must be roles or skip (got ${groups}).`);
|
|
118
|
+
const set = await (0, plugin_kit_1.vendorStep)(label, () => (0, azure_1.exportAzure)({
|
|
119
|
+
kind,
|
|
120
|
+
...g,
|
|
121
|
+
authMethods: (0, project_files_1.truthyCredential)(p, AUTH_METHODS),
|
|
122
|
+
includeDirectoryUsers: (0, project_files_1.truthyCredential)(p, DIRECTORY_USERS),
|
|
123
|
+
groups,
|
|
124
|
+
fetchImpl: p.fetch,
|
|
125
|
+
onProgress: (m) => p.say(` reading ${m}`),
|
|
126
|
+
}));
|
|
127
|
+
await (0, plugin_kit_1.writeRecordSet)(set, writer, resume, p.say);
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
bridge: {
|
|
131
|
+
preset,
|
|
132
|
+
vars(p, t) {
|
|
133
|
+
const vars = commonVars(p, t?.bridge?.vars);
|
|
134
|
+
if (b2c) {
|
|
135
|
+
const policy = p.credential(SIGN_IN_POLICY);
|
|
136
|
+
if (policy)
|
|
137
|
+
vars.policy = policy;
|
|
138
|
+
}
|
|
139
|
+
return vars;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
lazy: {
|
|
143
|
+
preset,
|
|
144
|
+
config(p, t) {
|
|
145
|
+
const config = commonVars(p, t?.lazy?.config);
|
|
146
|
+
delete config.tenant_id;
|
|
147
|
+
if (b2c) {
|
|
148
|
+
const policy = p.credential(ROPC_POLICY);
|
|
149
|
+
if (policy)
|
|
150
|
+
config.policy = policy;
|
|
151
|
+
const ropcClient = p.credential(ROPC_CLIENT_ID);
|
|
152
|
+
if (ropcClient)
|
|
153
|
+
config.client_id = ropcClient;
|
|
154
|
+
}
|
|
155
|
+
const domain = p.credential(CUSTOM_DOMAIN);
|
|
156
|
+
if (domain)
|
|
157
|
+
config.custom_domain = domain;
|
|
158
|
+
return config;
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
codemod: b2c ? 'azure-ad-b2c' : 'entra-external-id',
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
exports.azureAdB2cPlugin = azurePlugin('b2c');
|
|
165
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/migrate/azure-ad-b2c/plugin.ts"],"names":[],"mappings":";;;AA+CA,sCAYC;A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O,IAAI,CAAC;YACd,CAAC;SACF;QACD,IAAI,EAAE;YACJ,MAAM;YACN,MAAM,CAAC,CAAC,EAAE,CAAC;gBACT,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;gBAC9C,OAAO,MAAM,CAAC,SAAS,CAAC;gBACxB,IAAI,GAAG,EAAE,CAAC;oBACR,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;oBACzC,IAAI,MAAM;wBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;oBACnC,MAAM,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;oBAChD,IAAI,UAAU;wBAAE,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC;gBAChD,CAAC;gBACD,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;gBAC3C,IAAI,MAAM;oBAAE,MAAM,CAAC,aAAa,GAAG,MAAM,CAAC;gBAC1C,OAAO,MAAM,CAAC;YAChB,CAAC;SACF;QACD,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,mBAAmB;KACpD,CAAC;AACJ,CAAC;AAEY,QAAA,gBAAgB,GAAoB,WAAW,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type AwsCredentials } from '../export/cognito';
|
|
2
|
+
import type { MigrationPlugin } from '../framework/plugin';
|
|
3
|
+
/** Static keys of a profile in the shared credentials file (SSO / assume-role profiles need `aws configure export-credentials`). */
|
|
4
|
+
export declare function profileCredentials(text: string, profile: string): AwsCredentials | undefined;
|
|
5
|
+
export declare const cognitoPlugin: MigrationPlugin;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cognitoPlugin = void 0;
|
|
4
|
+
exports.profileCredentials = profileCredentials;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const cognito_1 = require("../export/cognito");
|
|
9
|
+
const cognito_config_1 = require("../export/cognito-config");
|
|
10
|
+
const errors_1 = require("../../errors");
|
|
11
|
+
const project_files_1 = require("../export/project-files");
|
|
12
|
+
const plugin_kit_1 = require("../export/plugin-kit");
|
|
13
|
+
/**
|
|
14
|
+
* `atlas migrate cognito` — an Amazon Cognito user pool: its settings as
|
|
15
|
+
* Atlas config (DescribeUserPool, app clients, identity providers, resource
|
|
16
|
+
* servers, groups), its users with their attributes, federated links, groups
|
|
17
|
+
* and SMS / email factors through the cognito-idp API (or `aws cognito-idp
|
|
18
|
+
* list-users` output), the `cognito` bridge preset (ID tokens verified
|
|
19
|
+
* against the pool's JWKS) and lazy migration for every password (Cognito
|
|
20
|
+
* never exports hashes). AWS credentials stay on this machine: they sign the
|
|
21
|
+
* requests and are sent to AWS only as a signature.
|
|
22
|
+
*/
|
|
23
|
+
const POOL = { flag: '--cognito-user-pool-id', env: 'COGNITO_USER_POOL_ID', label: 'the user pool id (us-east-1_AbC123xyz)', required: true };
|
|
24
|
+
const REGION = { flag: '--aws-region', env: 'AWS_REGION', label: 'the AWS region (default: from the pool id)', required: false };
|
|
25
|
+
const ACCESS_KEY = { flag: '--aws-access-key-id', env: 'AWS_ACCESS_KEY_ID', label: 'an AWS access key id allowed cognito-idp:List*/Describe*', required: false };
|
|
26
|
+
const SECRET_KEY = { flag: '--aws-secret-access-key', env: 'AWS_SECRET_ACCESS_KEY', label: 'its secret access key', required: false, secret: true };
|
|
27
|
+
const SESSION_TOKEN = { flag: '--aws-session-token', env: 'AWS_SESSION_TOKEN', label: 'the session token of temporary credentials', required: false, secret: true };
|
|
28
|
+
const PROFILE = { flag: '--aws-profile', env: 'AWS_PROFILE', label: 'a profile with static keys in ~/.aws/credentials', required: false };
|
|
29
|
+
const USERS_FILE = { flag: '--cognito-users-file', env: 'COGNITO_USERS_FILE', label: '`aws cognito-idp list-users --output json` output', required: false };
|
|
30
|
+
const CLIENT_ID = { flag: '--cognito-client-id', env: 'COGNITO_CLIENT_ID', label: 'the app client id (the ID token audience; for lazy migration a client without a secret that allows USER_PASSWORD_AUTH)', required: false };
|
|
31
|
+
const MFA = { flag: '--cognito-mfa', env: 'COGNITO_EXPORT_MFA', label: 'true to read every user\'s MFA settings (one AdminGetUser per user)', required: false };
|
|
32
|
+
const GROUPS_AS = { flag: '--groups-as', env: 'ATLAS_MIGRATE_GROUPS_AS', label: 'how groups move: roles or skip', required: false };
|
|
33
|
+
/** Static keys of a profile in the shared credentials file (SSO / assume-role profiles need `aws configure export-credentials`). */
|
|
34
|
+
function profileCredentials(text, profile) {
|
|
35
|
+
let current = '';
|
|
36
|
+
const values = {};
|
|
37
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
38
|
+
const line = raw.trim();
|
|
39
|
+
if (!line || line.startsWith('#') || line.startsWith(';'))
|
|
40
|
+
continue;
|
|
41
|
+
const section = /^\[\s*(?:profile\s+)?([^\]]+?)\s*\]$/.exec(line);
|
|
42
|
+
if (section) {
|
|
43
|
+
current = section[1];
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const kv = /^([A-Za-z_]+)\s*=\s*(.*)$/.exec(line);
|
|
47
|
+
if (kv && current === profile)
|
|
48
|
+
values[kv[1].toLowerCase()] = kv[2].trim();
|
|
49
|
+
}
|
|
50
|
+
if (!values.aws_access_key_id || !values.aws_secret_access_key)
|
|
51
|
+
return undefined;
|
|
52
|
+
return { accessKeyId: values.aws_access_key_id, secretAccessKey: values.aws_secret_access_key, ...(values.aws_session_token ? { sessionToken: values.aws_session_token } : {}) };
|
|
53
|
+
}
|
|
54
|
+
/** AWS credentials from flags / env, else the named (or default) profile; undefined when none. */
|
|
55
|
+
function awsCredentials(p) {
|
|
56
|
+
const accessKeyId = p.credential(ACCESS_KEY);
|
|
57
|
+
const secretAccessKey = p.credential(SECRET_KEY);
|
|
58
|
+
if (accessKeyId && secretAccessKey) {
|
|
59
|
+
const sessionToken = p.credential(SESSION_TOKEN);
|
|
60
|
+
return { accessKeyId, secretAccessKey, ...(sessionToken ? { sessionToken } : {}) };
|
|
61
|
+
}
|
|
62
|
+
const profile = p.credential(PROFILE) ?? 'default';
|
|
63
|
+
const file = p.ctx.env.AWS_SHARED_CREDENTIALS_FILE?.trim() || (0, node_path_1.join)((0, node_os_1.homedir)(), '.aws', 'credentials');
|
|
64
|
+
let text;
|
|
65
|
+
try {
|
|
66
|
+
text = (0, node_fs_1.readFileSync)(file, 'utf8');
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return profileCredentials(text, profile);
|
|
72
|
+
}
|
|
73
|
+
function requireCredentials(p) {
|
|
74
|
+
const creds = awsCredentials(p);
|
|
75
|
+
if (!creds) {
|
|
76
|
+
throw new errors_1.CliError('Cognito: pass AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, plus AWS_SESSION_TOKEN for temporary ones) or a profile with static keys (AWS_PROFILE). For SSO profiles run `eval "$(aws configure export-credentials --format env)"` first.');
|
|
77
|
+
}
|
|
78
|
+
return creds;
|
|
79
|
+
}
|
|
80
|
+
function poolOf(p) {
|
|
81
|
+
const poolId = (0, plugin_kit_1.need)(p, POOL).trim();
|
|
82
|
+
const region = p.credential(REGION) ?? (0, cognito_1.regionOfPool)(poolId);
|
|
83
|
+
if (!region)
|
|
84
|
+
throw new errors_1.CliError(`Cognito: ${poolId} is not a user pool id (expected <region>_<id>, e.g. us-east-1_AbC123xyz).`);
|
|
85
|
+
return { poolId, region };
|
|
86
|
+
}
|
|
87
|
+
function groupsAs(p) {
|
|
88
|
+
const raw = p.credential(GROUPS_AS) ?? 'roles';
|
|
89
|
+
if (raw !== 'roles' && raw !== 'skip')
|
|
90
|
+
throw new errors_1.CliError(`Cognito: --groups-as must be roles or skip (got ${raw}).`);
|
|
91
|
+
return raw;
|
|
92
|
+
}
|
|
93
|
+
exports.cognitoPlugin = {
|
|
94
|
+
vendor: 'cognito',
|
|
95
|
+
source: 'cognito',
|
|
96
|
+
label: 'Amazon Cognito',
|
|
97
|
+
help: 'Move an Amazon Cognito user pool: password policy, MFA, sign-in identifiers, app clients, identity providers, resource servers and groups as Atlas config; users (keyed by sub) with their attributes, federated links, groups and SMS / email factors; enterprise SAML / OIDC connections; a zero-logout bridge for Cognito ID tokens; lazy migration for every password (Cognito never exports hashes); and the Amplify code. AWS credentials stay on this machine.',
|
|
98
|
+
config: {
|
|
99
|
+
reads: 'your user pool via the Cognito API (DescribeUserPool, app clients, identity providers, resource servers, groups)',
|
|
100
|
+
credentials: [POOL, REGION, ACCESS_KEY, SECRET_KEY, SESSION_TOKEN, PROFILE],
|
|
101
|
+
async translate(p) {
|
|
102
|
+
const { poolId, region } = poolOf(p);
|
|
103
|
+
const api = new cognito_1.CognitoApi({ region, credentials: requireCredentials(p), fetchImpl: p.fetch });
|
|
104
|
+
const snap = await (0, plugin_kit_1.vendorStep)('Cognito', () => (0, cognito_config_1.fetchCognitoConfig)(api, poolId, region));
|
|
105
|
+
return (0, cognito_config_1.translateCognitoConfig)(snap);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
export: {
|
|
109
|
+
reads: 'the Cognito API (ListUsers, groups, identity providers) or `aws cognito-idp list-users` output (--cognito-users-file)',
|
|
110
|
+
credentials: [POOL, REGION, ACCESS_KEY, SECRET_KEY, SESSION_TOKEN, PROFILE, USERS_FILE, MFA],
|
|
111
|
+
limits: [
|
|
112
|
+
'Cognito never exports password hashes (no API, no support request): every password moves by lazy migration, checked against Cognito on the user\'s first Atlas sign-in. Users who never sign in during the window reset their password.',
|
|
113
|
+
'TOTP secrets and passkeys never leave Cognito: those users enrol again. SMS and email second factors move (the verified phone number / email).',
|
|
114
|
+
'Users with FORCE_CHANGE_PASSWORD or RESET_REQUIRED status cannot move by lazy migration: they reset their password in Atlas.',
|
|
115
|
+
'With a list-users file only users move; groups and enterprise connections need API access.',
|
|
116
|
+
],
|
|
117
|
+
async run(p, writer, resume) {
|
|
118
|
+
const { poolId, region } = poolOf(p);
|
|
119
|
+
const usersText = (0, plugin_kit_1.localFile)(p, USERS_FILE, 'text');
|
|
120
|
+
const credentials = usersText ? awsCredentials(p) : requireCredentials(p);
|
|
121
|
+
const set = await (0, plugin_kit_1.vendorStep)('Cognito', () => (0, cognito_1.exportCognito)({
|
|
122
|
+
userPoolId: poolId,
|
|
123
|
+
region,
|
|
124
|
+
credentials,
|
|
125
|
+
usersText,
|
|
126
|
+
mfa: (0, project_files_1.truthyCredential)(p, MFA),
|
|
127
|
+
groups: groupsAs(p),
|
|
128
|
+
fetchImpl: p.fetch,
|
|
129
|
+
onProgress: (m) => p.say(` reading ${m}`),
|
|
130
|
+
}));
|
|
131
|
+
await (0, plugin_kit_1.writeRecordSet)(set, writer, resume, p.say);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
bridge: {
|
|
135
|
+
preset: 'cognito',
|
|
136
|
+
vars(p, t) {
|
|
137
|
+
const vars = { ...t?.bridge?.vars };
|
|
138
|
+
const pool = p.credential({ ...POOL, required: false });
|
|
139
|
+
if (pool) {
|
|
140
|
+
vars.user_pool_id = pool.trim();
|
|
141
|
+
const region = p.credential(REGION) ?? (0, cognito_1.regionOfPool)(pool);
|
|
142
|
+
if (region)
|
|
143
|
+
vars.region = region;
|
|
144
|
+
}
|
|
145
|
+
const clientId = p.credential(CLIENT_ID);
|
|
146
|
+
if (clientId)
|
|
147
|
+
vars.client_id = clientId;
|
|
148
|
+
return vars;
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
lazy: {
|
|
152
|
+
preset: 'cognito',
|
|
153
|
+
config(p, t) {
|
|
154
|
+
const config = { ...t?.lazy?.config };
|
|
155
|
+
const pool = p.credential({ ...POOL, required: false });
|
|
156
|
+
if (pool) {
|
|
157
|
+
config.user_pool_id = pool.trim();
|
|
158
|
+
const region = p.credential(REGION) ?? (0, cognito_1.regionOfPool)(pool);
|
|
159
|
+
if (region)
|
|
160
|
+
config.region = region;
|
|
161
|
+
}
|
|
162
|
+
const clientId = p.credential(CLIENT_ID);
|
|
163
|
+
if (clientId)
|
|
164
|
+
config.client_id = clientId;
|
|
165
|
+
return config;
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
codemod: 'cognito',
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/migrate/cognito/plugin.ts"],"names":[],"mappings":";;;AAiCA,gDAgBC;AAjDD,qCAAuC;AACvC,qCAAkC;AAClC,yCAAiC;AACjC,+CAAiG;AACjG,6DAAsF;AACtF,yCAAwC;AACxC,2DAA2D;AAE3D,qDAAmF;AAEnF;;;;;;;;;GASG;AAEH,MAAM,IAAI,GAAmB,EAAE,IAAI,EAAE,wBAAwB,EAAE,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,wCAAwC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC9J,MAAM,MAAM,GAAmB,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,4CAA4C,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACjJ,MAAM,UAAU,GAAmB,EAAE,IAAI,EAAE,qBAAqB,EAAE,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,0DAA0D,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACjL,MAAM,UAAU,GAAmB,EAAE,IAAI,EAAE,yBAAyB,EAAE,GAAG,EAAE,uBAAuB,EAAE,KAAK,EAAE,uBAAuB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AACpK,MAAM,aA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AAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACnC,CAAC;YACD,MAAM,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YACzC,IAAI,QAAQ;gBAAE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;YACxC,OAAO,IAAI,CAAC;QACd,CAAC;KACF;IACD,IAAI,EAAE;QACJ,MAAM,EAAE,SAAS;QACjB,MAAM,CAAC,CAAC,EAAE,CAAC;YACT,MAAM,MAAM,GAA2B,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;YAC9D,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;YACxD,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;gBAClC,MAAM,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAA,sBAAY,EAAC,IAAI,CAAC,CAAC;gBAC1D,IAAI,MAAM;oBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;YACrC,CAAC;YACD,MAAM,QAAQ,GAAG,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YACzC,IAAI,QAAQ;gBAAE,MAAM,CAAC,SAAS,GAAG,QAAQ,CAAC;YAC1C,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;IACD,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.corbadoPlugin = void 0;
|
|
4
|
+
const corbado_1 = require("../export/corbado");
|
|
5
|
+
const corbado_config_1 = require("../export/corbado-config");
|
|
6
|
+
const plugin_kit_1 = require("../export/plugin-kit");
|
|
7
|
+
/**
|
|
8
|
+
* `atlas migrate corbado` — users with their verified emails, phones and
|
|
9
|
+
* usernames AND their passkeys (credential ids and public keys, which
|
|
10
|
+
* Corbado's Backend API exports), the sign-in methods inferred from your
|
|
11
|
+
* users' identifiers, and the `corbado` bridge preset (short-session JWTs
|
|
12
|
+
* verified against the project's JWKS). Corbado holds no passwords.
|
|
13
|
+
*/
|
|
14
|
+
const PROJECT_ID = { flag: '--corbado-project-id', env: 'CORBADO_PROJECT_ID', label: 'your Corbado project id (pro-…)', required: true };
|
|
15
|
+
const API_SECRET = { flag: '--corbado-api-secret', env: 'CORBADO_API_SECRET', label: 'your Corbado API secret', required: true, secret: true };
|
|
16
|
+
const RP_ID = { flag: '--corbado-rp-id', env: 'CORBADO_RP_ID', label: 'the relying-party id (domain) your passkeys were registered for', required: false };
|
|
17
|
+
const BASE_URL = { flag: '--corbado-base-url', env: 'CORBADO_BASE_URL', label: 'the Corbado Backend API origin', required: false };
|
|
18
|
+
function projectId(p) {
|
|
19
|
+
return p.credential({ ...PROJECT_ID, required: false }) ?? (p.ctx.env.NEXT_PUBLIC_CORBADO_PROJECT_ID?.trim() || p.ctx.env.VITE_CORBADO_PROJECT_ID?.trim() || (0, plugin_kit_1.need)(p, PROJECT_ID));
|
|
20
|
+
}
|
|
21
|
+
exports.corbadoPlugin = {
|
|
22
|
+
vendor: 'corbado',
|
|
23
|
+
source: 'corbado',
|
|
24
|
+
label: 'Corbado',
|
|
25
|
+
help: 'Move a Corbado project: users with their verified emails, phone numbers and usernames, and their passkeys (credential ids and public keys) so members keep signing in with the passkey they have; the sign-in methods as Atlas config; a zero-logout bridge for Corbado session tokens; and the code. Your API secret stays on this machine.',
|
|
26
|
+
config: {
|
|
27
|
+
reads: 'your Corbado project via the Backend API (login identifier counts)',
|
|
28
|
+
credentials: [PROJECT_ID, API_SECRET, RP_ID, BASE_URL],
|
|
29
|
+
async translate(p) {
|
|
30
|
+
const pid = projectId(p);
|
|
31
|
+
const http = (0, corbado_1.corbadoHttp)({ projectId: pid, apiSecret: (0, plugin_kit_1.need)(p, API_SECRET), baseUrl: p.credential(BASE_URL), fetchImpl: p.fetch });
|
|
32
|
+
const snap = await (0, plugin_kit_1.vendorStep)('Corbado', () => (0, corbado_config_1.fetchCorbadoConfig)(http, pid, p.credential(RP_ID)));
|
|
33
|
+
return (0, corbado_config_1.translateCorbadoConfig)(snap);
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
export: {
|
|
37
|
+
reads: 'the Corbado Backend API (users, identifiers, passkeys)',
|
|
38
|
+
credentials: [PROJECT_ID, API_SECRET, RP_ID, BASE_URL],
|
|
39
|
+
limits: [
|
|
40
|
+
'Passkeys are exported with their public keys but are bound to your relying-party id (--corbado-rp-id): Atlas must be served from that domain, or a subdomain, for them to keep working. Without the flag, members register passkeys again.',
|
|
41
|
+
'Corbado keeps no passwords, authenticator-app secrets, organizations or API keys.',
|
|
42
|
+
'Linked social accounts are not returned: they relink by verified email on first social sign-in.',
|
|
43
|
+
'Sessions are not exported: Corbado session tokens are JWTs, exchanged by the corbado bridge preset.',
|
|
44
|
+
],
|
|
45
|
+
async run(p, writer, resume) {
|
|
46
|
+
const set = await (0, plugin_kit_1.vendorStep)('Corbado', () => (0, corbado_1.exportCorbado)({
|
|
47
|
+
projectId: projectId(p),
|
|
48
|
+
apiSecret: (0, plugin_kit_1.need)(p, API_SECRET),
|
|
49
|
+
baseUrl: p.credential(BASE_URL),
|
|
50
|
+
rpId: p.credential(RP_ID),
|
|
51
|
+
fetchImpl: p.fetch,
|
|
52
|
+
onProgress: (m) => p.say(` reading ${m}`),
|
|
53
|
+
}));
|
|
54
|
+
await (0, plugin_kit_1.writeRecordSet)(set, writer, resume, p.say);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
bridge: {
|
|
58
|
+
preset: 'corbado',
|
|
59
|
+
vars: (p, t) => ({ ...t?.bridge?.vars, project_id: t?.bridge?.vars.project_id ?? projectId(p) }),
|
|
60
|
+
},
|
|
61
|
+
codemod: 'corbado',
|
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CAAC,UAAU,CAAC,QAAQ,CAAC;gBAC/B,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;gBACzB,SAAS,EAAE,CAAC,CAAC,KAAK;gBAClB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;aAC3C,CAAC,CACH,CAAC;YACF,MAAM,IAAA,2BAAc,EAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC;KACF;IACD,MAAM,EAAE;QACN,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;KACjG;IACD,OAAO,EAAE,SAAS;CACnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MigrationPlugin } from '../framework/plugin';
|
|
2
|
+
/**
|
|
3
|
+
* `atlas migrate entra-external-id` — Microsoft Entra External ID (external
|
|
4
|
+
* tenants). Same Graph exporter and translator as Azure AD B2C; lazy
|
|
5
|
+
* migration through the native authentication API (external tenants have no
|
|
6
|
+
* ROPC) and the bridge matching on the `oid` claim.
|
|
7
|
+
*/
|
|
8
|
+
export declare const entraExternalIdPlugin: MigrationPlugin;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.entraExternalIdPlugin = void 0;
|
|
4
|
+
const plugin_1 = require("../azure-ad-b2c/plugin");
|
|
5
|
+
/**
|
|
6
|
+
* `atlas migrate entra-external-id` — Microsoft Entra External ID (external
|
|
7
|
+
* tenants). Same Graph exporter and translator as Azure AD B2C; lazy
|
|
8
|
+
* migration through the native authentication API (external tenants have no
|
|
9
|
+
* ROPC) and the bridge matching on the `oid` claim.
|
|
10
|
+
*/
|
|
11
|
+
exports.entraExternalIdPlugin = (0, plugin_1.azurePlugin)('entra');
|
|
12
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/migrate/entra-external-id/plugin.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AAGrD;;;;;GAKG;AACU,QAAA,qBAAqB,GAAoB,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { TranslationResult } from '../framework/plugin';
|
|
2
|
+
import { type Obj } from './record-set';
|
|
3
|
+
/**
|
|
4
|
+
* `atlas migrate appwrite config` — an Appwrite project's auth settings →
|
|
5
|
+
* Atlas config.
|
|
6
|
+
*
|
|
7
|
+
* Two local sources, either or both (Appwrite's Projects API is console-only,
|
|
8
|
+
* so no project key can read it — the owner's own CLI can):
|
|
9
|
+
* - `appwrite.json` (or `appwrite.config.json`) after `appwrite pull
|
|
10
|
+
* settings`: `settings.auth.methods` and `settings.auth.security`, read
|
|
11
|
+
* with file:line;
|
|
12
|
+
* - the project document (`appwrite projects get --project-id <id> --json`,
|
|
13
|
+
* Appwrite 1.x model: `authDuration`, `authLimit`, … and `oAuthProviders`),
|
|
14
|
+
* the only place the OAuth providers are listed.
|
|
15
|
+
*/
|
|
16
|
+
export interface AppwriteConfigSnapshot {
|
|
17
|
+
/** The CLI config file, as text, with its path for the report. */
|
|
18
|
+
file?: {
|
|
19
|
+
path: string;
|
|
20
|
+
text: string;
|
|
21
|
+
};
|
|
22
|
+
/** The project document (Projects API / `appwrite projects get --json`). */
|
|
23
|
+
project?: Obj;
|
|
24
|
+
endpoint?: string;
|
|
25
|
+
projectId?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function parseAppwriteConfigFile(text: string): Obj;
|
|
28
|
+
export declare function translateAppwriteConfig(snap: AppwriteConfigSnapshot): TranslationResult;
|