@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,48 @@
|
|
|
1
|
+
import type { UserRecord } from '@atlasauth/migrate';
|
|
2
|
+
import { RecordSet, type Obj } from './record-set';
|
|
3
|
+
import { VendorHttp } from './vendor-http';
|
|
4
|
+
/**
|
|
5
|
+
* `atlas migrate export propelauth` — a PropelAuth project onto the canonical
|
|
6
|
+
* bundle models, read with a backend API key on this machine.
|
|
7
|
+
*
|
|
8
|
+
* - users (email + confirmed flag, username, names, picture, locked /
|
|
9
|
+
* disabled, metadata) with every organization they belong to and the role
|
|
10
|
+
* they hold there;
|
|
11
|
+
* - organizations (slug, self-join domains, member cap), the roles seen on
|
|
12
|
+
* members (with the permissions they carry) and pending invitations;
|
|
13
|
+
* - password hashes: PropelAuth has no password-verify API and does not
|
|
14
|
+
* return hashes. Support can export them; pass that file with
|
|
15
|
+
* --propelauth-hashes-file (self-describing hashes are recognised on their
|
|
16
|
+
* own). Without it members set a password again (reset link) — or sign in
|
|
17
|
+
* with the method they already use.
|
|
18
|
+
*
|
|
19
|
+
* Not exportable: TOTP secrets (only the factor type is readable), social
|
|
20
|
+
* account ids (users relink by verified email), end-user API key secrets
|
|
21
|
+
* (reissue), SAML IdP settings (write-only: set the connection up again).
|
|
22
|
+
* Sessions are RS256 tokens verified with the project's verifier key: see the
|
|
23
|
+
* `propelauth` bridge preset.
|
|
24
|
+
*/
|
|
25
|
+
export interface PropelauthExportOptions {
|
|
26
|
+
/** The project's auth URL (https://123456.propelauthtest.com or a custom domain). */
|
|
27
|
+
authUrl: string;
|
|
28
|
+
apiKey: string;
|
|
29
|
+
/** Backend API host (default https://propelauth-api.com). */
|
|
30
|
+
apiBase?: string;
|
|
31
|
+
/** The password-hash export from PropelAuth support (CSV or NDJSON). */
|
|
32
|
+
hashesText?: string;
|
|
33
|
+
fetchImpl?: typeof fetch;
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
onProgress?: (message: string) => void;
|
|
36
|
+
}
|
|
37
|
+
/** `https://x.propelauthtest.com/` → `https://x.propelauthtest.com`; anything but a plain https origin is refused. */
|
|
38
|
+
export declare function normalizeAuthUrl(raw: string): string;
|
|
39
|
+
export declare function propelauthHttp(o: {
|
|
40
|
+
authUrl: string;
|
|
41
|
+
apiKey: string;
|
|
42
|
+
apiBase?: string;
|
|
43
|
+
fetchImpl?: typeof fetch;
|
|
44
|
+
sleep?: (ms: number) => Promise<void>;
|
|
45
|
+
}): VendorHttp;
|
|
46
|
+
export declare function exportPropelauth(opts: PropelauthExportOptions): Promise<RecordSet>;
|
|
47
|
+
/** One PropelAuth user (user query result) → a user record. */
|
|
48
|
+
export declare function mapPropelauthUser(u: Obj): UserRecord | null;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeAuthUrl = normalizeAuthUrl;
|
|
4
|
+
exports.propelauthHttp = propelauthHttp;
|
|
5
|
+
exports.exportPropelauth = exportPropelauth;
|
|
6
|
+
exports.mapPropelauthUser = mapPropelauthUser;
|
|
7
|
+
const csv_1 = require("../../import/csv");
|
|
8
|
+
const record_set_1 = require("./record-set");
|
|
9
|
+
const translate_kit_1 = require("./translate-kit");
|
|
10
|
+
const vendor_http_1 = require("./vendor-http");
|
|
11
|
+
const API = 'https://propelauth-api.com';
|
|
12
|
+
const PAGE = 100;
|
|
13
|
+
const MAX_PAGES = 100_000;
|
|
14
|
+
const BUILT_IN_ROLES = new Set(['admin', 'member']);
|
|
15
|
+
/** `https://x.propelauthtest.com/` → `https://x.propelauthtest.com`; anything but a plain https origin is refused. */
|
|
16
|
+
function normalizeAuthUrl(raw) {
|
|
17
|
+
const url = raw.trim().replace(/\/+$/, '');
|
|
18
|
+
const withScheme = /^https:\/\//.test(url) ? url : /^[a-z0-9.-]+$/i.test(url) ? `https://${url}` : url;
|
|
19
|
+
if (!/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(withScheme))
|
|
20
|
+
throw new Error(`Not a PropelAuth auth URL: ${raw}`);
|
|
21
|
+
return withScheme;
|
|
22
|
+
}
|
|
23
|
+
function propelauthHttp(o) {
|
|
24
|
+
return new vendor_http_1.VendorHttp({
|
|
25
|
+
vendor: 'PropelAuth',
|
|
26
|
+
baseUrl: (o.apiBase ?? API).replace(/\/+$/, ''),
|
|
27
|
+
headers: { authorization: `Bearer ${o.apiKey}`, 'x-propelauth-url': normalizeAuthUrl(o.authUrl).replace(/^https:\/\//, '') },
|
|
28
|
+
fetchImpl: o.fetchImpl,
|
|
29
|
+
sleep: o.sleep,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function exportPropelauth(opts) {
|
|
33
|
+
const set = new record_set_1.RecordSet();
|
|
34
|
+
const authUrl = normalizeAuthUrl(opts.authUrl);
|
|
35
|
+
if (!opts.apiKey)
|
|
36
|
+
throw new Error('PropelAuth export needs a backend API key (PROPELAUTH_API_KEY).');
|
|
37
|
+
const progress = opts.onProgress ?? (() => undefined);
|
|
38
|
+
const http = propelauthHttp({ authUrl, apiKey: opts.apiKey, apiBase: opts.apiBase, fetchImpl: opts.fetchImpl, sleep: opts.sleep });
|
|
39
|
+
progress('organizations');
|
|
40
|
+
const orgs = await listOrgs(http);
|
|
41
|
+
const orgIds = new Set();
|
|
42
|
+
let saml = 0;
|
|
43
|
+
for (const o of orgs) {
|
|
44
|
+
const id = (0, record_set_1.str)(o.org_id);
|
|
45
|
+
const name = (0, record_set_1.str)(o.name) ?? (0, record_set_1.str)(o.org_name) ?? id;
|
|
46
|
+
if (!id || !name)
|
|
47
|
+
continue;
|
|
48
|
+
orgIds.add(id);
|
|
49
|
+
const detail = await optional(async () => (await http.get(`/api/backend/v1/org/${encodeURIComponent(id)}`)).body);
|
|
50
|
+
const domains = detail && detail.domain_autojoin === true ? [(0, record_set_1.str)(detail.domain), ...(0, record_set_1.strs)(detail.extra_domains)].filter((d) => !!d) : [];
|
|
51
|
+
set.add('organization', (0, record_set_1.compact)({
|
|
52
|
+
id,
|
|
53
|
+
name,
|
|
54
|
+
slug: (0, record_set_1.str)(detail?.url_safe_org_slug) ?? (0, record_set_1.str)(o.url_safe_org_slug) ?? (0, record_set_1.str)(o.url_safe_org_name),
|
|
55
|
+
domains: [...new Set(domains.map((d) => d.toLowerCase()))],
|
|
56
|
+
max_members: typeof o.max_users === 'number' && o.max_users > 0 ? o.max_users : undefined,
|
|
57
|
+
public_metadata: (0, record_set_1.bag)(o.metadata),
|
|
58
|
+
created_at: toMs(o.created_at),
|
|
59
|
+
}), id);
|
|
60
|
+
if (o.is_saml_configured === true)
|
|
61
|
+
saml++;
|
|
62
|
+
}
|
|
63
|
+
if (saml > 0) {
|
|
64
|
+
set.omit('sso_connection', 'PropelAuth never returns a SAML connection\'s IdP settings (write-only): set the connection up again in Atlas, with the same IdP', saml);
|
|
65
|
+
}
|
|
66
|
+
progress('users');
|
|
67
|
+
const hashes = opts.hashesText ? indexHashes(opts.hashesText) : null;
|
|
68
|
+
const userIds = new Set();
|
|
69
|
+
const rolePerms = new Map();
|
|
70
|
+
let withHash = 0;
|
|
71
|
+
let noPassword = 0;
|
|
72
|
+
let multiRole = false;
|
|
73
|
+
const users = await listAll(http, '/api/backend/v1/user/query?include_orgs=true&order_by=CREATED_AT_ASC', 'users');
|
|
74
|
+
for (const u of users) {
|
|
75
|
+
const user = mapPropelauthUser(u);
|
|
76
|
+
if (!user) {
|
|
77
|
+
set.omit('user', 'no email or username');
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const email = user.emails?.[0]?.email;
|
|
81
|
+
const h = hashes ? (hashes.get(user.id) ?? (email ? hashes.get(email) : undefined) ?? hashes.get((0, record_set_1.str)(u.legacy_user_id) ?? '\0')) : undefined;
|
|
82
|
+
if (h) {
|
|
83
|
+
user.password = { algorithm: 'auto', hash: h };
|
|
84
|
+
withHash++;
|
|
85
|
+
}
|
|
86
|
+
if (u.has_password === false)
|
|
87
|
+
noPassword++;
|
|
88
|
+
set.add('user', user, user.id);
|
|
89
|
+
userIds.add(user.id);
|
|
90
|
+
if (u.mfa_enabled === true)
|
|
91
|
+
set.omit('mfa_factor', 'PropelAuth does not export TOTP secrets; members enrol again in Atlas');
|
|
92
|
+
const info = (0, record_set_1.isObj)(u.org_id_to_org_info) ? u.org_id_to_org_info : {};
|
|
93
|
+
for (const [orgId, raw] of Object.entries(info)) {
|
|
94
|
+
if (!(0, record_set_1.isObj)(raw))
|
|
95
|
+
continue;
|
|
96
|
+
if (!orgIds.has(orgId)) {
|
|
97
|
+
// Listed on a member but missing from the organization listing: keep the membership.
|
|
98
|
+
orgIds.add(orgId);
|
|
99
|
+
set.add('organization', (0, record_set_1.compact)({ id: orgId, name: (0, record_set_1.str)(raw.org_name) ?? orgId, slug: (0, record_set_1.str)(raw.url_safe_org_name) }), orgId);
|
|
100
|
+
}
|
|
101
|
+
const role = (0, translate_kit_1.keyOf)((0, record_set_1.str)(raw.user_role) ?? 'member');
|
|
102
|
+
if ((0, record_set_1.strs)(raw.additional_roles).length > 0)
|
|
103
|
+
multiRole = true;
|
|
104
|
+
else if (!rolePerms.has(role))
|
|
105
|
+
rolePerms.set(role, new Set((0, record_set_1.strs)(raw.user_permissions)));
|
|
106
|
+
else
|
|
107
|
+
for (const p of (0, record_set_1.strs)(raw.user_permissions))
|
|
108
|
+
rolePerms.get(role).add(p);
|
|
109
|
+
set.add('membership', { organization_id: orgId, user_id: user.id, role }, `${orgId}:${user.id}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (multiRole)
|
|
113
|
+
set.warn('Some members hold additional roles in an organization; Atlas seats each member with one role (their main role).');
|
|
114
|
+
if (noPassword > 0) {
|
|
115
|
+
set.omit('identity', "PropelAuth does not export social accounts' provider user ids: they relink by verified email on first social sign-in", noPassword);
|
|
116
|
+
}
|
|
117
|
+
if (!hashes && set.count('user') > 0) {
|
|
118
|
+
set.warn('No password hashes: PropelAuth has no password-verify API, so only a hash export from PropelAuth support can carry passwords. Pass it with --propelauth-hashes-file, or members set a password again on first sign-in.');
|
|
119
|
+
}
|
|
120
|
+
else if (hashes && withHash === 0) {
|
|
121
|
+
set.warn('The hash file matched no user (by user id, email or legacy user id): check its columns.');
|
|
122
|
+
}
|
|
123
|
+
progress('invitations');
|
|
124
|
+
const invitedRoles = new Set();
|
|
125
|
+
for (const orgId of orgIds) {
|
|
126
|
+
const invites = await optional(() => listAll(http, `/api/backend/v1/pending_org_invites?org_id=${encodeURIComponent(orgId)}`, 'invites'));
|
|
127
|
+
for (const inv of invites ?? []) {
|
|
128
|
+
const email = (0, record_set_1.str)(inv.invitee_email)?.toLowerCase();
|
|
129
|
+
if (!email)
|
|
130
|
+
continue;
|
|
131
|
+
const role = (0, translate_kit_1.keyOf)((0, record_set_1.str)(inv.role_in_org) ?? 'member');
|
|
132
|
+
invitedRoles.add(role);
|
|
133
|
+
const inviter = (0, record_set_1.str)(inv.inviter_user_id);
|
|
134
|
+
set.add('invitation', (0, record_set_1.compact)({
|
|
135
|
+
id: `${orgId}:${email}`,
|
|
136
|
+
organization_id: orgId,
|
|
137
|
+
email,
|
|
138
|
+
role,
|
|
139
|
+
status: 'pending',
|
|
140
|
+
inviter_user_id: inviter && userIds.has(inviter) ? inviter : undefined,
|
|
141
|
+
expires_at: toMs(inv.expires_at),
|
|
142
|
+
created_at: toMs(inv.created_at),
|
|
143
|
+
}), `${orgId}:${email}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const roleKeys = new Set([...rolePerms.keys(), ...invitedRoles]);
|
|
147
|
+
for (const key of roleKeys) {
|
|
148
|
+
if (BUILT_IN_ROLES.has(key))
|
|
149
|
+
continue;
|
|
150
|
+
set.add('role', (0, record_set_1.compact)({ key, name: key, scope: 'organization', permissions: [...(rolePerms.get(key) ?? [])] }), key);
|
|
151
|
+
}
|
|
152
|
+
progress('api keys');
|
|
153
|
+
const keys = (await optional(() => listAll(http, '/api/backend/v1/end_user_api_keys', 'api_keys'))) ?? [];
|
|
154
|
+
if (keys.length)
|
|
155
|
+
set.omit('api_key', 'PropelAuth never reveals end-user API key secrets: reissue them as Atlas API keys', keys.length);
|
|
156
|
+
set.manifest = { origin: authUrl, settings: { auth_url: authUrl } };
|
|
157
|
+
return set;
|
|
158
|
+
}
|
|
159
|
+
/** One PropelAuth user (user query result) → a user record. */
|
|
160
|
+
function mapPropelauthUser(u) {
|
|
161
|
+
const id = (0, record_set_1.str)(u.user_id);
|
|
162
|
+
if (!id)
|
|
163
|
+
return null;
|
|
164
|
+
const email = (0, record_set_1.str)(u.email)?.toLowerCase();
|
|
165
|
+
const username = (0, record_set_1.str)(u.username);
|
|
166
|
+
const legacy = (0, record_set_1.str)(u.legacy_user_id);
|
|
167
|
+
const user = (0, record_set_1.compact)({
|
|
168
|
+
id,
|
|
169
|
+
emails: email ? [{ email, verified: u.email_confirmed === true, primary: true }] : [],
|
|
170
|
+
username,
|
|
171
|
+
first_name: (0, record_set_1.str)(u.first_name),
|
|
172
|
+
last_name: (0, record_set_1.str)(u.last_name),
|
|
173
|
+
image_url: (0, record_set_1.str)(u.picture_url),
|
|
174
|
+
banned: u.enabled === false ? true : undefined,
|
|
175
|
+
locked: u.locked === true ? true : undefined,
|
|
176
|
+
private_metadata: (0, record_set_1.bag)({ ...((0, record_set_1.isObj)(u.metadata) ? u.metadata : {}), ...(legacy ? { propelauth_legacy_user_id: legacy } : {}) }),
|
|
177
|
+
created_at: toMs(u.created_at),
|
|
178
|
+
last_sign_in_at: toMs(u.last_active_at),
|
|
179
|
+
});
|
|
180
|
+
return user.emails?.length || user.username ? user : null;
|
|
181
|
+
}
|
|
182
|
+
/** PropelAuth timestamps are Unix seconds. */
|
|
183
|
+
function toMs(v) {
|
|
184
|
+
return typeof v === 'number' && Number.isFinite(v) && v > 0 ? (v < 1e11 ? v * 1000 : v) : undefined;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The support export, by user id, email and legacy user id (emails lowercased).
|
|
188
|
+
* Its layout is not published: CSV with a hash column and an id / email
|
|
189
|
+
* column, or NDJSON objects with the same names.
|
|
190
|
+
*/
|
|
191
|
+
function indexHashes(text) {
|
|
192
|
+
const t = text.trim();
|
|
193
|
+
const rows = t.startsWith('{') ? t.split(/\r?\n/).filter((l) => l.trim()).map((l) => JSON.parse(l)) : (0, csv_1.parseCsv)(t);
|
|
194
|
+
const out = new Map();
|
|
195
|
+
for (const r of rows) {
|
|
196
|
+
const keys = Object.keys(r);
|
|
197
|
+
const hashKey = keys.find((k) => /hash/i.test(k) && !/algo/i.test(k));
|
|
198
|
+
const hash = hashKey ? (0, record_set_1.str)(r[hashKey]) : undefined;
|
|
199
|
+
if (!hash)
|
|
200
|
+
continue;
|
|
201
|
+
for (const k of keys) {
|
|
202
|
+
const v = (0, record_set_1.str)(r[k]);
|
|
203
|
+
if (!v)
|
|
204
|
+
continue;
|
|
205
|
+
if (/^(user_?id|legacy_?user_?id)$/i.test(k))
|
|
206
|
+
out.set(v, hash);
|
|
207
|
+
else if (/^e-?mail$/i.test(k))
|
|
208
|
+
out.set(v.toLowerCase(), hash);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return out;
|
|
212
|
+
}
|
|
213
|
+
async function listAll(http, path, key) {
|
|
214
|
+
const out = [];
|
|
215
|
+
for (let n = 0; n < MAX_PAGES; n++) {
|
|
216
|
+
const sep = path.includes('?') ? '&' : '?';
|
|
217
|
+
const { body } = await http.get(`${path}${sep}page_size=${PAGE}&page_number=${n}`);
|
|
218
|
+
const rows = (0, record_set_1.objs)(body?.[key]);
|
|
219
|
+
out.push(...rows);
|
|
220
|
+
if (body?.has_more_results !== true || rows.length === 0)
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
return out;
|
|
224
|
+
}
|
|
225
|
+
/** Organizations: a GET with query parameters, or (older projects) a POST with a JSON body. */
|
|
226
|
+
async function listOrgs(http) {
|
|
227
|
+
try {
|
|
228
|
+
return await listAll(http, '/api/backend/v1/org/query?order_by=CREATED_AT_ASC', 'orgs');
|
|
229
|
+
}
|
|
230
|
+
catch (err) {
|
|
231
|
+
if (!(err instanceof vendor_http_1.VendorApiError) || ![404, 405].includes(err.status))
|
|
232
|
+
throw err;
|
|
233
|
+
}
|
|
234
|
+
const out = [];
|
|
235
|
+
for (let n = 0; n < MAX_PAGES; n++) {
|
|
236
|
+
const { body } = await http.post('/api/backend/v1/org/query', { page_size: PAGE, page_number: n, order_by: 'CREATED_AT_ASC' });
|
|
237
|
+
const rows = (0, record_set_1.objs)(body?.orgs);
|
|
238
|
+
out.push(...rows);
|
|
239
|
+
if (body?.has_more_results !== true || rows.length === 0)
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
/** A call that may be missing or not permitted for this project: `null` then. */
|
|
245
|
+
async function optional(fn) {
|
|
246
|
+
try {
|
|
247
|
+
return await fn();
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
if (err instanceof vendor_http_1.VendorApiError && [400, 403, 404, 405].includes(err.status))
|
|
251
|
+
return null;
|
|
252
|
+
throw err;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=propelauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propelauth.js","sourceRoot":"","sources":["../../../src/migrate/export/propelauth.ts"],"names":[],"mappings":";;AA+CA,4CAKC;AAED,wCAQC;AAED,4CA6HC;AAGD,8CAoBC;AAnND,0CAA4C;AAC5C,6CAAyF;AACzF,mDAAwC;AACxC,+CAA2D;AAqC3D,MAAM,GAAG,GAAG,4BAA4B,CAAC;AACzC,MAAM,IAAI,GAAG,GAAG,CAAC;AACjB,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEpD,sHAAsH;AACtH,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,MAA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QACnC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAM,2BAA2B,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;QACpI,MAAM,IAAI,GAAG,IAAA,iBAAI,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAClB,IAAI,IAAI,EAAE,gBAAgB,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM;IAClE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,iFAAiF;AACjF,KAAK,UAAU,QAAQ,CAAI,EAAoB;IAC7C,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,4BAAc,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5F,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReportStatus } from '../framework/plugin';
|
|
2
|
+
import type { ConfigBuilder } from './translate-kit';
|
|
3
|
+
/**
|
|
4
|
+
* Report lines that point at a config FILE the owner keeps (appwrite.json,
|
|
5
|
+
* nhost.toml, pb_schema.json): the 1-based line a setting sits on, so the
|
|
6
|
+
* report reads `nhost/nhost.toml:42` instead of a bare setting path.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The line of a JSON key path (`["settings", "auth", "security", "duration"]`)
|
|
10
|
+
* in a JSON text, found by walking the quoted keys in order. Undefined when a
|
|
11
|
+
* key is missing (the report then names only the setting path).
|
|
12
|
+
*/
|
|
13
|
+
export declare function jsonKeyLine(text: string, path: string[]): number | undefined;
|
|
14
|
+
/** The 1-based line of a character offset. */
|
|
15
|
+
export declare function lineAt(text: string, offset: number): number;
|
|
16
|
+
/** Add a report line with a file location (when the line is known). */
|
|
17
|
+
export declare function addAt(b: ConfigBuilder, file: string | undefined, line: number | undefined, status: ReportStatus, area: string, setting: string, note: string, atlas?: string): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.jsonKeyLine = jsonKeyLine;
|
|
4
|
+
exports.lineAt = lineAt;
|
|
5
|
+
exports.addAt = addAt;
|
|
6
|
+
/**
|
|
7
|
+
* Report lines that point at a config FILE the owner keeps (appwrite.json,
|
|
8
|
+
* nhost.toml, pb_schema.json): the 1-based line a setting sits on, so the
|
|
9
|
+
* report reads `nhost/nhost.toml:42` instead of a bare setting path.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The line of a JSON key path (`["settings", "auth", "security", "duration"]`)
|
|
13
|
+
* in a JSON text, found by walking the quoted keys in order. Undefined when a
|
|
14
|
+
* key is missing (the report then names only the setting path).
|
|
15
|
+
*/
|
|
16
|
+
function jsonKeyLine(text, path) {
|
|
17
|
+
let at = 0;
|
|
18
|
+
for (const key of path) {
|
|
19
|
+
const i = text.indexOf(`"${key}"`, at);
|
|
20
|
+
if (i < 0)
|
|
21
|
+
return undefined;
|
|
22
|
+
at = i + key.length + 2;
|
|
23
|
+
}
|
|
24
|
+
return lineAt(text, at);
|
|
25
|
+
}
|
|
26
|
+
/** The 1-based line of a character offset. */
|
|
27
|
+
function lineAt(text, offset) {
|
|
28
|
+
let line = 1;
|
|
29
|
+
for (let i = 0; i < offset && i < text.length; i++)
|
|
30
|
+
if (text.charCodeAt(i) === 10)
|
|
31
|
+
line++;
|
|
32
|
+
return line;
|
|
33
|
+
}
|
|
34
|
+
/** Add a report line with a file location (when the line is known). */
|
|
35
|
+
function addAt(b, file, line, status, area, setting, note, atlas) {
|
|
36
|
+
b.add(status, area, setting, note, atlas);
|
|
37
|
+
if (file && line) {
|
|
38
|
+
const entry = b.report[b.report.length - 1];
|
|
39
|
+
entry.file = file;
|
|
40
|
+
entry.line = line;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=source-lines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-lines.js","sourceRoot":"","sources":["../../../src/migrate/export/source-lines.ts"],"names":[],"mappings":";;AAcA,kCAQC;AAGD,wBAIC;AAGD,sBAOC;AApCD;;;;GAIG;AAEH;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAY,EAAE,IAAc;IACtD,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QAC5B,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC1B,CAAC;AAED,8CAA8C;AAC9C,SAAgB,MAAM,CAAC,IAAY,EAAE,MAAc;IACjD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE;YAAE,IAAI,EAAE,CAAC;IAC1F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uEAAuE;AACvE,SAAgB,KAAK,CAAC,CAAgB,EAAE,IAAwB,EAAE,IAAwB,EAAE,MAAoB,EAAE,IAAY,EAAE,OAAe,EAAE,IAAY,EAAE,KAAc;IAC3K,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { SsoConnectionRecord } from '@atlasauth/migrate';
|
|
2
|
+
import { RecordSet, type Obj } from './record-set';
|
|
3
|
+
export interface SamlIdp {
|
|
4
|
+
entityId: string;
|
|
5
|
+
ssoUrl?: string;
|
|
6
|
+
ssoBinding?: string;
|
|
7
|
+
certificates: string[];
|
|
8
|
+
nameIdFormat?: string;
|
|
9
|
+
wantAuthnRequestsSigned?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Every identity provider in a metadata document. Throws on a document with none. */
|
|
12
|
+
export declare function parseSamlMetadata(xml: string): SamlIdp[];
|
|
13
|
+
export interface SsoConnectionOptions {
|
|
14
|
+
name?: string;
|
|
15
|
+
domains?: string[];
|
|
16
|
+
organizationId?: string;
|
|
17
|
+
metadataUrl?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function samlConnections(xml: string, o?: SsoConnectionOptions): {
|
|
21
|
+
connections: SsoConnectionRecord[];
|
|
22
|
+
warnings: string[];
|
|
23
|
+
};
|
|
24
|
+
export interface OidcDiscovery {
|
|
25
|
+
issuer: string;
|
|
26
|
+
authorization_endpoint?: string;
|
|
27
|
+
token_endpoint?: string;
|
|
28
|
+
userinfo_endpoint?: string;
|
|
29
|
+
jwks_uri?: string;
|
|
30
|
+
scopes_supported: string[];
|
|
31
|
+
grant_types_supported: string[];
|
|
32
|
+
id_token_signing_alg_values_supported: string[];
|
|
33
|
+
}
|
|
34
|
+
/** The discovery URL for an issuer or a discovery URL. */
|
|
35
|
+
export declare function discoveryUrl(input: string): string;
|
|
36
|
+
export declare function parseDiscovery(doc: unknown, requested: string): OidcDiscovery;
|
|
37
|
+
export declare function fetchDiscovery(fetchImpl: typeof fetch, input: string): Promise<OidcDiscovery>;
|
|
38
|
+
export declare function oidcConnection(d: OidcDiscovery, o?: SsoConnectionOptions & {
|
|
39
|
+
clientId?: string;
|
|
40
|
+
clientSecret?: string;
|
|
41
|
+
}): SsoConnectionRecord;
|
|
42
|
+
/** The records an SSO-only route writes: the connection, and an organization when it belongs to one. */
|
|
43
|
+
export declare function connectionSet(connections: SsoConnectionRecord[], origin: string, organization?: {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
}): RecordSet;
|
|
47
|
+
export type { Obj };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSamlMetadata = parseSamlMetadata;
|
|
4
|
+
exports.samlConnections = samlConnections;
|
|
5
|
+
exports.discoveryUrl = discoveryUrl;
|
|
6
|
+
exports.parseDiscovery = parseDiscovery;
|
|
7
|
+
exports.fetchDiscovery = fetchDiscovery;
|
|
8
|
+
exports.oidcConnection = oidcConnection;
|
|
9
|
+
exports.connectionSet = connectionSet;
|
|
10
|
+
const record_set_1 = require("./record-set");
|
|
11
|
+
/**
|
|
12
|
+
* The SSO connections any identity provider hands over as standard documents:
|
|
13
|
+
* SAML 2.0 IdP metadata (an EntityDescriptor, or an EntitiesDescriptor
|
|
14
|
+
* federation) and an OpenID Connect discovery document. Used by the `saml` and
|
|
15
|
+
* `oidc` routes, and by every vendor whose enterprise connections are
|
|
16
|
+
* described by one of the two.
|
|
17
|
+
*/
|
|
18
|
+
// ── SAML metadata ───────────────────────────────────────────────────────────
|
|
19
|
+
const attr = (tag, name) => {
|
|
20
|
+
const m = new RegExp(`\\b${name}\\s*=\\s*("([^"]*)"|'([^']*)')`).exec(tag);
|
|
21
|
+
const v = m ? (m[2] ?? m[3]) : undefined;
|
|
22
|
+
return v === undefined ? undefined : decodeXml(v);
|
|
23
|
+
};
|
|
24
|
+
function decodeXml(s) {
|
|
25
|
+
return s.replace(/&(lt|gt|amp|quot|apos|#x[0-9a-f]+|#\d+);/gi, (_, e) => {
|
|
26
|
+
const l = e.toLowerCase();
|
|
27
|
+
if (l === 'lt')
|
|
28
|
+
return '<';
|
|
29
|
+
if (l === 'gt')
|
|
30
|
+
return '>';
|
|
31
|
+
if (l === 'amp')
|
|
32
|
+
return '&';
|
|
33
|
+
if (l === 'quot')
|
|
34
|
+
return '"';
|
|
35
|
+
if (l === 'apos')
|
|
36
|
+
return "'";
|
|
37
|
+
return String.fromCodePoint(l.startsWith('#x') ? parseInt(l.slice(2), 16) : parseInt(l.slice(1), 10));
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Elements by local name, ignoring any namespace prefix (`md:`, `ds:`, none). */
|
|
41
|
+
function elements(xml, local) {
|
|
42
|
+
const out = [];
|
|
43
|
+
const re = new RegExp(`<(?:[A-Za-z0-9_-]+:)?${local}\\b([^>]*?)(/>|>([\\s\\S]*?)</(?:[A-Za-z0-9_-]+:)?${local}\\s*>)`, 'g');
|
|
44
|
+
for (let m = re.exec(xml); m; m = re.exec(xml))
|
|
45
|
+
out.push({ tag: m[1], body: m[3] ?? '' });
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
/** Every identity provider in a metadata document. Throws on a document with none. */
|
|
49
|
+
function parseSamlMetadata(xml) {
|
|
50
|
+
if (/<!DOCTYPE|<!ENTITY/i.test(xml))
|
|
51
|
+
throw new Error('The metadata contains a DOCTYPE / ENTITY declaration, which is refused.');
|
|
52
|
+
const idps = [];
|
|
53
|
+
const scoped = elements(xml, 'EntityDescriptor');
|
|
54
|
+
// An EntityDescriptor nested in an EntitiesDescriptor is matched by the regex too; a lone one matches once.
|
|
55
|
+
for (const ed of scoped) {
|
|
56
|
+
const idp = elements(ed.body, 'IDPSSODescriptor')[0];
|
|
57
|
+
const entityId = attr(`${ed.tag}`, 'entityID');
|
|
58
|
+
if (!idp || !entityId)
|
|
59
|
+
continue;
|
|
60
|
+
const services = elements(idp.body, 'SingleSignOnService').map((s) => ({ binding: attr(s.tag, 'Binding') ?? '', location: attr(s.tag, 'Location') }));
|
|
61
|
+
const pick = services.find((s) => s.binding.endsWith('HTTP-Redirect') && s.location) ?? services.find((s) => s.binding.endsWith('HTTP-POST') && s.location) ?? services.find((s) => s.location);
|
|
62
|
+
const certs = [];
|
|
63
|
+
for (const k of elements(idp.body, 'KeyDescriptor')) {
|
|
64
|
+
if (attr(k.tag, 'use') === 'encryption')
|
|
65
|
+
continue;
|
|
66
|
+
for (const c of elements(k.body, 'X509Certificate')) {
|
|
67
|
+
const b64 = c.body.replace(/\s+/g, '');
|
|
68
|
+
if (/^[A-Za-z0-9+/=]+$/.test(b64) && !certs.includes(b64))
|
|
69
|
+
certs.push(b64);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
idps.push((0, record_set_1.compact)({
|
|
73
|
+
entityId,
|
|
74
|
+
ssoUrl: pick?.location,
|
|
75
|
+
ssoBinding: pick?.binding,
|
|
76
|
+
certificates: certs,
|
|
77
|
+
nameIdFormat: elements(idp.body, 'NameIDFormat')[0]?.body.trim() || undefined,
|
|
78
|
+
wantAuthnRequestsSigned: attr(idp.tag, 'WantAuthnRequestsSigned') === 'true' ? true : undefined,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
if (!idps.length)
|
|
82
|
+
throw new Error('No identity provider (IDPSSODescriptor) found in the SAML metadata.');
|
|
83
|
+
return idps;
|
|
84
|
+
}
|
|
85
|
+
const pem = (b64) => `-----BEGIN CERTIFICATE-----\n${b64.match(/.{1,64}/g).join('\n')}\n-----END CERTIFICATE-----\n`;
|
|
86
|
+
function samlConnections(xml, o = {}) {
|
|
87
|
+
const idps = parseSamlMetadata(xml);
|
|
88
|
+
const warnings = [];
|
|
89
|
+
const connections = idps.map((idp, i) => {
|
|
90
|
+
// compact() drops an empty certificate list.
|
|
91
|
+
const certificates = idp.certificates ?? [];
|
|
92
|
+
if (!idp.ssoUrl)
|
|
93
|
+
warnings.push(`${idp.entityId}: no SingleSignOnService in the metadata.`);
|
|
94
|
+
if (!certificates.length)
|
|
95
|
+
warnings.push(`${idp.entityId}: no signing certificate in the metadata; Atlas cannot verify its assertions.`);
|
|
96
|
+
if (certificates.length > 1)
|
|
97
|
+
warnings.push(`${idp.entityId}: ${certificates.length} signing certificates; the first is imported, add the others in the dashboard when the IdP rolls its key.`);
|
|
98
|
+
return (0, record_set_1.compact)({
|
|
99
|
+
id: o.id ?? (idps.length > 1 ? `${slug(idp.entityId)}-${i + 1}` : slug(idp.entityId)),
|
|
100
|
+
name: o.name ?? hostName(idp.entityId),
|
|
101
|
+
organization_id: o.organizationId,
|
|
102
|
+
protocol: 'saml',
|
|
103
|
+
domains: o.domains,
|
|
104
|
+
enabled: true,
|
|
105
|
+
saml: (0, record_set_1.compact)({
|
|
106
|
+
idp_entity_id: idp.entityId,
|
|
107
|
+
idp_sso_url: idp.ssoUrl,
|
|
108
|
+
idp_certificate: certificates[0] ? pem(certificates[0]) : undefined,
|
|
109
|
+
idp_metadata_url: o.metadataUrl,
|
|
110
|
+
idp_metadata_xml: idps.length === 1 ? xml : undefined,
|
|
111
|
+
}),
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
return { connections, warnings };
|
|
115
|
+
}
|
|
116
|
+
const slug = (s) => s.replace(/^https?:\/\//, '').replace(/[^A-Za-z0-9]+/g, '-').replace(/^-+|-+$/g, '').toLowerCase().slice(0, 64) || 'saml';
|
|
117
|
+
const hostName = (entityId) => {
|
|
118
|
+
try {
|
|
119
|
+
return new URL(entityId).host;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return entityId.slice(0, 64);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
/** The discovery URL for an issuer or a discovery URL. */
|
|
126
|
+
function discoveryUrl(input) {
|
|
127
|
+
const u = input.trim().replace(/\/+$/, '');
|
|
128
|
+
if (!/^https:\/\//i.test(u))
|
|
129
|
+
throw new Error('The OpenID Connect issuer must be an https:// URL.');
|
|
130
|
+
return u.endsWith('/.well-known/openid-configuration') ? u : `${u}/.well-known/openid-configuration`;
|
|
131
|
+
}
|
|
132
|
+
function parseDiscovery(doc, requested) {
|
|
133
|
+
if (!(0, record_set_1.isObj)(doc) || !(0, record_set_1.str)(doc.issuer))
|
|
134
|
+
throw new Error('The discovery document has no issuer.');
|
|
135
|
+
const issuer = (0, record_set_1.str)(doc.issuer);
|
|
136
|
+
const want = requested.replace(/\/\.well-known\/openid-configuration$/, '').replace(/\/+$/, '');
|
|
137
|
+
// RFC 8414 §3.3: the issuer in the document must equal the one it was fetched for.
|
|
138
|
+
if (issuer.replace(/\/+$/, '') !== want)
|
|
139
|
+
throw new Error(`The discovery document names issuer ${issuer}, not ${want}.`);
|
|
140
|
+
return {
|
|
141
|
+
issuer,
|
|
142
|
+
authorization_endpoint: (0, record_set_1.str)(doc.authorization_endpoint),
|
|
143
|
+
token_endpoint: (0, record_set_1.str)(doc.token_endpoint),
|
|
144
|
+
userinfo_endpoint: (0, record_set_1.str)(doc.userinfo_endpoint),
|
|
145
|
+
jwks_uri: (0, record_set_1.str)(doc.jwks_uri),
|
|
146
|
+
scopes_supported: (0, record_set_1.strs)(doc.scopes_supported),
|
|
147
|
+
grant_types_supported: (0, record_set_1.strs)(doc.grant_types_supported),
|
|
148
|
+
id_token_signing_alg_values_supported: (0, record_set_1.strs)(doc.id_token_signing_alg_values_supported),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async function fetchDiscovery(fetchImpl, input) {
|
|
152
|
+
const url = discoveryUrl(input);
|
|
153
|
+
const res = await fetchImpl(url, { headers: { accept: 'application/json' }, redirect: 'error' });
|
|
154
|
+
if (res.status !== 200)
|
|
155
|
+
throw new Error(`${url} answered ${res.status}.`);
|
|
156
|
+
return parseDiscovery(await res.json().catch(() => null), input.trim().replace(/\/\.well-known\/openid-configuration$/, ''));
|
|
157
|
+
}
|
|
158
|
+
function oidcConnection(d, o = {}) {
|
|
159
|
+
const scopes = ['openid', 'email', 'profile'].filter((s) => d.scopes_supported.length === 0 || d.scopes_supported.includes(s));
|
|
160
|
+
return (0, record_set_1.compact)({
|
|
161
|
+
id: o.id ?? slug(d.issuer),
|
|
162
|
+
name: o.name ?? hostName(d.issuer),
|
|
163
|
+
organization_id: o.organizationId,
|
|
164
|
+
protocol: 'oidc',
|
|
165
|
+
domains: o.domains,
|
|
166
|
+
enabled: true,
|
|
167
|
+
oidc: (0, record_set_1.compact)({ issuer: d.issuer, discovery_url: discoveryUrl(d.issuer), client_id: o.clientId, client_secret: o.clientSecret, scopes }),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/** The records an SSO-only route writes: the connection, and an organization when it belongs to one. */
|
|
171
|
+
function connectionSet(connections, origin, organization) {
|
|
172
|
+
const set = new record_set_1.RecordSet();
|
|
173
|
+
set.manifest = { origin };
|
|
174
|
+
if (organization)
|
|
175
|
+
set.add('organization', { id: organization.id, name: organization.name, slug: slug(organization.name) }, organization.id);
|
|
176
|
+
for (const c of connections)
|
|
177
|
+
set.add('sso_connection', organization ? { ...c, organization_id: organization.id } : c, c.id);
|
|
178
|
+
return set;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=sso-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sso-metadata.js","sourceRoot":"","sources":["../../../src/migrate/export/sso-metadata.ts"],"names":[],"mappings":";;AAiDA,8CA8BC;AAYD,0CA0BC;AAyBD,oCAIC;AAED,wCAgBC;AAED,wCAKC;AAED,wCAWC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