@m8t-stack/cli 0.2.25 → 0.2.26
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/dist/cli.js +28 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1247,7 +1247,7 @@ var init_enable_hosted_brain = __esm({
|
|
|
1247
1247
|
import { Builtins, Cli } from "clipanion";
|
|
1248
1248
|
|
|
1249
1249
|
// src/lib/package-version.ts
|
|
1250
|
-
var CLI_VERSION = "0.2.
|
|
1250
|
+
var CLI_VERSION = "0.2.26";
|
|
1251
1251
|
|
|
1252
1252
|
// src/lib/render-error.ts
|
|
1253
1253
|
init_errors();
|
|
@@ -20660,6 +20660,19 @@ async function ensureAppReg(opts) {
|
|
|
20660
20660
|
await ensureExposeAnApi(created.appId, created.id);
|
|
20661
20661
|
return { tenantId: opts.tenantId, clientId: created.appId, appObjectId: created.id };
|
|
20662
20662
|
}
|
|
20663
|
+
async function ensureGatewayRedirectUri(gatewayClientId, fqdn) {
|
|
20664
|
+
const appObjectId = await azJson(
|
|
20665
|
+
["ad", "app", "show", "--id", gatewayClientId, "--query", "id", "--output", "json"]
|
|
20666
|
+
);
|
|
20667
|
+
if (!appObjectId) {
|
|
20668
|
+
throw new LocalCliError({
|
|
20669
|
+
code: "APP_REG_OBJECT_ID_MISSING",
|
|
20670
|
+
message: `Could not resolve the object ID for app registration ${gatewayClientId}.`,
|
|
20671
|
+
hint: "You need directory read access to the app registration the gateway signs in against."
|
|
20672
|
+
});
|
|
20673
|
+
}
|
|
20674
|
+
await patchRedirectUris(appObjectId, fqdn);
|
|
20675
|
+
}
|
|
20663
20676
|
async function patchRedirectUris(appObjectId, fqdn) {
|
|
20664
20677
|
const targetUri = `https://${fqdn}`;
|
|
20665
20678
|
const existing = await azJson(
|
|
@@ -26473,6 +26486,20 @@ var BootstrapFinishCommand = class extends M8tCommand {
|
|
|
26473
26486
|
|
|
26474
26487
|
`
|
|
26475
26488
|
);
|
|
26489
|
+
try {
|
|
26490
|
+
await ensureGatewayRedirectUri(d.gatewayClientId, new URL(d.gatewayUrl).host);
|
|
26491
|
+
} catch (e) {
|
|
26492
|
+
const err = e;
|
|
26493
|
+
this.context.stderr.write(
|
|
26494
|
+
` ${colors.error("\u26A0 could not authorize sign-in for your webapp:")} ${err.message}
|
|
26495
|
+
${colors.hint(`Until this is fixed, opening ${d.gatewayUrl} will fail with AADSTS50011 (redirect URI mismatch).`)}
|
|
26496
|
+
${colors.hint("Ask a directory admin to run:")}
|
|
26497
|
+
${colors.hint(` m8t bootstrap finish --repo-root ${repoRoot} # (as an admin), or by hand:`)}
|
|
26498
|
+
${colors.hint(` az ad app update --id ${d.gatewayClientId} --set spa.redirectUris="['${d.gatewayUrl}']" # (merge, do not overwrite)`)}
|
|
26499
|
+
|
|
26500
|
+
`
|
|
26501
|
+
);
|
|
26502
|
+
}
|
|
26476
26503
|
} catch (e) {
|
|
26477
26504
|
const err = e;
|
|
26478
26505
|
this.context.stdout.write(`${colors.success("\u2705 The platform is live.")}
|