@rockcarver/frodo-cli 2.0.0-35 → 2.0.0-37

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/esm/app.js +2 -0
  3. package/esm/app.js.map +1 -1
  4. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js +3 -3
  5. package/esm/cli/admin/admin-execute-rfc7523-authz-grant-flow.js.map +1 -1
  6. package/esm/cli/admin/{admin-generate-rfc7523-authz-grant-artifacts.js → admin-generate-rfc7523-authz-grant-artefacts.js} +6 -6
  7. package/esm/cli/admin/{admin-generate-rfc7523-authz-grant-artifacts.js.map → admin-generate-rfc7523-authz-grant-artefacts.js.map} +1 -1
  8. package/esm/cli/admin/admin.js +1 -2
  9. package/esm/cli/admin/admin.js.map +1 -1
  10. package/esm/cli/config/config-delete.js +22 -0
  11. package/esm/cli/config/config-delete.js.map +1 -0
  12. package/esm/cli/config/config-describe.js +22 -0
  13. package/esm/cli/config/config-describe.js.map +1 -0
  14. package/esm/cli/{admin/admin-export-full-cloud-config.js → config/config-export.js} +3 -3
  15. package/esm/cli/config/config-export.js.map +1 -0
  16. package/esm/cli/config/config-import.js +22 -0
  17. package/esm/cli/config/config-import.js.map +1 -0
  18. package/esm/cli/config/config-list.js +22 -0
  19. package/esm/cli/config/config-list.js.map +1 -0
  20. package/esm/cli/config/config.js +20 -0
  21. package/esm/cli/config/config.js.map +1 -0
  22. package/esm/ops/AdminOps.js +23 -125
  23. package/esm/ops/AdminOps.js.map +1 -1
  24. package/esm/ops/ConfigOps.js +128 -0
  25. package/esm/ops/ConfigOps.js.map +1 -0
  26. package/esm/ops/IdmOps.js +6 -3
  27. package/esm/ops/IdmOps.js.map +1 -1
  28. package/package.json +2 -2
  29. package/esm/cli/admin/admin-export-full-cloud-config.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.0.0-36] - 2023-12-01
11
+
12
+ ## [2.0.0-35] - 2023-11-30
13
+
10
14
  ## [2.0.0-34] - 2023-11-29
11
15
 
12
16
  ## [2.0.0-33] - 2023-11-26
@@ -1435,7 +1439,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1435
1439
  - Fixed problem with adding connection profiles
1436
1440
  - Miscellaneous bug fixes
1437
1441
 
1438
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-34...HEAD
1442
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-36...HEAD
1443
+
1444
+ [2.0.0-36]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-35...v2.0.0-36
1445
+
1446
+ [2.0.0-35]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-34...v2.0.0-35
1439
1447
 
1440
1448
  [2.0.0-34]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-33...v2.0.0-34
1441
1449
 
package/esm/app.js CHANGED
@@ -7,6 +7,7 @@ import agent from './cli/agent/agent';
7
7
  import app from './cli/app/app';
8
8
  import authn from './cli/authn/authn';
9
9
  import authz from './cli/authz/authz';
10
+ import config from './cli/config/config';
10
11
  import conn from './cli/conn/conn';
11
12
  import email from './cli/email/email';
12
13
  import esv from './cli/esv/esv';
@@ -43,6 +44,7 @@ const {
43
44
  program.addCommand(authn());
44
45
  program.addCommand(authz());
45
46
  program.addCommand(app());
47
+ program.addCommand(config());
46
48
  program.addCommand(conn());
47
49
  program.addCommand(email());
48
50
  program.addCommand(esv());
package/esm/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","names":["frodo","Command","admin","agent","app","authn","authz","conn","email","esv","idm","idp","info","journey","log","oauth","realm","saml","script","service","shell","theme","printMessage","getVersions","initConnectionProfiles","initTokenCache","cache","program","version","addCommand","showHelpAfterError","enablePositionalOptions","parse","e","process","exitCode","stack"],"sources":["../src/app.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Command } from 'commander';\n\n// commands\nimport admin from './cli/admin/admin';\nimport agent from './cli/agent/agent';\nimport app from './cli/app/app';\nimport authn from './cli/authn/authn';\nimport authz from './cli/authz/authz';\nimport conn from './cli/conn/conn';\nimport email from './cli/email/email';\nimport esv from './cli/esv/esv';\nimport idm from './cli/idm/idm';\nimport idp from './cli/idp/idp';\nimport info from './cli/info/info';\nimport journey from './cli/journey/journey';\nimport log from './cli/log/log';\nimport oauth from './cli/oauth/oauth';\nimport realm from './cli/realm/realm';\nimport saml from './cli/saml/saml';\nimport script from './cli/script/script';\nimport service from './cli/service/service';\nimport shell from './cli/shell/shell';\n// enable sample command template.\n// import something from './cli/_template/something';\nimport theme from './cli/theme/theme';\nimport { printMessage } from './utils/Console';\nimport { getVersions } from './utils/Version';\n\nconst { initConnectionProfiles } = frodo.conn;\nconst { initTokenCache } = frodo.cache;\n\n(async () => {\n try {\n const program = new Command('frodo').version(\n await getVersions(false),\n '-v, --version'\n );\n\n printMessage(await getVersions(true), 'text', false);\n\n await initConnectionProfiles();\n await initTokenCache();\n\n program.addCommand(admin());\n program.addCommand(agent());\n program.addCommand(authn());\n program.addCommand(authz());\n program.addCommand(app());\n program.addCommand(conn());\n program.addCommand(email());\n program.addCommand(esv());\n program.addCommand(idm());\n program.addCommand(idp());\n program.addCommand(info());\n program.addCommand(journey());\n program.addCommand(log());\n program.addCommand(oauth());\n program.addCommand(realm());\n program.addCommand(saml());\n program.addCommand(script());\n program.addCommand(service());\n program.addCommand(shell());\n program.addCommand(theme());\n // enable sample command template.\n // program.addCommand(something());\n\n program.showHelpAfterError();\n program.enablePositionalOptions();\n program.parse();\n } catch (e) {\n process.exitCode = 1;\n printMessage(`ERROR: exception running frodo - ${e}`, 'error');\n printMessage(e.stack, 'error');\n }\n})();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,O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,CAACK,KAAK,CAAC,CAAC;EACjB,CAAC,CAAC,OAAOC,CAAC,EAAE;IACVC,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpBb,YAAY,CAAE,oCAAmCW,CAAE,EAAC,EAAE,OAAO,CAAC;IAC9DX,YAAY,CAACW,CAAC,CAACG,KAAK,EAAE,OAAO,CAAC;EAChC;AACF,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"app.js","names":["frodo","Command","admin","agent","app","authn","authz","config","conn","email","esv","idm","idp","info","journey","log","oauth","realm","saml","script","service","shell","theme","printMessage","getVersions","initConnectionProfiles","initTokenCache","cache","program","version","addCommand","showHelpAfterError","enablePositionalOptions","parse","e","process","exitCode","stack"],"sources":["../src/app.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Command } from 'commander';\n\n// commands\nimport admin from './cli/admin/admin';\nimport agent from './cli/agent/agent';\nimport app from './cli/app/app';\nimport authn from './cli/authn/authn';\nimport authz from './cli/authz/authz';\nimport config from './cli/config/config';\nimport conn from './cli/conn/conn';\nimport email from './cli/email/email';\nimport esv from './cli/esv/esv';\nimport idm from './cli/idm/idm';\nimport idp from './cli/idp/idp';\nimport info from './cli/info/info';\nimport journey from './cli/journey/journey';\nimport log from './cli/log/log';\nimport oauth from './cli/oauth/oauth';\nimport realm from './cli/realm/realm';\nimport saml from './cli/saml/saml';\nimport script from './cli/script/script';\nimport service from './cli/service/service';\nimport shell from './cli/shell/shell';\n// enable sample command template.\n// import something from './cli/_template/something';\nimport theme from './cli/theme/theme';\nimport { printMessage } from './utils/Console';\nimport { getVersions } from './utils/Version';\n\nconst { initConnectionProfiles } = frodo.conn;\nconst { initTokenCache } = frodo.cache;\n\n(async () => {\n try {\n const program = new Command('frodo').version(\n await getVersions(false),\n '-v, --version'\n );\n\n printMessage(await getVersions(true), 'text', false);\n\n await initConnectionProfiles();\n await initTokenCache();\n\n program.addCommand(admin());\n program.addCommand(agent());\n program.addCommand(authn());\n program.addCommand(authz());\n program.addCommand(app());\n program.addCommand(config());\n program.addCommand(conn());\n program.addCommand(email());\n program.addCommand(esv());\n program.addCommand(idm());\n program.addCommand(idp());\n program.addCommand(info());\n program.addCommand(journey());\n program.addCommand(log());\n program.addCommand(oauth());\n program.addCommand(realm());\n program.addCommand(saml());\n program.addCommand(script());\n program.addCommand(service());\n program.addCommand(shell());\n program.addCommand(theme());\n // enable sample command template.\n // program.addCommand(something());\n\n program.showHelpAfterError();\n program.enablePositionalOptions();\n program.parse();\n } catch (e) {\n process.exitCode = 1;\n printMessage(`ERROR: exception running frodo - ${e}`, 'error');\n printMessage(e.stack, 'error');\n }\n})();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,OAAO,QAAQ,WAAW;;AAEnC;AACA,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,OAAOC,GAAG,MAAM,eAAe;AAC/B,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,KAAK,MAAM,mBAAmB;AACrC,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,OAAOC,KAAK,MAAM,mBAAmB;AACrC;AACA;AACA,OAAOC,KAAK,MAAM,mBAAmB;AACrC,SAASC,YAAY,QAAQ,iBAAiB;AAC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AAO,CAACE,UAAU,CAACf,GAAG,CAAC,CAAC,CAAC;IACzBa,OAAO,CAACE,UAAU,CAACd,KAAK,CAAC,CAAC,CAAC;IAC3BY,OAAO,CAACE,UAAU,CAACb,KAAK,CAAC,CAAC,CAAC;IAC3BW,OAAO,CAACE,UAAU,CAACZ,IAAI,CAAC,CAAC,CAAC;IAC1BU,OAAO,CAACE,UAAU,CAACX,MAAM,CAAC,CAAC,CAAC;IAC5BS,OAAO,CAACE,UAAU,CAACV,OAAO,CAAC,CAAC,CAAC;IAC7BQ,OAAO,CAACE,UAAU,CAACT,KAAK,CAAC,CAAC,CAAC;IAC3BO,OAAO,CAACE,UAAU,CAACR,KAAK,CAAC,CAAC,CAAC;IAC3B;IACA;;IAEAM,OAAO,CAACG,kBAAkB,CAAC,CAAC;IAC5BH,OAAO,CAACI,uBAAuB,CAAC,CAAC;IACjCJ,OAAO,CAACK,KAAK,CAAC,CAAC;EACjB,CAAC,CAAC,OAAOC,CAAC,EAAE;IACVC,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpBb,YAAY,CAAE,oCAAmCW,CAAE,EAAC,EAAE,OAAO,CAAC;IAC9DX,YAAY,CAACW,CAAC,CAACG,KAAK,EAAE,OAAO,CAAC;EAChC;AACF,CAAC,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { frodo, state } from '@rockcarver/frodo-lib';
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import fs from 'fs';
4
4
  import { v4 as uuidv4 } from 'uuid';
@@ -10,12 +10,12 @@ const {
10
10
  getTokens
11
11
  } = frodo.login;
12
12
  const program = new FrodoCommand('frodo admin execute-rfc7523-authz-grant-flow');
13
- program.description('Execute RFC7523 authorization grant flow.').addOption(new Option('--client-id [id]', 'Client id.')).addOption(new Option('--jwk-file [file]', 'Path to JSON Web Key (JWK) file containing private key.')).addOption(new Option('--sub [subject]', 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm.')).addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.')).addOption(new Option('--scope [scope]', 'Space-delimited list of scopes.').default('openid fr:am:* fr:idm:*')).addOption(new Option('--json', 'Output in JSON format.')).addHelpText('after', `Usage Examples:\n` + ` If you used frodo to create the RFC7523 configuration (see 'Related Commands' below), then you can test your configuration with minimal input and frodo will locate the missing parameters. The command below returns access token and identity token:\n` + ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 ${s.amBaseUrl}\n`['brightCyan'] + ` Same as above but output raw json:\n` + ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --json ${s.amBaseUrl}'\n`['brightCyan'] + ` Same as first command above but explicitly provide all parameters:\n` + ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}'\n`['brightCyan'] + `\nRelated Commands:\n` + ` Run ${'frodo admin generate-rfc7523-authz-grant-artifacts --help'['brightCyan']} to see how to create the required configuration artifacts for ${'frodo admin execute-rfc7523-authz-grant-flow'['brightCyan']}:\n`).action(
13
+ program.description('Execute RFC7523 authorization grant flow.').addOption(new Option('--client-id [id]', 'Client id.')).addOption(new Option('--jwk-file [file]', 'Path to JSON Web Key (JWK) file containing private key.')).addOption(new Option('--sub [subject]', 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm.')).addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.')).addOption(new Option('--scope [scope]', 'Space-delimited list of scopes.').default('openid fr:am:* fr:idm:*')).addOption(new Option('--json', 'Output in JSON format.')).addHelpText('after', `Usage Examples:\n` + ` If you used frodo to create the RFC7523 configuration (see 'Related Commands' below), then you can test your configuration with minimal input and frodo will locate the missing parameters. The command below returns access token and identity token:\n` + ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 ${s.amBaseUrl}\n`['brightCyan'] + ` Same as above but output raw json:\n` + ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --json ${s.amBaseUrl}'\n`['brightCyan'] + ` Same as first command above but explicitly provide all parameters:\n` + ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}'\n`['brightCyan'] + `\nRelated Commands:\n` + ` Run ${'frodo admin generate-rfc7523-authz-grant-artefacts --help'['brightCyan']} to see how to create the required configuration artefacts for ${'frodo admin execute-rfc7523-authz-grant-flow'['brightCyan']}:\n`).action(
14
14
  // implement command logic inside action handler
15
15
  async (host, realm, user, password, options, command) => {
16
16
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
17
17
  if (await getTokens()) {
18
- printMessage(`Generating RFC7523 authorization grant artifacts in realm "${state.getRealm()}"...`);
18
+ printMessage(`Executing RFC7523 authorization grant flow...`);
19
19
  let clientId = uuidv4();
20
20
  if (options.clientId) {
21
21
  clientId = options.clientId;
@@ -1 +1 @@
1
- {"version":3,"file":"admin-execute-rfc7523-authz-grant-flow.js","names":["frodo","state","Option","fs","v4","uuidv4","s","executeRfc7523AuthZGrantFlow","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-execute-rfc7523-authz-grant-flow.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { executeRfc7523AuthZGrantFlow } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin execute-rfc7523-authz-grant-flow'\n);\n\nprogram\n .description('Execute RFC7523 authorization grant flow.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` If you used frodo to create the RFC7523 configuration (see 'Related Commands' below), then you can test your configuration with minimal input and frodo will locate the missing parameters. The command below returns access token and identity token:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but output raw json:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n ` Same as first command above but explicitly provide all parameters:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${\n 'frodo admin generate-rfc7523-authz-grant-artifacts --help'[\n 'brightCyan'\n ]\n } to see how to create the required configuration artifacts for ${\n 'frodo admin execute-rfc7523-authz-grant-flow'['brightCyan']\n }:\\n`\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n printMessage(\n `Generating RFC7523 authorization grant artifacts in realm \"${state.getRealm()}\"...`\n );\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await executeRfc7523AuthZGrantFlow(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAC9B,8CACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,2CAA2C,CAAC,CACxDC,SAAS,CAAC,IAAIZ,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,iBAAiB,EACjB,kFACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,C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AAI,CAACI,QAAQ,CAAC,CAAC,CAAC;MACnC,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd5B,YAAY,CACT,+BAA8Be,OAAO,CAACO,OAAQ,KAAIM,KAAK,CAACC,OAAQ,EAAC,EAClE,OACF,CAAC;MACH;IACF;IACA,MAAMC,OAAO,GAAG,MAAM/B,4BAA4B,CAChDoB,QAAQ,EACRJ,OAAO,CAACgB,GAAG,EACXX,GAAG,EACHL,OAAO,CAACiB,GAAG,EACXjB,OAAO,CAACkB,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,EACxBnB,OAAO,CAACoB,IACV,CAAC;IACD,IAAI,CAACL,OAAO,EAAEM,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHjC,OAAO,CAACsB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"admin-execute-rfc7523-authz-grant-flow.js","names":["frodo","Option","fs","v4","uuidv4","s","executeRfc7523AuthZGrantFlow","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-execute-rfc7523-authz-grant-flow.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { executeRfc7523AuthZGrantFlow } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin execute-rfc7523-authz-grant-flow'\n);\n\nprogram\n .description('Execute RFC7523 authorization grant flow.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` If you used frodo to create the RFC7523 configuration (see 'Related Commands' below), then you can test your configuration with minimal input and frodo will locate the missing parameters. The command below returns access token and identity token:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but output raw json:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n ` Same as first command above but explicitly provide all parameters:\\n` +\n ` $ frodo admin execute-rfc7523-authz-grant-flow --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}'\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${\n 'frodo admin generate-rfc7523-authz-grant-artefacts --help'[\n 'brightCyan'\n ]\n } to see how to create the required configuration artefacts for ${\n 'frodo admin execute-rfc7523-authz-grant-flow'['brightCyan']\n }:\\n`\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n printMessage(`Executing RFC7523 authorization grant flow...`);\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await executeRfc7523AuthZGrantFlow(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAE7C,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,4BAA4B,QAAQ,uBAAuB;AACpE,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGT,KAAK,CAACU,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAC9B,8CACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,2CAA2C,CAAC,CACxDC,SAAS,CAAC,IAAIZ,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,iBAAiB,EACjB,kFACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EY,SAAS,CACR,IAAIZ,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAACa,OAAO,CACtE,yBACF,CACF,CAAC,CACAD,SAAS,CA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AO,GAAG,MAAM9B,4BAA4B,CAChDmB,QAAQ,EACRH,OAAO,CAACe,GAAG,EACXX,GAAG,EACHJ,OAAO,CAACgB,GAAG,EACXhB,OAAO,CAACiB,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,EACxBlB,OAAO,CAACmB,IACV,CAAC;IACD,IAAI,CAACL,OAAO,EAAEM,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHhC,OAAO,CAACqB,KAAK,CAAC,CAAC"}
@@ -3,19 +3,19 @@ import { Option } from 'commander';
3
3
  import fs from 'fs';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
5
  import * as s from '../../help/SampleData';
6
- import { generateRfc7523AuthZGrantArtifacts } from '../../ops/AdminOps.js';
6
+ import { generateRfc7523AuthZGrantArtefacts } from '../../ops/AdminOps.js';
7
7
  import { printMessage } from '../../utils/Console.js';
8
8
  import { FrodoCommand } from '../FrodoCommand.js';
9
9
  const {
10
10
  getTokens
11
11
  } = frodo.login;
12
- const program = new FrodoCommand('frodo admin generate-rfc7523-authz-grant-artifacts');
13
- program.description('Generate RFC7523 authorization grant artifacts.').addOption(new Option('--client-id [id]', 'Client id.')).addOption(new Option('--jwk-file [file]', 'Path to JSON Web Key (JWK) file containing private key.')).addOption(new Option('--sub [subject]', 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm. Restricts the trusted issuer to only this subject by adding the identifier to the list of allowed subjects. Omitting this option allows the trusted issuer to request tokens for any realm user without restrictions.')).addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.')).addOption(new Option('--scope [scope]', 'Space-delimited list of scopes.').default('openid fr:am:* fr:idm:*')).addOption(new Option('--no-save', 'Do not save artifacts in AM and to file By default this command creates a fully configured oauth2 client and trusted issuer in AM and saves the generated JWK (private key) and JWKS (public key set) to files.')).addOption(new Option('--json', 'Output in JSON format.')).addHelpText('after', `Usage Examples:\n` + ` Generate, output to console, and save all the artifacts for an RFC7523 authorization grant flow configuration limited to one particular subject:\n` + ` - Fully configured OAuth2 client - named '<clientId>'\n` + ` - Fully configured OAuth2 trusted issuer - named '<clientId>-issuer'\n` + ` - Private Key as Json Web Key (JWK) - named '<clientId>_private.jwk.json'\n` + ` - Public Key as Json Web Key Set (JWKS) - named '<clientId>_public.jwks.json'\n` + ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d ${s.amBaseUrl}\n`['brightCyan'] + ` Same as above but use an existing JWK file instead of creating one.\n` + ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}\n`['brightCyan'] + ` Generate and output to console all the artifacts for an RFC7523 authorization grant flow configuration but do not create any configuration or files.\n` + ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --no-save ${s.amBaseUrl}\n`['brightCyan'] + ` Generate and output in json format all the artifacts for an RFC7523 authorization grant flow configuration.\n` + ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --json ${s.amBaseUrl}\n`['brightCyan'] + `\nRelated Commands:\n` + ` Run ${'frodo admin execute-rfc7523-authz-grant-flow --help'['brightCyan']} to see how to test your configuration created with ${'frodo admin generate-rfc7523-authz-grant-artifacts'['brightCyan']}:\n`).action(
12
+ const program = new FrodoCommand('frodo admin generate-rfc7523-authz-grant-artefacts');
13
+ program.description('Generate RFC7523 authorization grant artefacts.').addOption(new Option('--client-id [id]', 'Client id.')).addOption(new Option('--jwk-file [file]', 'Path to JSON Web Key (JWK) file containing private key.')).addOption(new Option('--sub [subject]', 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm. Restricts the trusted issuer to only this subject by adding the identifier to the list of allowed subjects. Omitting this option allows the trusted issuer to request tokens for any realm user without restrictions.')).addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.')).addOption(new Option('--scope [scope]', 'Space-delimited list of scopes.').default('openid fr:am:* fr:idm:*')).addOption(new Option('--no-save', 'Do not save artefacts in AM and to file By default this command creates a fully configured oauth2 client and trusted issuer in AM and saves the generated JWK (private key) and JWKS (public key set) to files.')).addOption(new Option('--json', 'Output in JSON format.')).addHelpText('after', `Usage Examples:\n` + ` Generate, output to console, and save all the artefacts for an RFC7523 authorization grant flow configuration limited to one particular subject:\n` + ` - Fully configured OAuth2 client - named '<clientId>'\n` + ` - Fully configured OAuth2 trusted issuer - named '<clientId>-issuer'\n` + ` - Private Key as Json Web Key (JWK) - named '<clientId>_private.jwk.json'\n` + ` - Public Key as Json Web Key Set (JWKS) - named '<clientId>_public.jwks.json'\n` + ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d ${s.amBaseUrl}\n`['brightCyan'] + ` Same as above but use an existing JWK file instead of creating one.\n` + ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}\n`['brightCyan'] + ` Generate and output to console all the artefacts for an RFC7523 authorization grant flow configuration but do not create any configuration or files.\n` + ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --no-save ${s.amBaseUrl}\n`['brightCyan'] + ` Generate and output in json format all the artefacts for an RFC7523 authorization grant flow configuration.\n` + ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --json ${s.amBaseUrl}\n`['brightCyan'] + `\nRelated Commands:\n` + ` Run ${'frodo admin execute-rfc7523-authz-grant-flow --help'['brightCyan']} to see how to test your configuration created with ${'frodo admin generate-rfc7523-authz-grant-artefacts'['brightCyan']}:\n`).action(
14
14
  // implement command logic inside action handler
15
15
  async (host, realm, user, password, options, command) => {
16
16
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
17
17
  if (await getTokens()) {
18
- printMessage(`Generating RFC7523 authorization grant artifacts in realm "${state.getRealm()}"...`);
18
+ printMessage(`Generating RFC7523 authorization grant artefacts in realm "${state.getRealm()}"...`);
19
19
  let clientId = uuidv4();
20
20
  if (options.clientId) {
21
21
  clientId = options.clientId;
@@ -29,7 +29,7 @@ async (host, realm, user, password, options, command) => {
29
29
  printMessage(`Error parsing JWK from file ${options.jwkFile}: ${error.message}`, 'error');
30
30
  }
31
31
  }
32
- const outcome = await generateRfc7523AuthZGrantArtifacts(clientId, options.iss, jwk, options.sub, options.scope.split(' '), {
32
+ const outcome = await generateRfc7523AuthZGrantArtefacts(clientId, options.iss, jwk, options.sub, options.scope.split(' '), {
33
33
  save: options.save
34
34
  }, options.json);
35
35
  if (!outcome) process.exitCode = 1;
@@ -41,4 +41,4 @@ async (host, realm, user, password, options, command) => {
41
41
  );
42
42
 
43
43
  program.parse();
44
- //# sourceMappingURL=admin-generate-rfc7523-authz-grant-artifacts.js.map
44
+ //# sourceMappingURL=admin-generate-rfc7523-authz-grant-artefacts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin-generate-rfc7523-authz-grant-artifacts.js","names":["frodo","state","Option","fs","v4","uuidv4","s","generateRfc7523AuthZGrantArtifacts","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","save","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-generate-rfc7523-authz-grant-artifacts.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { generateRfc7523AuthZGrantArtifacts } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin generate-rfc7523-authz-grant-artifacts'\n);\n\nprogram\n .description('Generate RFC7523 authorization grant artifacts.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm. Restricts the trusted issuer to only this subject by adding the identifier to the list of allowed subjects. Omitting this option allows the trusted issuer to request tokens for any realm user without restrictions.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(\n new Option(\n '--no-save',\n 'Do not save artifacts in AM and to file By default this command creates a fully configured oauth2 client and trusted issuer in AM and saves the generated JWK (private key) and JWKS (public key set) to files.'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` Generate, output to console, and save all the artifacts for an RFC7523 authorization grant flow configuration limited to one particular subject:\\n` +\n ` - Fully configured OAuth2 client - named '<clientId>'\\n` +\n ` - Fully configured OAuth2 trusted issuer - named '<clientId>-issuer'\\n` +\n ` - Private Key as Json Web Key (JWK) - named '<clientId>_private.jwk.json'\\n` +\n ` - Public Key as Json Web Key Set (JWKS) - named '<clientId>_public.jwks.json'\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but use an existing JWK file instead of creating one.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output to console all the artifacts for an RFC7523 authorization grant flow configuration but do not create any configuration or files.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --no-save ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output in json format all the artifacts for an RFC7523 authorization grant flow configuration.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artifacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${\n 'frodo admin execute-rfc7523-authz-grant-flow --help'['brightCyan']\n } to see how to test your configuration created with ${\n 'frodo admin generate-rfc7523-authz-grant-artifacts'['brightCyan']\n }:\\n`\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n printMessage(\n `Generating RFC7523 authorization grant artifacts in realm \"${state.getRealm()}\"...`\n );\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await generateRfc7523AuthZGrantArtifacts(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n { save: options.save },\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,EAAE,MAAM,IAAI;AACnB,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AAEnC,OAAO,KAAKC,CAAC,MAAM,uBAAuB;AAC1C,SAASC,kCAAkC,QAAQ,uBAAuB;AAC1E,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAM;EAAEC;AAAU,CAAC,GAAGV,KAAK,CAACW,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAC9B,oDACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,iDAAiD,CAAC,CAC9DC,SAAS,CAAC,IAAIZ,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDY,SAAS,CACR,IAAIZ,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAY,SAAS,CACR,IAAIZ,MAAM,CACR,iBAAiB,EACjB,wSACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EY,SAAS,CACR,IAAIZ,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAACa,OAAO,CACtE,yBACF,CACF,CAAC,CACAD,SAAS,CACR,IAAIZ,MAAM,CACR,WAAW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KAAK,CAACH,IAAI,CAACI,QAAQ,CAAC,CAAC,CAAC;MACnC,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd5B,YAAY,CACT,+BAA8Be,OAAO,CAACO,OAAQ,KAAIM,KAAK,CAACC,OAAQ,EAAC,EAClE,OACF,CAAC;MACH;IACF;IACA,MAAMC,OAAO,GAAG,MAAM/B,kCAAkC,CACtDoB,QAAQ,EACRJ,OAAO,CAACgB,GAAG,EACXX,GAAG,EACHL,OAAO,CAACiB,GAAG,EACXjB,OAAO,CAACkB,KAAK,CAACC,KAAK,CAAC,GAAG,CAAC,EACxB;MAAEC,IAAI,EAAEpB,OAAO,CAACoB;IAAK,CAAC,EACtBpB,OAAO,CAACqB,IACV,CAAC;IACD,IAAI,CAACN,OAAO,EAAEO,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHlC,OAAO,CAACsB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"admin-generate-rfc7523-authz-grant-artefacts.js","names":["frodo","state","Option","fs","v4","uuidv4","s","generateRfc7523AuthZGrantArtefacts","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","addHelpText","amBaseUrl","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","getRealm","clientId","jwk","undefined","jwkFile","data","readFileSync","JSON","parse","toString","error","message","outcome","iss","sub","scope","split","save","json","process","exitCode"],"sources":["../../../src/cli/admin/admin-generate-rfc7523-authz-grant-artefacts.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { JwkRsa } from '@rockcarver/frodo-lib/types/ops/JoseOps.js';\nimport { Option } from 'commander';\nimport fs from 'fs';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport * as s from '../../help/SampleData';\nimport { generateRfc7523AuthZGrantArtefacts } from '../../ops/AdminOps.js';\nimport { printMessage } from '../../utils/Console.js';\nimport { FrodoCommand } from '../FrodoCommand.js';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand(\n 'frodo admin generate-rfc7523-authz-grant-artefacts'\n);\n\nprogram\n .description('Generate RFC7523 authorization grant artefacts.')\n .addOption(new Option('--client-id [id]', 'Client id.'))\n .addOption(\n new Option(\n '--jwk-file [file]',\n 'Path to JSON Web Key (JWK) file containing private key.'\n )\n )\n .addOption(\n new Option(\n '--sub [subject]',\n 'Subject identifier, typically a UUID. Must resolve to a valid user in the realm. Restricts the trusted issuer to only this subject by adding the identifier to the list of allowed subjects. Omitting this option allows the trusted issuer to request tokens for any realm user without restrictions.'\n )\n )\n .addOption(new Option('--iss [issuer]', 'Trusted issuer, typically a URL.'))\n .addOption(\n new Option('--scope [scope]', 'Space-delimited list of scopes.').default(\n 'openid fr:am:* fr:idm:*'\n )\n )\n .addOption(\n new Option(\n '--no-save',\n 'Do not save artefacts in AM and to file By default this command creates a fully configured oauth2 client and trusted issuer in AM and saves the generated JWK (private key) and JWKS (public key set) to files.'\n )\n )\n .addOption(new Option('--json', 'Output in JSON format.'))\n .addHelpText(\n 'after',\n `Usage Examples:\\n` +\n ` Generate, output to console, and save all the artefacts for an RFC7523 authorization grant flow configuration limited to one particular subject:\\n` +\n ` - Fully configured OAuth2 client - named '<clientId>'\\n` +\n ` - Fully configured OAuth2 trusted issuer - named '<clientId>-issuer'\\n` +\n ` - Private Key as Json Web Key (JWK) - named '<clientId>_private.jwk.json'\\n` +\n ` - Public Key as Json Web Key Set (JWKS) - named '<clientId>_public.jwks.json'\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Same as above but use an existing JWK file instead of creating one.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --jwk-file rfc7523-client1_private.jwk.json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output to console all the artefacts for an RFC7523 authorization grant flow configuration but do not create any configuration or files.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --no-save ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n ` Generate and output in json format all the artefacts for an RFC7523 authorization grant flow configuration.\\n` +\n ` $ frodo admin generate-rfc7523-authz-grant-artefacts --client-id rfc7523-client1 --iss https://my-issuer.com/issuer --sub 146c2230-9448-4442-b86d-eb4a81a0121d --json ${s.amBaseUrl}\\n`[\n 'brightCyan'\n ] +\n `\\nRelated Commands:\\n` +\n ` Run ${\n 'frodo admin execute-rfc7523-authz-grant-flow --help'['brightCyan']\n } to see how to test your configuration created with ${\n 'frodo admin generate-rfc7523-authz-grant-artefacts'['brightCyan']\n }:\\n`\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n printMessage(\n `Generating RFC7523 authorization grant artefacts in realm \"${state.getRealm()}\"...`\n );\n let clientId = uuidv4();\n if (options.clientId) {\n clientId = options.clientId;\n }\n let jwk: JwkRsa = undefined;\n if (options.jwkFile) {\n try {\n const data = fs.readFileSync(options.jwkFile);\n jwk = JSON.parse(data.toString());\n } catch (error) {\n printMessage(\n `Error parsing JWK from file ${options.jwkFile}: ${error.message}`,\n 'error'\n );\n }\n }\n const outcome = await generateRfc7523AuthZGrantArtefacts(\n clientId,\n options.iss,\n jwk,\n options.sub,\n options.scope.split(' '),\n { save: options.save },\n options.json\n );\n if (!outcome) process.exitCode = 1;\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAA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,CAAC,EACxB;MAAEC,IAAI,EAAEpB,OAAO,CAACoB;IAAK,CAAC,EACtBpB,OAAO,CAACqB,IACV,CAAC;IACD,IAAI,CAACN,OAAO,EAAEO,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHlC,OAAO,CAACsB,KAAK,CAAC,CAAC"}
@@ -6,11 +6,10 @@ export default function setup() {
6
6
  const program = new FrodoStubCommand('admin').description('Platform admin tasks.').executableDir(__dirname);
7
7
  program.command('federation', 'Manage admin federation configuration.');
8
8
  program.command('create-oauth2-client-with-admin-privileges', 'Create an oauth2 client with admin privileges.');
9
- program.command('generate-rfc7523-authz-grant-artifacts', 'Generate RFC7523 authorization grant artifacts.');
9
+ program.command('generate-rfc7523-authz-grant-artefacts', 'Generate RFC7523 authorization grant artefacts.');
10
10
  program.command('execute-rfc7523-authz-grant-flow', 'Execute RFC7523 authorization grant flow.');
11
11
  program.command('get-access-token', 'Get an access token using client credentials grant type.');
12
12
  program.command('list-oauth2-clients-with-admin-privileges', 'List oauth2 clients with admin privileges.');
13
- program.command('export-full-cloud-config', 'Export full cloud configuration for all ops that currently support export.');
14
13
  program.command('grant-oauth2-client-admin-privileges', 'Grant an oauth2 client admin privileges.');
15
14
  program.command('revoke-oauth2-client-admin-privileges', 'Revoke admin privileges from an oauth2 client.');
16
15
  program.command('list-oauth2-clients-with-custom-privileges', 'List oauth2 clients with custom privileges.');
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["../../../src/cli/admin/admin.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('admin')\n .description('Platform admin tasks.')\n .executableDir(__dirname);\n\n program.command('federation', 'Manage admin federation configuration.');\n\n program.command(\n 'create-oauth2-client-with-admin-privileges',\n 'Create an oauth2 client with admin privileges.'\n );\n\n program.command(\n 'generate-rfc7523-authz-grant-artifacts',\n 'Generate RFC7523 authorization grant artifacts.'\n );\n\n program.command(\n 'execute-rfc7523-authz-grant-flow',\n 'Execute RFC7523 authorization grant flow.'\n );\n\n program.command(\n 'get-access-token',\n 'Get an access token using client credentials grant type.'\n );\n\n program.command(\n 'list-oauth2-clients-with-admin-privileges',\n 'List oauth2 clients with admin privileges.'\n );\n\n program.command(\n 'export-full-cloud-config',\n 'Export full cloud configuration for all ops that currently support export.'\n );\n\n program.command(\n 'grant-oauth2-client-admin-privileges',\n 'Grant an oauth2 client admin privileges.'\n );\n\n program.command(\n 'revoke-oauth2-client-admin-privileges',\n 'Revoke admin privileges from an oauth2 client.'\n );\n\n program.command(\n 'list-oauth2-clients-with-custom-privileges',\n 'List oauth2 clients with custom privileges.'\n );\n\n program.command(\n 'list-static-user-mappings',\n 'List all subjects of static user mappings that are not oauth2 clients.'\n );\n\n program.command(\n 'remove-static-user-mapping',\n \"Remove a subject's static user mapping.\"\n );\n\n program.command(\n 'add-autoid-static-user-mapping',\n 'Add AutoId static user mapping to enable dashboards and other AutoId-based functionality.'\n );\n\n program.command(\n 'hide-generic-extension-attributes',\n 'Hide generic extension attributes.'\n );\n\n program.command(\n 'show-generic-extension-attributes',\n 'Show generic extension attributes.'\n );\n\n program.command('repair-org-model', 'Repair org model.');\n\n // program.command('train-auto-access-model', 'Train Auto Access model.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,OAAO,CAAC,CAC1CQ,WAAW,CAAC,uBAAuB,CAAC,CACpCC,aAAa,CAACR,SAAS,CAAC;EAE3BM,OAAO,CAACG,OAAO,CAAC,YAAY,EAAE,wCAAwC,CAAC;EAEvEH,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,wCAAwC,EACxC,iDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,kCAAkC,EAClC,2CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,kBAAkB,EAClB,0DACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2CAA2C,EAC3C,4CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,0BAA0B,EAC1B,4EACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,sCAAsC,EACtC,0CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,uCAAuC,EACvC,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,6CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2BAA2B,EAC3B,wEACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4BAA4B,EAC5B,yCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,gCAAgC,EAChC,2FACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;;EAExD;;EAEA,OAAOH,OAAO;AAChB"}
1
+ {"version":3,"file":"admin.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["../../../src/cli/admin/admin.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('admin')\n .description('Platform admin tasks.')\n .executableDir(__dirname);\n\n program.command('federation', 'Manage admin federation configuration.');\n\n program.command(\n 'create-oauth2-client-with-admin-privileges',\n 'Create an oauth2 client with admin privileges.'\n );\n\n program.command(\n 'generate-rfc7523-authz-grant-artefacts',\n 'Generate RFC7523 authorization grant artefacts.'\n );\n\n program.command(\n 'execute-rfc7523-authz-grant-flow',\n 'Execute RFC7523 authorization grant flow.'\n );\n\n program.command(\n 'get-access-token',\n 'Get an access token using client credentials grant type.'\n );\n\n program.command(\n 'list-oauth2-clients-with-admin-privileges',\n 'List oauth2 clients with admin privileges.'\n );\n\n program.command(\n 'grant-oauth2-client-admin-privileges',\n 'Grant an oauth2 client admin privileges.'\n );\n\n program.command(\n 'revoke-oauth2-client-admin-privileges',\n 'Revoke admin privileges from an oauth2 client.'\n );\n\n program.command(\n 'list-oauth2-clients-with-custom-privileges',\n 'List oauth2 clients with custom privileges.'\n );\n\n program.command(\n 'list-static-user-mappings',\n 'List all subjects of static user mappings that are not oauth2 clients.'\n );\n\n program.command(\n 'remove-static-user-mapping',\n \"Remove a subject's static user mapping.\"\n );\n\n program.command(\n 'add-autoid-static-user-mapping',\n 'Add AutoId static user mapping to enable dashboards and other AutoId-based functionality.'\n );\n\n program.command(\n 'hide-generic-extension-attributes',\n 'Hide generic extension attributes.'\n );\n\n program.command(\n 'show-generic-extension-attributes',\n 'Show generic extension attributes.'\n );\n\n program.command('repair-org-model', 'Repair org model.');\n\n // program.command('train-auto-access-model', 'Train Auto Access model.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,OAAO,CAAC,CAC1CQ,WAAW,CAAC,uBAAuB,CAAC,CACpCC,aAAa,CAACR,SAAS,CAAC;EAE3BM,OAAO,CAACG,OAAO,CAAC,YAAY,EAAE,wCAAwC,CAAC;EAEvEH,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,wCAAwC,EACxC,iDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,kCAAkC,EAClC,2CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,kBAAkB,EAClB,0DACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2CAA2C,EAC3C,4CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,sCAAsC,EACtC,0CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,uCAAuC,EACvC,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,6CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2BAA2B,EAC3B,wEACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4BAA4B,EAC5B,yCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,gCAAgC,EAChC,2FACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;;EAExD;;EAEA,OAAOH,OAAO;AAChB"}
@@ -0,0 +1,22 @@
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
+ import { Option } from 'commander';
3
+ import { FrodoCommand } from '../FrodoCommand';
4
+ const {
5
+ getTokens
6
+ } = frodo.login;
7
+ const program = new FrodoCommand('frodo config delete');
8
+ program.description('Delete full cloud configuration.').addOption(new Option('-i, --config-id <config-id>', 'Configuration id. If specified, -a and -A are ignored.')).addOption(new Option('-a, --all', 'Delete full cloud configuration. Ignored with -i.')).addOption(new Option('--no-deep', 'No deep delete. This leaves orphaned configuration artifacts behind.')).action(
9
+ // implement command logic inside action handler
10
+ async (host, realm, user, password, options, command) => {
11
+ command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
+ if (await getTokens()) {
13
+ // code goes here
14
+ } else {
15
+ process.exitCode = 1;
16
+ }
17
+ }
18
+ // end command logic inside action handler
19
+ );
20
+
21
+ program.parse();
22
+ //# sourceMappingURL=config-delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-delete.js","names":["frodo","Option","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/config/config-delete.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config delete');\n\nprogram\n .description('Delete full cloud configuration.')\n .addOption(\n new Option(\n '-i, --config-id <config-id>',\n 'Configuration id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option('-a, --all', 'Delete full cloud configuration. Ignored with -i.')\n )\n .addOption(\n new Option(\n '--no-deep',\n 'No deep delete. This leaves orphaned configuration artifacts behind.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGH,KAAK,CAACI,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,qBAAqB,CAAC;AAEvDG,OAAO,CACJC,WAAW,CAAC,kCAAkC,CAAC,CAC/CC,SAAS,CACR,IAAIN,MAAM,CACR,6BAA6B,EAC7B,wDACF,CACF,CAAC,CACAM,SAAS,CACR,IAAIN,MAAM,CAAC,WAAW,EAAE,mDAAmD,CAC7E,CAAC,CACAM,SAAS,CACR,IAAIN,MAAM,CACR,WAAW,EACX,sEACF,CACF,CAAC,CACAO,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMX,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLa,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHZ,OAAO,CAACa,KAAK,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
+ import { Option } from 'commander';
3
+ import { FrodoCommand } from '../FrodoCommand';
4
+ const {
5
+ getTokens
6
+ } = frodo.login;
7
+ const program = new FrodoCommand('frodo config describe');
8
+ program.description('Describe full cloud configuration.').addOption(new Option('-i, --config-id <config-id>', 'Configuration id.')).action(
9
+ // implement command logic inside action handler
10
+ async (host, realm, user, password, options, command) => {
11
+ command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
+ if (await getTokens()) {
13
+ // code goes here
14
+ } else {
15
+ process.exitCode = 1;
16
+ }
17
+ }
18
+ // end command logic inside action handler
19
+ );
20
+
21
+ program.parse();
22
+ //# sourceMappingURL=config-describe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-describe.js","names":["frodo","Option","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/config/config-describe.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config describe');\n\nprogram\n .description('Describe full cloud configuration.')\n .addOption(new Option('-i, --config-id <config-id>', 'Configuration id.'))\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGH,KAAK,CAACI,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,uBAAuB,CAAC;AAEzDG,OAAO,CACJC,WAAW,CAAC,oCAAoC,CAAC,CACjDC,SAAS,CAAC,IAAIN,MAAM,CAAC,6BAA6B,EAAE,mBAAmB,CAAC,CAAC,CACzEO,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMX,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLa,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHZ,OAAO,CAACa,KAAK,CAAC,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
- import { exportEverythingToFile, exportEverythingToFiles } from '../../ops/AdminOps';
3
+ import { exportEverythingToFile, exportEverythingToFiles } from '../../ops/ConfigOps';
4
4
  import { printMessage, verboseMessage } from '../../utils/Console';
5
5
  import { FrodoCommand } from '../FrodoCommand';
6
6
  const {
7
7
  getTokens
8
8
  } = frodo.login;
9
- const program = new FrodoCommand('frodo admin export-full-cloud-config');
9
+ const program = new FrodoCommand('frodo config export');
10
10
  program.description('Export full cloud configuration for all ops that currently support export.').addOption(new Option('-f, --file <file>', 'Name of the export file.')).addOption(new Option('-a, --all', 'Export everything to a single file.')).addOption(new Option('-A, --all-separate', 'Export everything to separate files in the -D directory. Ignored with -a.')).addOption(new Option('--use-string-arrays', 'Where applicable, use string arrays to store multi-line text (e.g. scripts).').default(false, 'off')).addOption(new Option('--no-decode', 'Do not include decoded variable value in variable export').default(false, 'false')).addOption(new Option('-x, --extract', 'Extract scripts from the exported file, and save it to a separate file. Ignored with -a.')).action(
11
11
  // implement command logic inside action handler
12
12
  async (host, realm, user, password, options, command) => {
@@ -41,4 +41,4 @@ async (host, realm, user, password, options, command) => {
41
41
  );
42
42
 
43
43
  program.parse();
44
- //# sourceMappingURL=admin-export-full-cloud-config.js.map
44
+ //# sourceMappingURL=config-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-export.js","names":["frodo","state","Option","exportEverythingToFile","exportEverythingToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","all","file","useStringArrays","noDecode","decode","allSeparate","getDirectory","help","process","exitCode","extract","parse"],"sources":["../../../src/cli/config/config-export.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportEverythingToFile,\n exportEverythingToFiles,\n} from '../../ops/ConfigOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config export');\n\nprogram\n .description(\n 'Export full cloud configuration for all ops that currently support export.'\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(new Option('-a, --all', 'Export everything to a single file.'))\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export everything to separate files in the -D directory. Ignored with -a.'\n )\n )\n .addOption(\n new Option(\n '--use-string-arrays',\n 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--no-decode',\n 'Do not include decoded variable value in variable export'\n ).default(false, 'false')\n )\n .addOption(\n new Option(\n '-x, --extract',\n 'Extract scripts from the exported file, and save it to a separate file. Ignored with -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // --all -a\n if (options.all && (await getTokens())) {\n verboseMessage('Exporting everything to a single file...');\n await exportEverythingToFile(options.file, {\n useStringArrays: options.useStringArrays,\n noDecode: options.decode,\n });\n // require --directory -D for all-separate function\n } else if (options.allSeparate && !state.getDirectory()) {\n printMessage(\n '-D or --directory required when using -A or --all-separate',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n // --all-separate -A\n } else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting everything to separate files...');\n await exportEverythingToFiles(options.extract, {\n useStringArrays: options.useStringArrays,\n noDecode: options.decode,\n });\n // unrecognized combination of options or no options\n } else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,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AAEL,OAAO,CAACK,eAAe;MACxCC,QAAQ,EAAEN,OAAO,CAACO;IACpB,CAAC,CAAC;IACF;EACF,CAAC,MAAM,IAAIP,OAAO,CAACQ,WAAW,IAAI,CAAC1B,KAAK,CAAC2B,YAAY,CAAC,CAAC,EAAE;IACvDvB,YAAY,CACV,4DAA4D,EAC5D,OACF,CAAC;IACDK,OAAO,CAACmB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpB;EACF,CAAC,MAAM,IAAIZ,OAAO,CAACQ,WAAW,KAAK,MAAMnB,SAAS,CAAC,CAAC,CAAC,EAAE;IACrDF,cAAc,CAAC,2CAA2C,CAAC;IAC3D,MAAMF,uBAAuB,CAACe,OAAO,CAACa,OAAO,EAAE;MAC7CR,eAAe,EAAEL,OAAO,CAACK,eAAe;MACxCC,QAAQ,EAAEN,OAAO,CAACO;IACpB,CAAC,CAAC;IACF;EACF,CAAC,MAAM;IACLpB,cAAc,CAAC,sDAAsD,CAAC;IACtEI,OAAO,CAACmB,IAAI,CAAC,CAAC;IACdC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHrB,OAAO,CAACuB,KAAK,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
+ import { Option } from 'commander';
3
+ import { FrodoCommand } from '../FrodoCommand';
4
+ const {
5
+ getTokens
6
+ } = frodo.login;
7
+ const program = new FrodoCommand('frodo config import');
8
+ program.description('Import full cloud configuration.').addOption(new Option('-i, --config-id <config-id>', 'Configuration id. If specified, only one configuration is imported and the options -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import.')).addOption(new Option('-a, --all', 'Import all configuration from a single file. Ignored with -i.')).addOption(new Option('-A, --all-separate', 'Import all configuration from separate (.json) files in the working directory. Ignored with -i or -a.')).action(
9
+ // implement command logic inside action handler
10
+ async (host, realm, user, password, options, command) => {
11
+ command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
+ if (await getTokens()) {
13
+ // code goes here
14
+ } else {
15
+ process.exitCode = 1;
16
+ }
17
+ }
18
+ // end command logic inside action handler
19
+ );
20
+
21
+ program.parse();
22
+ //# sourceMappingURL=config-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-import.js","names":["frodo","Option","FrodoCommand","getTokens","login","program","description","addOption","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/config/config-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config import');\n\nprogram\n .description('Import full cloud configuration.')\n .addOption(\n new Option(\n '-i, --config-id <config-id>',\n 'Configuration id. If specified, only one configuration is imported and the options -a and -A are ignored.'\n )\n )\n .addOption(new Option('-f, --file <file>', 'Name of the file to import.'))\n .addOption(\n new Option(\n '-a, --all',\n 'Import all configuration from a single file. Ignored with -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all configuration from separate (.json) files in the working directory. Ignored with -i or -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGH,KAAK,CAACI,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,qBAAqB,CAAC;AAEvDG,OAAO,CACJC,WAAW,CAAC,kCAAkC,CAAC,CAC/CC,SAAS,CACR,IAAIN,MAAM,CACR,6BAA6B,EAC7B,2GACF,CACF,CAAC,CACAM,SAAS,CAAC,IAAIN,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAAC,CACzEM,SAAS,CACR,IAAIN,MAAM,CACR,WAAW,EACX,+DACF,CACF,CAAC,CACAM,SAAS,CACR,IAAIN,MAAM,CACR,oBAAoB,EACpB,uGACF,CACF,CAAC,CACAO,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMX,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLa,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHZ,OAAO,CAACa,KAAK,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { frodo } from '@rockcarver/frodo-lib';
2
+ import { Option } from 'commander';
3
+ import { FrodoCommand } from '../FrodoCommand';
4
+ const {
5
+ getTokens
6
+ } = frodo.login;
7
+ const program = new FrodoCommand('frodo config list');
8
+ program.description('List full cloud configuration.').addOption(new Option('-l, --long', 'Long with all fields.').default(false, 'false')).action(
9
+ // implement command logic inside action handler
10
+ async (host, realm, user, password, options, command) => {
11
+ command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
12
+ if (await getTokens()) {
13
+ // code goes here
14
+ } else {
15
+ process.exitCode = 1;
16
+ }
17
+ }
18
+ // end command logic inside action handler
19
+ );
20
+
21
+ program.parse();
22
+ //# sourceMappingURL=config-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-list.js","names":["frodo","Option","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","process","exitCode","parse"],"sources":["../../../src/cli/config/config-list.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo config list');\n\nprogram\n .description('List full cloud configuration.')\n .addOption(\n new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n if (await getTokens()) {\n // code goes here\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,MAAM,QAAQ,WAAW;AAElC,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGH,KAAK,CAACI,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,mBAAmB,CAAC;AAErDG,OAAO,CACJC,WAAW,CAAC,gCAAgC,CAAC,CAC7CC,SAAS,CACR,IAAIN,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAACO,OAAO,CAAC,KAAK,EAAE,OAAO,CAC1E,CAAC,CACAC,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EACvDA,OAAO,CAACC,wBAAwB,CAC9BN,IAAI,EACJC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMZ,SAAS,CAAC,CAAC,EAAE;IACrB;EAAA,CACD,MAAM;IACLc,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHb,OAAO,CAACc,KAAK,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import { FrodoStubCommand } from '../FrodoCommand';
4
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
+ export default function setup() {
6
+ const program = new FrodoStubCommand('config').description('Manage full cloud configuration.').executableDir(__dirname);
7
+
8
+ //program.command('list', 'List full cloud configuration.');
9
+
10
+ //program.command('describe', 'Describe full cloud configuration.');
11
+
12
+ program.command('export', 'Export full cloud configuration for all ops that currently support export..');
13
+
14
+ //program.command('import', 'Import full cloud configuration.');
15
+
16
+ //program.command('delete', 'Delete full cloud configuration.');
17
+
18
+ return program;
19
+ }
20
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","names":["path","fileURLToPath","FrodoStubCommand","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["../../../src/cli/config/config.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\n\nimport { FrodoStubCommand } from '../FrodoCommand';\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\nexport default function setup() {\n const program = new FrodoStubCommand('config')\n .description('Manage full cloud configuration.')\n .executableDir(__dirname);\n\n //program.command('list', 'List full cloud configuration.');\n\n //program.command('describe', 'Describe full cloud configuration.');\n\n program.command(\n 'export',\n 'Export full cloud configuration for all ops that currently support export..'\n );\n\n //program.command('import', 'Import full cloud configuration.');\n\n //program.command('delete', 'Delete full cloud configuration.');\n\n return program;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,SAASC,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,SAAS,GAAGH,IAAI,CAACI,OAAO,CAACH,aAAa,CAACI,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAAC,QAAQ,CAAC,CAC3CQ,WAAW,CAAC,kCAAkC,CAAC,CAC/CC,aAAa,CAACR,SAAS,CAAC;;EAE3B;;EAEA;;EAEAM,OAAO,CAACG,OAAO,CACb,QAAQ,EACR,6EACF,CAAC;;EAED;;EAEA;;EAEA,OAAOH,OAAO;AAChB"}
@@ -1,18 +1,13 @@
1
1
  import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import fs from 'fs';
3
3
  import { cleanupProgressIndicators, createKeyValueTable, createProgressIndicator, printMessage, stopProgressIndicator, updateProgressIndicator } from '../utils/Console';
4
- import { extractScriptToFile } from './ScriptOps';
5
4
  const {
6
- getRealmName,
7
5
  getTypedFilename,
8
- titleCase,
9
6
  saveJsonToFile,
10
- getFilePath,
11
- getWorkingDirectory
7
+ getFilePath
12
8
  } = frodo.utils;
13
9
  const {
14
- exportFullConfiguration,
15
- generateRfc7523AuthZGrantArtifacts: _generateRfc7523AuthZGrantArtifacts,
10
+ generateRfc7523AuthZGrantArtefacts: _generateRfc7523AuthZGrantArtefacts,
16
11
  executeRfc7523AuthZGrantFlow: _executeRfc7523AuthZGrantFlow
17
12
  } = frodo.admin;
18
13
  const {
@@ -27,58 +22,58 @@ function getJwkFilePath(clientId) {
27
22
  function getJwksFilePath(clientId) {
28
23
  return getFilePath(getTypedFilename(clientId + '_public', 'jwks'), true);
29
24
  }
30
- export async function generateRfc7523AuthZGrantArtifacts(clientId, iss, jwk, sub, scope, options, json) {
31
- let artifacts;
25
+ export async function generateRfc7523AuthZGrantArtefacts(clientId, iss, jwk, sub, scope, options, json) {
26
+ let artefacts;
32
27
  try {
33
- const barId = createProgressIndicator('determinate', options.save ? 3 : 1, 'Generating artifacts...');
34
- artifacts = await _generateRfc7523AuthZGrantArtifacts(clientId, iss, jwk, sub, scope, options);
35
- updateProgressIndicator(barId, 'Successfully generated artifacts.');
28
+ const barId = createProgressIndicator('determinate', options.save ? 3 : 1, 'Generating artefacts...');
29
+ artefacts = await _generateRfc7523AuthZGrantArtefacts(clientId, iss, jwk, sub, scope, options);
30
+ updateProgressIndicator(barId, 'Successfully generated artefacts.');
36
31
  let jwkFile;
37
32
  let jwksFile;
38
33
  if (options.save) {
39
34
  const jwkBarId = createProgressIndicator('determinate', 1, 'Saving JWK (private key)...');
40
35
  jwkFile = getJwkFilePath(clientId);
41
- saveJsonToFile(artifacts.jwk, jwkFile, false);
36
+ saveJsonToFile(artefacts.jwk, jwkFile, false);
42
37
  updateProgressIndicator(jwkBarId, `Saved JWK to ${jwkFile}.`);
43
38
  updateProgressIndicator(barId, 'Successfully saved JWK (private key).');
44
39
  stopProgressIndicator(jwkBarId);
45
40
  const jwksBarId = createProgressIndicator('determinate', 1, 'Saving JWKS (public key)...');
46
41
  jwksFile = getJwksFilePath(clientId);
47
- saveJsonToFile(artifacts.jwks, jwksFile, false);
42
+ saveJsonToFile(artefacts.jwks, jwksFile, false);
48
43
  updateProgressIndicator(jwksBarId, `Saved JWKS to ${jwksFile}.`);
49
44
  stopProgressIndicator(jwksBarId);
50
45
  updateProgressIndicator(barId, 'Successfully saved JWKS (public key).');
51
46
  }
52
- stopProgressIndicator(barId, `Successfully generated ${options.save ? 'and saved artifacts' : 'artifacts'}.`);
47
+ stopProgressIndicator(barId, `Successfully generated ${options.save ? 'and saved artefacts' : 'artefacts'}.`);
53
48
  cleanupProgressIndicators();
54
49
  if (json) {
55
- printMessage(artifacts, 'data');
50
+ printMessage(artefacts, 'data');
56
51
  } else {
57
- var _artifacts$issuer$all, _artifacts$issuer$all2;
52
+ var _artefacts$issuer$all, _artefacts$issuer$all2;
58
53
  printMessage(options.save ? `\nCreated oauth2 client in the ${state.getRealm()} realm:` : `\nIn AM, create an OAuth2 client in the ${state.getRealm()} realm with the following information:`);
59
54
  const client = createKeyValueTable();
60
55
  client.push(['Client ID'['brightCyan'], clientId]);
61
56
  client.push(['Client Name'['brightCyan'], clientId]);
62
- client.push(['Scopes'['brightCyan'], artifacts.client.coreOAuth2ClientConfig.scopes.value.join(', ')]);
63
- client.push(['Client Type'['brightCyan'], artifacts.client.coreOAuth2ClientConfig.clientType.value]);
64
- client.push(['Grant Types'['brightCyan'], artifacts.client.advancedOAuth2ClientConfig.grantTypes.value.join(', ')]);
65
- client.push(['Implied Consent'['brightCyan'], artifacts.client.advancedOAuth2ClientConfig.isConsentImplied.value]);
66
- client.push(['Token Endpoint Authentication '['brightCyan'], artifacts.client.advancedOAuth2ClientConfig.tokenEndpointAuthMethod.value]);
67
- client.push(['Public Key Selector'['brightCyan'], artifacts.client.signEncOAuth2ClientConfig.publicKeyLocation.value]);
57
+ client.push(['Scopes'['brightCyan'], artefacts.client.coreOAuth2ClientConfig.scopes.value.join(', ')]);
58
+ client.push(['Client Type'['brightCyan'], artefacts.client.coreOAuth2ClientConfig.clientType.value]);
59
+ client.push(['Grant Types'['brightCyan'], artefacts.client.advancedOAuth2ClientConfig.grantTypes.value.join(', ')]);
60
+ client.push(['Implied Consent'['brightCyan'], artefacts.client.advancedOAuth2ClientConfig.isConsentImplied.value]);
61
+ client.push(['Token Endpoint Authentication '['brightCyan'], artefacts.client.advancedOAuth2ClientConfig.tokenEndpointAuthMethod.value]);
62
+ client.push(['Public Key Selector'['brightCyan'], artefacts.client.signEncOAuth2ClientConfig.publicKeyLocation.value]);
68
63
  client.push(['JWKS (Public Key)'['brightCyan'], options.save ? `${jwksFile}` : 'See below']);
69
64
  printMessage(`\n${client.toString()}`);
70
65
  printMessage(options.save ? `\nCreated oauth2 trusted issuer in the ${state.getRealm()} realm:` : `\nIn AM, create a trusted issuer in the ${state.getRealm()} realm with the following information:`);
71
66
  const issuer = createKeyValueTable();
72
- issuer.push(['Name'['brightCyan'], artifacts.issuer._id]);
73
- issuer.push(['JWT Issuer'['brightCyan'], artifacts.issuer.issuer.value]);
74
- issuer.push(['Allowed Subjects '['brightCyan'], (_artifacts$issuer$all = artifacts.issuer.allowedSubjects) !== null && _artifacts$issuer$all !== void 0 && _artifacts$issuer$all.value.length ? (_artifacts$issuer$all2 = artifacts.issuer.allowedSubjects) === null || _artifacts$issuer$all2 === void 0 ? void 0 : _artifacts$issuer$all2.value.join(', ') : `Any ${state.getRealm()} realm user`]);
67
+ issuer.push(['Name'['brightCyan'], artefacts.issuer._id]);
68
+ issuer.push(['JWT Issuer'['brightCyan'], artefacts.issuer.issuer.value]);
69
+ issuer.push(['Allowed Subjects '['brightCyan'], (_artefacts$issuer$all = artefacts.issuer.allowedSubjects) !== null && _artefacts$issuer$all !== void 0 && _artefacts$issuer$all.value.length ? (_artefacts$issuer$all2 = artefacts.issuer.allowedSubjects) === null || _artefacts$issuer$all2 === void 0 ? void 0 : _artefacts$issuer$all2.value.join(', ') : `Any ${state.getRealm()} realm user`]);
75
70
  issuer.push(['JWKS (Public Key)'['brightCyan'], options.save ? `${jwksFile}` : 'See below']);
76
71
  printMessage(`\n${issuer.toString()}`);
77
72
  if (!options.save) {
78
73
  printMessage('\nJWK (Private Key)'['brightCyan']);
79
- printMessage(stringify(artifacts.jwk));
74
+ printMessage(stringify(artefacts.jwk));
80
75
  printMessage('\nJWKS (Public Key)'['brightCyan']);
81
- printMessage(stringify(artifacts.jwks));
76
+ printMessage(stringify(artefacts.jwks));
82
77
  }
83
78
  }
84
79
  return true;
@@ -153,101 +148,4 @@ export async function executeRfc7523AuthZGrantFlow(clientId, iss, jwk, sub, scop
153
148
  }
154
149
  return true;
155
150
  }
156
-
157
- /**
158
- * Export everything to separate files
159
- * @param file file name
160
- * @param {FullExportOptions} options export options
161
- */
162
- export async function exportEverythingToFile(file, options = {
163
- useStringArrays: true,
164
- noDecode: false
165
- }) {
166
- const exportData = await exportFullConfiguration(options);
167
- let fileName = getTypedFilename(`${titleCase(getRealmName(state.getRealm()))}`, `everything`);
168
- if (file) {
169
- fileName = file;
170
- }
171
- saveJsonToFile(exportData, getFilePath(fileName, true));
172
- }
173
-
174
- /**
175
- * Export everything to separate files
176
- * @param extract Extracts the scripts from the exports into separate files if true
177
- * @param {FullExportOptions} options export options
178
- */
179
- export async function exportEverythingToFiles(extract = false, options = {
180
- useStringArrays: true,
181
- noDecode: false
182
- }) {
183
- const exportData = await exportFullConfiguration(options);
184
- delete exportData.meta;
185
- const baseDirectory = getWorkingDirectory(true);
186
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
187
- Object.entries(exportData).forEach(([type, obj]) => {
188
- if (obj) {
189
- if (!fs.existsSync(`${baseDirectory}/${type}`)) {
190
- fs.mkdirSync(`${baseDirectory}/${type}`);
191
- }
192
- if (type == 'saml') {
193
- const samlData = {
194
- saml: {
195
- cot: {},
196
- hosted: {},
197
- metadata: {},
198
- remote: {}
199
- }
200
- };
201
- if (obj.cot) {
202
- if (!fs.existsSync(`${baseDirectory}/cot`)) {
203
- fs.mkdirSync(`${baseDirectory}/cot`);
204
- }
205
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
206
- Object.entries(obj.cot).forEach(([id, value]) => {
207
- samlData.saml.cot = {
208
- [id]: value
209
- };
210
- saveJsonToFile(samlData, `${baseDirectory}/cot/${getTypedFilename(id, 'cot.saml')}`);
211
- });
212
- samlData.saml.cot = {};
213
- }
214
- Object.entries(obj.hosted).concat(Object.entries(obj.remote))
215
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
- .forEach(([id, value]) => {
217
- const filename = getTypedFilename(value.entityId ? value.entityId : id, type);
218
- const samlType = obj.hosted[id] ? 'hosted' : 'remote';
219
- samlData.saml[samlType][id] = value;
220
- samlData.saml.metadata = {
221
- [id]: obj.metadata[id]
222
- };
223
- saveJsonToFile(samlData, `${baseDirectory}/${type}/${filename}`);
224
- samlData.saml[samlType] = {};
225
- });
226
- } else if (type == 'authentication') {
227
- const fileName = getTypedFilename(`${frodo.utils.getRealmName(state.getRealm())}Realm`, 'authentication.settings');
228
- saveJsonToFile({
229
- authentication: obj
230
- }, `${baseDirectory}/${type}/${fileName}`);
231
- } else {
232
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
233
- Object.entries(obj).forEach(([id, value]) => {
234
- const filename = type == 'config' ? `${id}.json` : getTypedFilename(value.name ? value.name : id, type);
235
- if (type == 'config' && filename.includes('/')) {
236
- fs.mkdirSync(`${baseDirectory}/${type}/${filename.slice(0, filename.lastIndexOf('/'))}`, {
237
- recursive: true
238
- });
239
- }
240
- if (extract && type == 'script') {
241
- extractScriptToFile(exportData, id, type);
242
- }
243
- saveJsonToFile({
244
- [type]: {
245
- [id]: value
246
- }
247
- }, `${baseDirectory}/${type}/${filename}`);
248
- });
249
- }
250
- }
251
- });
252
- }
253
151
  //# sourceMappingURL=AdminOps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdminOps.js","names":["frodo","state","fs","cleanupProgressIndicators","createKeyValueTable","createProgressIndicator","printMessage","stopProgressIndicator","updateProgressIndicator","extractScriptToFile","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","exportFullConfiguration","generateRfc7523AuthZGrantArtifacts","_generateRfc7523AuthZGrantArtifacts","executeRfc7523AuthZGrantFlow","_executeRfc7523AuthZGrantFlow","admin","stringify","json","readOAuth2TrustedJwtIssuer","oauth2oidc","issuer","getJwkFilePath","clientId","getJwksFilePath","iss","jwk","sub","scope","options","artifacts","barId","save","jwkFile","jwksFile","jwkBarId","jwksBarId","jwks","_artifacts$issuer$all","_artifacts$issuer$all2","getRealm","client","push","coreOAuth2ClientConfig","scopes","value","join","clientType","advancedOAuth2ClientConfig","grantTypes","isConsentImplied","tokenEndpointAuthMethod","signEncOAuth2ClientConfig","publicKeyLocation","toString","_id","allowedSubjects","length","error","tokenResponse","spinnerId","issSpinnerId","message","jwkSpinnerId","JSON","parse","readFileSync","subSpinnerId","_error$response","response","data","access_token","id_token","exportEverythingToFile","file","useStringArrays","noDecode","exportData","fileName","exportEverythingToFiles","extract","meta","baseDirectory","Object","entries","forEach","type","obj","existsSync","mkdirSync","samlData","saml","cot","hosted","metadata","remote","id","concat","filename","entityId","samlType","authentication","name","includes","slice","lastIndexOf","recursive"],"sources":["../../src/ops/AdminOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Writable } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { OAuth2ClientSkeleton } from '@rockcarver/frodo-lib/types/api/OAuth2ClientApi';\nimport { AccessTokenResponseType } from '@rockcarver/frodo-lib/types/api/OAuth2OIDCApi';\nimport { OAuth2TrustedJwtIssuerSkeleton } from '@rockcarver/frodo-lib/types/api/OAuth2TrustedJwtIssuerApi';\nimport {\n FullExportInterface,\n FullExportOptions,\n} from '@rockcarver/frodo-lib/types/ops/AdminOps';\nimport { JwkRsa, JwksInterface } from '@rockcarver/frodo-lib/types/ops/JoseOps';\nimport { ScriptExportInterface } from '@rockcarver/frodo-lib/types/ops/ScriptOps';\nimport fs from 'fs';\n\nimport {\n cleanupProgressIndicators,\n createKeyValueTable,\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\nimport { extractScriptToFile } from './ScriptOps';\n\nconst {\n getRealmName,\n getTypedFilename,\n titleCase,\n saveJsonToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst {\n exportFullConfiguration,\n generateRfc7523AuthZGrantArtifacts: _generateRfc7523AuthZGrantArtifacts,\n executeRfc7523AuthZGrantFlow: _executeRfc7523AuthZGrantFlow,\n} = frodo.admin;\nconst { stringify } = frodo.utils.json;\nconst { readOAuth2TrustedJwtIssuer } = frodo.oauth2oidc.issuer;\n\nfunction getJwkFilePath(clientId: string): string {\n return getFilePath(getTypedFilename(clientId + '_private', 'jwk'), true);\n}\n\nfunction getJwksFilePath(clientId: string): string {\n return getFilePath(getTypedFilename(clientId + '_public', 'jwks'), true);\n}\n\nexport async function generateRfc7523AuthZGrantArtifacts(\n clientId: string,\n iss: string,\n jwk?: JwkRsa,\n sub?: string,\n scope?: string[],\n options?: { save: boolean },\n json?: boolean\n): Promise<boolean> {\n let artifacts: {\n jwk: JwkRsa;\n jwks: JwksInterface;\n client: OAuth2ClientSkeleton;\n issuer: OAuth2TrustedJwtIssuerSkeleton;\n };\n try {\n const barId = createProgressIndicator(\n 'determinate',\n options.save ? 3 : 1,\n 'Generating artifacts...'\n );\n artifacts = await _generateRfc7523AuthZGrantArtifacts(\n clientId,\n iss,\n jwk,\n sub,\n scope,\n options\n );\n updateProgressIndicator(barId, 'Successfully generated artifacts.');\n let jwkFile: string;\n let jwksFile: string;\n if (options.save) {\n const jwkBarId = createProgressIndicator(\n 'determinate',\n 1,\n 'Saving JWK (private key)...'\n );\n jwkFile = getJwkFilePath(clientId);\n saveJsonToFile(artifacts.jwk, jwkFile, false);\n updateProgressIndicator(jwkBarId, `Saved JWK to ${jwkFile}.`);\n updateProgressIndicator(barId, 'Successfully saved JWK (private key).');\n stopProgressIndicator(jwkBarId);\n const jwksBarId = createProgressIndicator(\n 'determinate',\n 1,\n 'Saving JWKS (public key)...'\n );\n jwksFile = getJwksFilePath(clientId);\n saveJsonToFile(artifacts.jwks, jwksFile, false);\n updateProgressIndicator(jwksBarId, `Saved JWKS to ${jwksFile}.`);\n stopProgressIndicator(jwksBarId);\n updateProgressIndicator(barId, 'Successfully saved JWKS (public key).');\n }\n stopProgressIndicator(\n barId,\n `Successfully generated ${\n options.save ? 'and saved artifacts' : 'artifacts'\n }.`\n );\n cleanupProgressIndicators();\n\n if (json) {\n printMessage(artifacts, 'data');\n } else {\n printMessage(\n options.save\n ? `\\nCreated oauth2 client in the ${state.getRealm()} realm:`\n : `\\nIn AM, create an OAuth2 client in the ${state.getRealm()} realm with the following information:`\n );\n const client = createKeyValueTable();\n client.push(['Client ID'['brightCyan'], clientId]);\n client.push(['Client Name'['brightCyan'], clientId]);\n client.push([\n 'Scopes'['brightCyan'],\n (\n artifacts.client.coreOAuth2ClientConfig.scopes as Writable<string[]>\n ).value.join(', '),\n ]);\n client.push([\n 'Client Type'['brightCyan'],\n (artifacts.client.coreOAuth2ClientConfig.clientType as Writable<string>)\n .value,\n ]);\n client.push([\n 'Grant Types'['brightCyan'],\n (\n artifacts.client.advancedOAuth2ClientConfig.grantTypes as Writable<\n string[]\n >\n ).value.join(', '),\n ]);\n client.push([\n 'Implied Consent'['brightCyan'],\n (\n artifacts.client.advancedOAuth2ClientConfig\n .isConsentImplied as Writable<boolean>\n ).value,\n ]);\n client.push([\n 'Token Endpoint Authentication '['brightCyan'],\n (\n artifacts.client.advancedOAuth2ClientConfig\n .tokenEndpointAuthMethod as Writable<string>\n ).value,\n ]);\n client.push([\n 'Public Key Selector'['brightCyan'],\n (\n artifacts.client.signEncOAuth2ClientConfig\n .publicKeyLocation as Writable<string>\n ).value,\n ]);\n client.push([\n 'JWKS (Public Key)'['brightCyan'],\n options.save ? `${jwksFile}` : 'See below',\n ]);\n printMessage(`\\n${client.toString()}`);\n\n printMessage(\n options.save\n ? `\\nCreated oauth2 trusted issuer in the ${state.getRealm()} realm:`\n : `\\nIn AM, create a trusted issuer in the ${state.getRealm()} realm with the following information:`\n );\n const issuer = createKeyValueTable();\n issuer.push(['Name'['brightCyan'], artifacts.issuer._id]);\n issuer.push([\n 'JWT Issuer'['brightCyan'],\n (artifacts.issuer.issuer as Writable<string>).value,\n ]);\n issuer.push([\n 'Allowed Subjects '['brightCyan'],\n (artifacts.issuer.allowedSubjects as Writable<string[]>)?.value.length\n ? (\n artifacts.issuer.allowedSubjects as Writable<string[]>\n )?.value.join(', ')\n : `Any ${state.getRealm()} realm user`,\n ]);\n issuer.push([\n 'JWKS (Public Key)'['brightCyan'],\n options.save ? `${jwksFile}` : 'See below',\n ]);\n printMessage(`\\n${issuer.toString()}`);\n if (!options.save) {\n printMessage('\\nJWK (Private Key)'['brightCyan']);\n printMessage(stringify(artifacts.jwk));\n printMessage('\\nJWKS (Public Key)'['brightCyan']);\n printMessage(stringify(artifacts.jwks));\n }\n }\n return true;\n } catch (error) {\n printMessage(error, 'error');\n return false;\n }\n}\n\nexport async function executeRfc7523AuthZGrantFlow(\n clientId: string,\n iss?: string,\n jwk?: JwkRsa,\n sub?: string,\n scope?: string[],\n json?: boolean\n): Promise<boolean> {\n let tokenResponse: AccessTokenResponseType;\n let spinnerId: string;\n try {\n let issuer: OAuth2TrustedJwtIssuerSkeleton;\n // make sure we have an issuer\n if (!iss) {\n let issSpinnerId: string;\n try {\n issSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'No issuer provided, attempting to find suitable issuer...'\n );\n if (!issuer)\n issuer = await readOAuth2TrustedJwtIssuer(clientId + '-issuer');\n iss = (issuer.issuer as Writable<string>).value;\n stopProgressIndicator(\n issSpinnerId,\n `Found suitable issuer: ${clientId + '-issuer'} - ${iss}`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n issSpinnerId,\n `No issuer provided and no suitable issuer could be found: ${error.message}`,\n 'fail'\n );\n }\n }\n // make sure we have a JWK\n if (!jwk) {\n let jwkSpinnerId: string;\n try {\n jwkSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'No JWK provided, attempting to locate a suitable JWK...'\n );\n jwk = JSON.parse(fs.readFileSync(getJwkFilePath(clientId), 'utf8'));\n stopProgressIndicator(\n jwkSpinnerId,\n `Loaded private key JWK from: ${getJwkFilePath(clientId)}`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n jwkSpinnerId,\n `No JWK provided and no suitable JWK could be loaded from file: ${error.message}`,\n 'fail'\n );\n }\n }\n // make sure we have a subject\n if (!sub) {\n let subSpinnerId: string;\n try {\n subSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n if (!issuer)\n issuer = await frodo.oauth2oidc.issuer.readOAuth2TrustedJwtIssuer(\n clientId + '-issuer'\n );\n if (\n (issuer.allowedSubjects as Writable<string[]>).value &&\n (issuer.allowedSubjects as Writable<string[]>).value.length\n )\n sub = (issuer.allowedSubjects as Writable<string[]>).value[0];\n } catch (error) {\n stopProgressIndicator(\n subSpinnerId,\n `No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`,\n 'fail'\n );\n }\n if (sub) {\n stopProgressIndicator(\n subSpinnerId,\n `Using first subject from issuer's allowed subjects: ${sub}`,\n 'success'\n );\n } else {\n stopProgressIndicator(\n subSpinnerId,\n `No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`,\n 'success'\n );\n }\n }\n // we got everything we need, let's get that token\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n tokenResponse = await _executeRfc7523AuthZGrantFlow(\n clientId,\n iss,\n jwk,\n sub,\n scope\n );\n stopProgressIndicator(\n spinnerId,\n 'Successfully executed rfc7523 authz grant flow.',\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error executing rfc7523 authz grant flow: ${stringify(\n error.response?.data || error.message\n )}`,\n 'fail'\n );\n return false;\n }\n cleanupProgressIndicators();\n\n if (json) {\n printMessage(tokenResponse, 'data');\n } else {\n printMessage('\\nAccess Token'['brightCyan']);\n printMessage(tokenResponse.access_token);\n if (tokenResponse.id_token) {\n printMessage('\\nIdentity Token'['brightCyan']);\n printMessage(tokenResponse.id_token);\n }\n }\n return true;\n}\n\n/**\n * Export everything to separate files\n * @param file file name\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFile(\n file,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData = await exportFullConfiguration(options);\n let fileName = getTypedFilename(\n `${titleCase(getRealmName(state.getRealm()))}`,\n `everything`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export everything to separate files\n * @param extract Extracts the scripts from the exports into separate files if true\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFiles(\n extract = false,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData: FullExportInterface =\n await exportFullConfiguration(options);\n delete exportData.meta;\n const baseDirectory = getWorkingDirectory(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(exportData).forEach(([type, obj]: [string, any]) => {\n if (obj) {\n if (!fs.existsSync(`${baseDirectory}/${type}`)) {\n fs.mkdirSync(`${baseDirectory}/${type}`);\n }\n if (type == 'saml') {\n const samlData = {\n saml: {\n cot: {},\n hosted: {},\n metadata: {},\n remote: {},\n },\n };\n if (obj.cot) {\n if (!fs.existsSync(`${baseDirectory}/cot`)) {\n fs.mkdirSync(`${baseDirectory}/cot`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj.cot).forEach(([id, value]: [string, any]) => {\n samlData.saml.cot = {\n [id]: value,\n };\n saveJsonToFile(\n samlData,\n `${baseDirectory}/cot/${getTypedFilename(id, 'cot.saml')}`\n );\n });\n samlData.saml.cot = {};\n }\n Object.entries(obj.hosted)\n .concat(Object.entries(obj.remote))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .forEach(([id, value]: [string, any]) => {\n const filename = getTypedFilename(\n value.entityId ? value.entityId : id,\n type\n );\n const samlType = obj.hosted[id] ? 'hosted' : 'remote';\n samlData.saml[samlType][id] = value;\n samlData.saml.metadata = {\n [id]: obj.metadata[id],\n };\n saveJsonToFile(samlData, `${baseDirectory}/${type}/${filename}`);\n samlData.saml[samlType] = {};\n });\n } else if (type == 'authentication') {\n const fileName = getTypedFilename(\n `${frodo.utils.getRealmName(state.getRealm())}Realm`,\n 'authentication.settings'\n );\n saveJsonToFile(\n {\n authentication: obj,\n },\n `${baseDirectory}/${type}/${fileName}`\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj).forEach(([id, value]: [string, any]) => {\n const filename =\n type == 'config'\n ? `${id}.json`\n : getTypedFilename(value.name ? value.name : id, type);\n if (type == 'config' && filename.includes('/')) {\n fs.mkdirSync(\n `${baseDirectory}/${type}/${filename.slice(\n 0,\n filename.lastIndexOf('/')\n )}`,\n {\n recursive: true,\n }\n );\n }\n if (extract && type == 'script') {\n extractScriptToFile(exportData as ScriptExportInterface, id, type);\n }\n saveJsonToFile(\n {\n [type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Y,CAACT,KAAK,CAAC6C,QAAQ,CAAC,CAAC,CAAE,OAAM,EACpD,yBACF,CAAC;QACDjC,cAAc,CACZ;UACE8F,cAAc,EAAEd;QAClB,CAAC,EACA,GAAEL,aAAc,IAAGI,IAAK,IAAGR,QAAS,EACvC,CAAC;MACH,CAAC,MAAM;QACL;QACAK,MAAM,CAACC,OAAO,CAACG,GAAG,CAAC,CAACF,OAAO,CAAC,CAAC,CAACW,EAAE,EAAEnD,KAAK,CAAgB,KAAK;UAC1D,MAAMqD,QAAQ,GACZZ,IAAI,IAAI,QAAQ,GACX,GAAEU,EAAG,OAAM,GACZ3F,gBAAgB,CAACwC,KAAK,CAACyD,IAAI,GAAGzD,KAAK,CAACyD,IAAI,GAAGN,EAAE,EAAEV,IAAI,CAAC;UAC1D,IAAIA,IAAI,IAAI,QAAQ,IAAIY,QAAQ,CAACK,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9C3G,EAAE,CAAC6F,SAAS,CACT,GAAEP,aAAc,IAAGI,IAAK,IAAGY,QAAQ,CAACM,KAAK,CACxC,CAAC,EACDN,QAAQ,CAACO,WAAW,CAAC,GAAG,CAC1B,CAAE,EAAC,EACH;cACEC,SAAS,EAAE;YACb,CACF,CAAC;UACH;UACA,IAAI1B,OAAO,IAAIM,IAAI,IAAI,QAAQ,EAAE;YAC/BnF,mBAAmB,CAAC0E,UAAU,EAA2BmB,EAAE,EAAEV,IAAI,CAAC;UACpE;UACA/E,cAAc,CACZ;YACE,CAAC+E,IAAI,GAAG;cACN,CAACU,EAAE,GAAGnD;YACR;UACF,CAAC,EACA,GAAEqC,aAAc,IAAGI,IAAK,IAAGY,QAAS,EACvC,CAAC;QACH,CAAC,CAAC;MACJ;IACF;EACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"file":"AdminOps.js","names":["frodo","state","fs","cleanupProgressIndicators","createKeyValueTable","createProgressIndicator","printMessage","stopProgressIndicator","updateProgressIndicator","getTypedFilename","saveJsonToFile","getFilePath","utils","generateRfc7523AuthZGrantArtefacts","_generateRfc7523AuthZGrantArtefacts","executeRfc7523AuthZGrantFlow","_executeRfc7523AuthZGrantFlow","admin","stringify","json","readOAuth2TrustedJwtIssuer","oauth2oidc","issuer","getJwkFilePath","clientId","getJwksFilePath","iss","jwk","sub","scope","options","artefacts","barId","save","jwkFile","jwksFile","jwkBarId","jwksBarId","jwks","_artefacts$issuer$all","_artefacts$issuer$all2","getRealm","client","push","coreOAuth2ClientConfig","scopes","value","join","clientType","advancedOAuth2ClientConfig","grantTypes","isConsentImplied","tokenEndpointAuthMethod","signEncOAuth2ClientConfig","publicKeyLocation","toString","_id","allowedSubjects","length","error","tokenResponse","spinnerId","issSpinnerId","message","jwkSpinnerId","JSON","parse","readFileSync","subSpinnerId","_error$response","response","data","access_token","id_token"],"sources":["../../src/ops/AdminOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Writable } from '@rockcarver/frodo-lib/types/api/ApiTypes';\nimport { OAuth2ClientSkeleton } from '@rockcarver/frodo-lib/types/api/OAuth2ClientApi';\nimport { AccessTokenResponseType } from '@rockcarver/frodo-lib/types/api/OAuth2OIDCApi';\nimport { OAuth2TrustedJwtIssuerSkeleton } from '@rockcarver/frodo-lib/types/api/OAuth2TrustedJwtIssuerApi';\nimport { JwkRsa, JwksInterface } from '@rockcarver/frodo-lib/types/ops/JoseOps';\nimport fs from 'fs';\n\nimport {\n cleanupProgressIndicators,\n createKeyValueTable,\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n updateProgressIndicator,\n} from '../utils/Console';\n\nconst { getTypedFilename, saveJsonToFile, getFilePath } = frodo.utils;\nconst {\n generateRfc7523AuthZGrantArtefacts: _generateRfc7523AuthZGrantArtefacts,\n executeRfc7523AuthZGrantFlow: _executeRfc7523AuthZGrantFlow,\n} = frodo.admin;\nconst { stringify } = frodo.utils.json;\nconst { readOAuth2TrustedJwtIssuer } = frodo.oauth2oidc.issuer;\n\nfunction getJwkFilePath(clientId: string): string {\n return getFilePath(getTypedFilename(clientId + '_private', 'jwk'), true);\n}\n\nfunction getJwksFilePath(clientId: string): string {\n return getFilePath(getTypedFilename(clientId + '_public', 'jwks'), true);\n}\n\nexport async function generateRfc7523AuthZGrantArtefacts(\n clientId: string,\n iss: string,\n jwk?: JwkRsa,\n sub?: string,\n scope?: string[],\n options?: { save: boolean },\n json?: boolean\n): Promise<boolean> {\n let artefacts: {\n jwk: JwkRsa;\n jwks: JwksInterface;\n client: OAuth2ClientSkeleton;\n issuer: OAuth2TrustedJwtIssuerSkeleton;\n };\n try {\n const barId = createProgressIndicator(\n 'determinate',\n options.save ? 3 : 1,\n 'Generating artefacts...'\n );\n artefacts = await _generateRfc7523AuthZGrantArtefacts(\n clientId,\n iss,\n jwk,\n sub,\n scope,\n options\n );\n updateProgressIndicator(barId, 'Successfully generated artefacts.');\n let jwkFile: string;\n let jwksFile: string;\n if (options.save) {\n const jwkBarId = createProgressIndicator(\n 'determinate',\n 1,\n 'Saving JWK (private key)...'\n );\n jwkFile = getJwkFilePath(clientId);\n saveJsonToFile(artefacts.jwk, jwkFile, false);\n updateProgressIndicator(jwkBarId, `Saved JWK to ${jwkFile}.`);\n updateProgressIndicator(barId, 'Successfully saved JWK (private key).');\n stopProgressIndicator(jwkBarId);\n const jwksBarId = createProgressIndicator(\n 'determinate',\n 1,\n 'Saving JWKS (public key)...'\n );\n jwksFile = getJwksFilePath(clientId);\n saveJsonToFile(artefacts.jwks, jwksFile, false);\n updateProgressIndicator(jwksBarId, `Saved JWKS to ${jwksFile}.`);\n stopProgressIndicator(jwksBarId);\n updateProgressIndicator(barId, 'Successfully saved JWKS (public key).');\n }\n stopProgressIndicator(\n barId,\n `Successfully generated ${\n options.save ? 'and saved artefacts' : 'artefacts'\n }.`\n );\n cleanupProgressIndicators();\n\n if (json) {\n printMessage(artefacts, 'data');\n } else {\n printMessage(\n options.save\n ? `\\nCreated oauth2 client in the ${state.getRealm()} realm:`\n : `\\nIn AM, create an OAuth2 client in the ${state.getRealm()} realm with the following information:`\n );\n const client = createKeyValueTable();\n client.push(['Client ID'['brightCyan'], clientId]);\n client.push(['Client Name'['brightCyan'], clientId]);\n client.push([\n 'Scopes'['brightCyan'],\n (\n artefacts.client.coreOAuth2ClientConfig.scopes as Writable<string[]>\n ).value.join(', '),\n ]);\n client.push([\n 'Client Type'['brightCyan'],\n (artefacts.client.coreOAuth2ClientConfig.clientType as Writable<string>)\n .value,\n ]);\n client.push([\n 'Grant Types'['brightCyan'],\n (\n artefacts.client.advancedOAuth2ClientConfig.grantTypes as Writable<\n string[]\n >\n ).value.join(', '),\n ]);\n client.push([\n 'Implied Consent'['brightCyan'],\n (\n artefacts.client.advancedOAuth2ClientConfig\n .isConsentImplied as Writable<boolean>\n ).value,\n ]);\n client.push([\n 'Token Endpoint Authentication '['brightCyan'],\n (\n artefacts.client.advancedOAuth2ClientConfig\n .tokenEndpointAuthMethod as Writable<string>\n ).value,\n ]);\n client.push([\n 'Public Key Selector'['brightCyan'],\n (\n artefacts.client.signEncOAuth2ClientConfig\n .publicKeyLocation as Writable<string>\n ).value,\n ]);\n client.push([\n 'JWKS (Public Key)'['brightCyan'],\n options.save ? `${jwksFile}` : 'See below',\n ]);\n printMessage(`\\n${client.toString()}`);\n\n printMessage(\n options.save\n ? `\\nCreated oauth2 trusted issuer in the ${state.getRealm()} realm:`\n : `\\nIn AM, create a trusted issuer in the ${state.getRealm()} realm with the following information:`\n );\n const issuer = createKeyValueTable();\n issuer.push(['Name'['brightCyan'], artefacts.issuer._id]);\n issuer.push([\n 'JWT Issuer'['brightCyan'],\n (artefacts.issuer.issuer as Writable<string>).value,\n ]);\n issuer.push([\n 'Allowed Subjects '['brightCyan'],\n (artefacts.issuer.allowedSubjects as Writable<string[]>)?.value.length\n ? (\n artefacts.issuer.allowedSubjects as Writable<string[]>\n )?.value.join(', ')\n : `Any ${state.getRealm()} realm user`,\n ]);\n issuer.push([\n 'JWKS (Public Key)'['brightCyan'],\n options.save ? `${jwksFile}` : 'See below',\n ]);\n printMessage(`\\n${issuer.toString()}`);\n if (!options.save) {\n printMessage('\\nJWK (Private Key)'['brightCyan']);\n printMessage(stringify(artefacts.jwk));\n printMessage('\\nJWKS (Public Key)'['brightCyan']);\n printMessage(stringify(artefacts.jwks));\n }\n }\n return true;\n } catch (error) {\n printMessage(error, 'error');\n return false;\n }\n}\n\nexport async function executeRfc7523AuthZGrantFlow(\n clientId: string,\n iss?: string,\n jwk?: JwkRsa,\n sub?: string,\n scope?: string[],\n json?: boolean\n): Promise<boolean> {\n let tokenResponse: AccessTokenResponseType;\n let spinnerId: string;\n try {\n let issuer: OAuth2TrustedJwtIssuerSkeleton;\n // make sure we have an issuer\n if (!iss) {\n let issSpinnerId: string;\n try {\n issSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'No issuer provided, attempting to find suitable issuer...'\n );\n if (!issuer)\n issuer = await readOAuth2TrustedJwtIssuer(clientId + '-issuer');\n iss = (issuer.issuer as Writable<string>).value;\n stopProgressIndicator(\n issSpinnerId,\n `Found suitable issuer: ${clientId + '-issuer'} - ${iss}`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n issSpinnerId,\n `No issuer provided and no suitable issuer could be found: ${error.message}`,\n 'fail'\n );\n }\n }\n // make sure we have a JWK\n if (!jwk) {\n let jwkSpinnerId: string;\n try {\n jwkSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'No JWK provided, attempting to locate a suitable JWK...'\n );\n jwk = JSON.parse(fs.readFileSync(getJwkFilePath(clientId), 'utf8'));\n stopProgressIndicator(\n jwkSpinnerId,\n `Loaded private key JWK from: ${getJwkFilePath(clientId)}`,\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n jwkSpinnerId,\n `No JWK provided and no suitable JWK could be loaded from file: ${error.message}`,\n 'fail'\n );\n }\n }\n // make sure we have a subject\n if (!sub) {\n let subSpinnerId: string;\n try {\n subSpinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n if (!issuer)\n issuer = await frodo.oauth2oidc.issuer.readOAuth2TrustedJwtIssuer(\n clientId + '-issuer'\n );\n if (\n (issuer.allowedSubjects as Writable<string[]>).value &&\n (issuer.allowedSubjects as Writable<string[]>).value.length\n )\n sub = (issuer.allowedSubjects as Writable<string[]>).value[0];\n } catch (error) {\n stopProgressIndicator(\n subSpinnerId,\n `No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`,\n 'fail'\n );\n }\n if (sub) {\n stopProgressIndicator(\n subSpinnerId,\n `Using first subject from issuer's allowed subjects: ${sub}`,\n 'success'\n );\n } else {\n stopProgressIndicator(\n subSpinnerId,\n `No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`,\n 'success'\n );\n }\n }\n // we got everything we need, let's get that token\n spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n tokenResponse = await _executeRfc7523AuthZGrantFlow(\n clientId,\n iss,\n jwk,\n sub,\n scope\n );\n stopProgressIndicator(\n spinnerId,\n 'Successfully executed rfc7523 authz grant flow.',\n 'success'\n );\n } catch (error) {\n stopProgressIndicator(\n spinnerId,\n `Error executing rfc7523 authz grant flow: ${stringify(\n error.response?.data || error.message\n )}`,\n 'fail'\n );\n return false;\n }\n cleanupProgressIndicators();\n\n if (json) {\n printMessage(tokenResponse, 'data');\n } else {\n printMessage('\\nAccess Token'['brightCyan']);\n printMessage(tokenResponse.access_token);\n if (tokenResponse.id_token) {\n printMessage('\\nIdentity Token'['brightCyan']);\n printMessage(tokenResponse.id_token);\n }\n }\n return true;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,yBAAyB,EACzBC,mBAAmB,EACnBC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AAEzB,MAAM;EAAEC,g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gBE,IAAI,KAAIZ,KAAK,CAACI,OAChC,CAAE,EAAC,EACH,MACF,CAAC;IACD,OAAO,KAAK;EACd;EACA5D,yBAAyB,CAAC,CAAC;EAE3B,IAAIgB,IAAI,EAAE;IACRb,YAAY,CAACsD,aAAa,EAAE,MAAM,CAAC;EACrC,CAAC,MAAM;IACLtD,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC5CA,YAAY,CAACsD,aAAa,CAACY,YAAY,CAAC;IACxC,IAAIZ,aAAa,CAACa,QAAQ,EAAE;MAC1BnE,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;MAC9CA,YAAY,CAACsD,aAAa,CAACa,QAAQ,CAAC;IACtC;EACF;EACA,OAAO,IAAI;AACb"}
@@ -0,0 +1,128 @@
1
+ import { frodo, state } from '@rockcarver/frodo-lib';
2
+ import fs from 'fs';
3
+ import fse from 'fs-extra';
4
+ import { printMessage } from '../utils/Console';
5
+ import { extractScriptToFile } from './ScriptOps';
6
+ const {
7
+ getRealmName,
8
+ getTypedFilename,
9
+ titleCase,
10
+ saveJsonToFile,
11
+ getFilePath,
12
+ getWorkingDirectory
13
+ } = frodo.utils;
14
+ const {
15
+ exportFullConfiguration
16
+ } = frodo.config;
17
+ const {
18
+ stringify
19
+ } = frodo.utils.json;
20
+
21
+ /**
22
+ * Export everything to separate files
23
+ * @param file file name
24
+ * @param {FullExportOptions} options export options
25
+ */
26
+ export async function exportEverythingToFile(file, options = {
27
+ useStringArrays: true,
28
+ noDecode: false
29
+ }) {
30
+ const exportData = await exportFullConfiguration(options);
31
+ let fileName = getTypedFilename(`${titleCase(getRealmName(state.getRealm()))}`, `everything`);
32
+ if (file) {
33
+ fileName = file;
34
+ }
35
+ saveJsonToFile(exportData, getFilePath(fileName, true));
36
+ }
37
+
38
+ /**
39
+ * Export everything to separate files
40
+ * @param extract Extracts the scripts from the exports into separate files if true
41
+ * @param {FullExportOptions} options export options
42
+ */
43
+ export async function exportEverythingToFiles(extract = false, options = {
44
+ useStringArrays: true,
45
+ noDecode: false
46
+ }) {
47
+ const exportData = await exportFullConfiguration(options);
48
+ delete exportData.meta;
49
+ const baseDirectory = getWorkingDirectory(true);
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ Object.entries(exportData).forEach(([type, obj]) => {
52
+ if (obj) {
53
+ if (!fs.existsSync(`${baseDirectory}/${type}`)) {
54
+ fs.mkdirSync(`${baseDirectory}/${type}`);
55
+ }
56
+ if (type == 'saml') {
57
+ const samlData = {
58
+ saml: {
59
+ cot: {},
60
+ hosted: {},
61
+ metadata: {},
62
+ remote: {}
63
+ }
64
+ };
65
+ if (obj.cot) {
66
+ if (!fs.existsSync(`${baseDirectory}/cot`)) {
67
+ fs.mkdirSync(`${baseDirectory}/cot`);
68
+ }
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
+ Object.entries(obj.cot).forEach(([id, value]) => {
71
+ samlData.saml.cot = {
72
+ [id]: value
73
+ };
74
+ saveJsonToFile(samlData, `${baseDirectory}/cot/${getTypedFilename(id, 'cot.saml')}`);
75
+ });
76
+ samlData.saml.cot = {};
77
+ }
78
+ Object.entries(obj.hosted).concat(Object.entries(obj.remote))
79
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
+ .forEach(([id, value]) => {
81
+ const filename = getTypedFilename(value.entityId ? value.entityId : id, type);
82
+ const samlType = obj.hosted[id] ? 'hosted' : 'remote';
83
+ samlData.saml[samlType][id] = value;
84
+ samlData.saml.metadata = {
85
+ [id]: obj.metadata[id]
86
+ };
87
+ saveJsonToFile(samlData, `${baseDirectory}/${type}/${filename}`);
88
+ samlData.saml[samlType] = {};
89
+ });
90
+ } else if (type == 'authentication') {
91
+ const fileName = getTypedFilename(`${frodo.utils.getRealmName(state.getRealm())}Realm`, 'authentication.settings');
92
+ saveJsonToFile({
93
+ authentication: obj
94
+ }, `${baseDirectory}/${type}/${fileName}`);
95
+ } else {
96
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
+ Object.entries(obj).forEach(([id, value]) => {
98
+ if (type == 'config') {
99
+ if (value != null) {
100
+ const filename = `${id}.json`;
101
+ if (filename.includes('/')) {
102
+ fs.mkdirSync(`${baseDirectory}/${type}/${filename.slice(0, filename.lastIndexOf('/'))}`, {
103
+ recursive: true
104
+ });
105
+ }
106
+ fse.outputFile(`${baseDirectory}/${type}/${filename}`, stringify(value), err => {
107
+ if (err) {
108
+ return printMessage(`ERROR - can't save config ${id} to file - ${err}`, 'error');
109
+ }
110
+ });
111
+ }
112
+ } else {
113
+ const filename = getTypedFilename(value && value.name ? value.name : id, type);
114
+ if (extract && type == 'script') {
115
+ extractScriptToFile(exportData, id, type);
116
+ }
117
+ saveJsonToFile({
118
+ [type]: {
119
+ [id]: value
120
+ }
121
+ }, `${baseDirectory}/${type}/${filename}`);
122
+ }
123
+ });
124
+ }
125
+ }
126
+ });
127
+ }
128
+ //# sourceMappingURL=ConfigOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigOps.js","names":["frodo","state","fs","fse","printMessage","extractScriptToFile","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","exportFullConfiguration","config","stringify","json","exportEverythingToFile","file","options","useStringArrays","noDecode","exportData","fileName","getRealm","exportEverythingToFiles","extract","meta","baseDirectory","Object","entries","forEach","type","obj","existsSync","mkdirSync","samlData","saml","cot","hosted","metadata","remote","id","value","concat","filename","entityId","samlType","authentication","includes","slice","lastIndexOf","recursive","outputFile","err","name"],"sources":["../../src/ops/ConfigOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport {\n FullExportInterface,\n FullExportOptions,\n} from '@rockcarver/frodo-lib/types/ops/ConfigOps';\nimport { ScriptExportInterface } from '@rockcarver/frodo-lib/types/ops/ScriptOps';\nimport fs from 'fs';\nimport fse from 'fs-extra';\n\nimport { printMessage } from '../utils/Console';\nimport { extractScriptToFile } from './ScriptOps';\n\nconst {\n getRealmName,\n getTypedFilename,\n titleCase,\n saveJsonToFile,\n getFilePath,\n getWorkingDirectory,\n} = frodo.utils;\nconst { exportFullConfiguration } = frodo.config;\nconst { stringify } = frodo.utils.json;\n\n/**\n * Export everything to separate files\n * @param file file name\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFile(\n file,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData = await exportFullConfiguration(options);\n let fileName = getTypedFilename(\n `${titleCase(getRealmName(state.getRealm()))}`,\n `everything`\n );\n if (file) {\n fileName = file;\n }\n saveJsonToFile(exportData, getFilePath(fileName, true));\n}\n\n/**\n * Export everything to separate files\n * @param extract Extracts the scripts from the exports into separate files if true\n * @param {FullExportOptions} options export options\n */\nexport async function exportEverythingToFiles(\n extract = false,\n options: FullExportOptions = {\n useStringArrays: true,\n noDecode: false,\n }\n): Promise<void> {\n const exportData: FullExportInterface =\n await exportFullConfiguration(options);\n delete exportData.meta;\n const baseDirectory = getWorkingDirectory(true);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(exportData).forEach(([type, obj]: [string, any]) => {\n if (obj) {\n if (!fs.existsSync(`${baseDirectory}/${type}`)) {\n fs.mkdirSync(`${baseDirectory}/${type}`);\n }\n if (type == 'saml') {\n const samlData = {\n saml: {\n cot: {},\n hosted: {},\n metadata: {},\n remote: {},\n },\n };\n if (obj.cot) {\n if (!fs.existsSync(`${baseDirectory}/cot`)) {\n fs.mkdirSync(`${baseDirectory}/cot`);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj.cot).forEach(([id, value]: [string, any]) => {\n samlData.saml.cot = {\n [id]: value,\n };\n saveJsonToFile(\n samlData,\n `${baseDirectory}/cot/${getTypedFilename(id, 'cot.saml')}`\n );\n });\n samlData.saml.cot = {};\n }\n Object.entries(obj.hosted)\n .concat(Object.entries(obj.remote))\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .forEach(([id, value]: [string, any]) => {\n const filename = getTypedFilename(\n value.entityId ? value.entityId : id,\n type\n );\n const samlType = obj.hosted[id] ? 'hosted' : 'remote';\n samlData.saml[samlType][id] = value;\n samlData.saml.metadata = {\n [id]: obj.metadata[id],\n };\n saveJsonToFile(samlData, `${baseDirectory}/${type}/${filename}`);\n samlData.saml[samlType] = {};\n });\n } else if (type == 'authentication') {\n const fileName = getTypedFilename(\n `${frodo.utils.getRealmName(state.getRealm())}Realm`,\n 'authentication.settings'\n );\n saveJsonToFile(\n {\n authentication: obj,\n },\n `${baseDirectory}/${type}/${fileName}`\n );\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Object.entries(obj).forEach(([id, value]: [string, any]) => {\n if (type == 'config') {\n if (value != null) {\n const filename = `${id}.json`;\n if (filename.includes('/')) {\n fs.mkdirSync(\n `${baseDirectory}/${type}/${filename.slice(\n 0,\n filename.lastIndexOf('/')\n )}`,\n {\n recursive: true,\n }\n );\n }\n fse.outputFile(\n `${baseDirectory}/${type}/${filename}`,\n stringify(value),\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n } else {\n const filename = getTypedFilename(\n value && value.name ? value.name : id,\n type\n );\n if (extract && type == 'script') {\n extractScriptToFile(\n exportData as ScriptExportInterface,\n id,\n type\n );\n }\n saveJsonToFile(\n {\n [type]: {\n [id]: value,\n },\n },\n `${baseDirectory}/${type}/${filename}`\n );\n }\n });\n }\n }\n });\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAMpD,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,GAAG,MAAM,UAAU;AAE1B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,MAAM;EACJC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGX,KAAK,CAAC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,CAAC4B,KAAK,CAAC,EACfW,GAAG,IAAK;gBACP,IAAIA,GAAG,EAAE;kBACP,OAAOlD,YAAY,CAChB,6BAA4BsC,EAAG,cAAaY,GAAI,EAAC,EAClD,OACF,CAAC;gBACH;cACF,CACF,CAAC;YACH;UACF,CAAC,MAAM;YACL,MAAMT,QAAQ,GAAGtC,gBAAgB,CAC/BoC,KAAK,IAAIA,KAAK,CAACY,IAAI,GAAGZ,KAAK,CAACY,IAAI,GAAGb,EAAE,EACrCV,IACF,CAAC;YACD,IAAIN,OAAO,IAAIM,IAAI,IAAI,QAAQ,EAAE;cAC/B3B,mBAAmB,CACjBiB,UAAU,EACVoB,EAAE,EACFV,IACF,CAAC;YACH;YACAvB,cAAc,CACZ;cACE,CAACuB,IAAI,GAAG;gBACN,CAACU,EAAE,GAAGC;cACR;YACF,CAAC,EACA,GAAEf,aAAc,IAAGI,IAAK,IAAGa,QAAS,EACvC,CAAC;UACH;QACF,CAAC,CAAC;MACJ;IACF;EACF,CAAC,CAAC;AACJ"}
package/esm/ops/IdmOps.js CHANGED
@@ -6,6 +6,9 @@ import propertiesReader from 'properties-reader';
6
6
  import replaceall from 'replaceall';
7
7
  import { createProgressIndicator, printMessage, stopProgressIndicator } from '../utils/Console';
8
8
  import { getTypedFilename, readFiles } from '../utils/ExportImportUtils';
9
+ const {
10
+ stringify
11
+ } = frodo.utils.json;
9
12
  const {
10
13
  unSubstituteEnvParams,
11
14
  areScriptHooksValid,
@@ -64,7 +67,7 @@ export async function exportConfigEntity(id, file) {
64
67
  fileName = getTypedFilename(`${id}`, 'idm');
65
68
  }
66
69
  const configEntity = await readConfigEntity(id);
67
- fs.writeFile(getFilePath(fileName, true), JSON.stringify(configEntity, null, 2), err => {
70
+ fs.writeFile(getFilePath(fileName, true), stringify(configEntity), err => {
68
71
  if (err) {
69
72
  return printMessage(`ERROR - can't save ${id} export to file`, 'error');
70
73
  }
@@ -79,7 +82,7 @@ export async function exportAllRawConfigEntities() {
79
82
  const exportedConfigurations = await exportConfigEntities();
80
83
  for (const [id, value] of Object.entries(exportedConfigurations.config)) {
81
84
  if (value != null) {
82
- fse.outputFile(getFilePath(`${id}.json`, true), JSON.stringify(value, null, 2), err => {
85
+ fse.outputFile(getFilePath(`${id}.json`, true), stringify(value), err => {
83
86
  if (err) {
84
87
  return printMessage(`ERROR - can't save config ${id} to file - ${err}`, 'error');
85
88
  }
@@ -116,7 +119,7 @@ export async function exportAllConfigEntities(entitiesFile, envFile) {
116
119
  const results = await Promise.all(entityPromises);
117
120
  for (const item of results) {
118
121
  if (item != null) {
119
- let configEntityString = JSON.stringify(item, null, 2);
122
+ let configEntityString = stringify(item);
120
123
  envParams.each((key, value) => {
121
124
  configEntityString = replaceall(value, `\${${key}}`, configEntityString);
122
125
  });
@@ -1 +1 @@
1
- {"version":3,"file":"IdmOps.js","names":["frodo","state","fs","fse","path","propertiesReader","replaceall","createProgressIndicator","printMessage","stopProgressIndicator","getTypedFilename","readFiles","unSubstituteEnvParams","areScriptHooksValid","getFilePath","utils","testConnectorServers","readConfigEntities","readConfigEntity","exportConfigEntities","updateConfigEntity","idm","config","queryManagedObjects","managed","warnAboutOfflineConnectorServers","all","offline","filter","status","ok","map","name","length","join","error","message","listAllConfigEntities","configurations","configEntity","_id","readConfigEntitiesError","exportConfigEntity","id","file","fileName","writeFile","JSON","stringify","err","exportAllRawConfigEntities","exportedConfigurations","value","Object","entries","outputFile","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","data","entriesData","parse","envParams","undefined","entityPromises","includes","push","results","Promise","item","configEntityString","each","key","importConfigEntityByIdFromFile","entityId","validate","fileData","readFileSync","resolve","process","cwd","entityData","isValid","updateConfigEntityError","importConfigEntityFromFile","importAllRawConfigEntities","baseDirectory","getDirectory","existsSync","files","jsonFiles","toLowerCase","endsWith","content","substring","everyScriptValid","jsObject","isScriptValid","allSettled","errors","result","reason","importAllConfigEntities","entriesToImport","envReader","unsubstituted","countManagedObjects","type","response"],"sources":["../../src/ops/IdmOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport path from 'path';\nimport propertiesReader from 'properties-reader';\nimport replaceall from 'replaceall';\n\nimport {\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { getTypedFilename, readFiles } from '../utils/ExportImportUtils';\n\nconst { unSubstituteEnvParams, areScriptHooksValid, getFilePath } = frodo.utils;\nconst {\n testConnectorServers,\n readConfigEntities,\n readConfigEntity,\n exportConfigEntities,\n updateConfigEntity,\n} = frodo.idm.config;\nconst { queryManagedObjects } = frodo.idm.managed;\n\n/**\n * Warn about and list offline remote connector servers\n */\nexport async function warnAboutOfflineConnectorServers() {\n try {\n const all = await testConnectorServers();\n const offline = all\n .filter((status) => !status.ok)\n .map((status) => status.name);\n if (offline.length) {\n printMessage(\n `\\nThe following connector server(s) are offline and their connectors and configuration unavailable:\\n${offline.join(\n '\\n'\n )}`,\n 'warn'\n );\n }\n } catch (error) {\n printMessage(error, 'error');\n printMessage(\n `Error getting offline connector servers: ${error.message}`,\n 'error'\n );\n }\n}\n\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n try {\n const configurations = await readConfigEntities();\n for (const configEntity of configurations) {\n printMessage(`${configEntity._id}`, 'data');\n }\n } catch (readConfigEntitiesError) {\n printMessage(readConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${readConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await readConfigEntity(id);\n fs.writeFile(\n getFilePath(fileName, true),\n JSON.stringify(configEntity, null, 2),\n (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n }\n );\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n */\nexport async function exportAllRawConfigEntities() {\n const exportedConfigurations = await exportConfigEntities();\n for (const [id, value] of Object.entries(exportedConfigurations.config)) {\n if (value != null) {\n fse.outputFile(\n getFilePath(`${id}.json`, true),\n JSON.stringify(value, null, 2),\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(entitiesFile, envFile) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n try {\n const configurations = await readConfigEntities();\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n if (entriesToExport.includes(configEntity._id)) {\n entityPromises.push(readConfigEntity(configEntity._id));\n }\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n let configEntityString = JSON.stringify(item, null, 2);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n getFilePath(`${item._id}.json`, true),\n configEntityString,\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator(null, 'success');\n } catch (readConfigEntitiesError) {\n printMessage(readConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${readConfigEntitiesError}`,\n 'error'\n );\n }\n });\n}\n\n/**\n * Import an IDM configuration object by id from file.\n * @param entityId the configuration object to import\n * @param file optional file to import\n * @param validate validate script hooks\n */\nexport async function importConfigEntityByIdFromFile(\n entityId: string,\n file?: string,\n validate?: boolean\n) {\n if (!file) {\n file = getTypedFilename(entityId, 'idm');\n }\n\n const fileData = fs.readFileSync(\n path.resolve(process.cwd(), getFilePath(file)),\n 'utf8'\n );\n\n const entityData = JSON.parse(fileData);\n const isValid = areScriptHooksValid(entityData);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await updateConfigEntity(entityId, entityData);\n } catch (updateConfigEntityError) {\n printMessage(updateConfigEntityError, 'error');\n printMessage(`Error: ${updateConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import IDM configuration object from file.\n * @param file optional file to import\n * @param validate validate script hooks\n */\nexport async function importConfigEntityFromFile(\n file: string,\n validate?: boolean\n) {\n const fileData = fs.readFileSync(\n path.resolve(process.cwd(), getFilePath(file)),\n 'utf8'\n );\n const entityData = JSON.parse(fileData);\n const entityId = entityData._id;\n const isValid = areScriptHooksValid(entityData);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await updateConfigEntity(entityId, entityData);\n } catch (updateConfigEntityError) {\n printMessage(updateConfigEntityError, 'error');\n printMessage(`Error: ${updateConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import all IDM configuration objects from separate JSON files in a directory specified by <directory>\n * @param validate validate script hooks\n */\nexport async function importAllRawConfigEntities(validate?: boolean) {\n const baseDirectory = state.getDirectory();\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ path, content }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = areScriptHooksValid(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles.map((file) => {\n return updateConfigEntity(file.entityId, JSON.parse(file.content));\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Import all IDM configuration objects\n * @param entitiesFile JSON file that specifies the config entities to export/import\n * @param envFile File that defines environment specific variables for replacement during configuration export/import\n * @param validate validate script hooks\n */\nexport async function importAllConfigEntities(\n entitiesFile: string,\n envFile: string,\n validate?: boolean\n) {\n const baseDirectory = state.getDirectory();\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const entriesToImport = JSON.parse(fs.readFileSync(entitiesFile, 'utf8')).idm;\n\n const envReader = propertiesReader(envFile);\n\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ content, path }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = areScriptHooksValid(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles\n .filter(({ entityId }) => {\n return entriesToImport.includes(entityId);\n })\n .map(({ entityId, content }) => {\n const unsubstituted = unSubstituteEnvParams(content, envReader);\n return updateConfigEntity(entityId, JSON.parse(unsubstituted));\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type: string) {\n try {\n const result = await queryManagedObjects(type);\n printMessage(`${type}: ${result.length}`, 'data');\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,GAAG,MAAM,UAAU;AAC1B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,4BAA4B;AAExE,MAAM;EAAEC,qBAAqB;EAAEC,mBAAmB;EAAEC;AAAY,CAAC,GAAGd,KAAK,CAACe,KAAK;AAC/E,MAAM;EACJC,oBAAoB;EACpBC,kBAAkB;EAClBC,gBAAgB;EAChBC,oBAAoB;EACpBC;AACF,CAAC,GAAGpB,KAAK,CAACqB,GAAG,CAACC,MAAM;AACpB,MAAM;EAAEC;AAAoB,CAAC,GAAGvB,KAAK,CAACqB,GAAG,CAACG,OAAO;;AAEjD;AACA;AACA;AACA,OAAO,eAAeC,gCAAgCA,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AmB,CAACsF,IAAI,CAAC;IAC9CrG,YAAY,CAAE,GAAEqG,IAAK,KAAIP,MAAM,CAACrE,MAAO,EAAC,EAAE,MAAM,CAAC;EACnD,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd3B,YAAY,CAAC2B,KAAK,CAAC2E,QAAQ,CAACjD,IAAI,EAAE,OAAO,CAAC;IAC1CrD,YAAY,CAAE,2CAA0C2B,KAAM,EAAC,EAAE,OAAO,CAAC;EAC3E;AACF"}
1
+ {"version":3,"file":"IdmOps.js","names":["frodo","state","fs","fse","path","propertiesReader","replaceall","createProgressIndicator","printMessage","stopProgressIndicator","getTypedFilename","readFiles","stringify","utils","json","unSubstituteEnvParams","areScriptHooksValid","getFilePath","testConnectorServers","readConfigEntities","readConfigEntity","exportConfigEntities","updateConfigEntity","idm","config","queryManagedObjects","managed","warnAboutOfflineConnectorServers","all","offline","filter","status","ok","map","name","length","join","error","message","listAllConfigEntities","configurations","configEntity","_id","readConfigEntitiesError","exportConfigEntity","id","file","fileName","writeFile","err","exportAllRawConfigEntities","exportedConfigurations","value","Object","entries","outputFile","exportAllConfigEntities","entitiesFile","envFile","entriesToExport","readFile","data","entriesData","JSON","parse","envParams","undefined","entityPromises","includes","push","results","Promise","item","configEntityString","each","key","importConfigEntityByIdFromFile","entityId","validate","fileData","readFileSync","resolve","process","cwd","entityData","isValid","updateConfigEntityError","importConfigEntityFromFile","importAllRawConfigEntities","baseDirectory","getDirectory","existsSync","files","jsonFiles","toLowerCase","endsWith","content","substring","everyScriptValid","jsObject","isScriptValid","allSettled","errors","result","reason","importAllConfigEntities","entriesToImport","envReader","unsubstituted","countManagedObjects","type","response"],"sources":["../../src/ops/IdmOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport fse from 'fs-extra';\nimport path from 'path';\nimport propertiesReader from 'properties-reader';\nimport replaceall from 'replaceall';\n\nimport {\n createProgressIndicator,\n printMessage,\n stopProgressIndicator,\n} from '../utils/Console';\nimport { getTypedFilename, readFiles } from '../utils/ExportImportUtils';\n\nconst { stringify } = frodo.utils.json;\nconst { unSubstituteEnvParams, areScriptHooksValid, getFilePath } = frodo.utils;\nconst {\n testConnectorServers,\n readConfigEntities,\n readConfigEntity,\n exportConfigEntities,\n updateConfigEntity,\n} = frodo.idm.config;\nconst { queryManagedObjects } = frodo.idm.managed;\n\n/**\n * Warn about and list offline remote connector servers\n */\nexport async function warnAboutOfflineConnectorServers() {\n try {\n const all = await testConnectorServers();\n const offline = all\n .filter((status) => !status.ok)\n .map((status) => status.name);\n if (offline.length) {\n printMessage(\n `\\nThe following connector server(s) are offline and their connectors and configuration unavailable:\\n${offline.join(\n '\\n'\n )}`,\n 'warn'\n );\n }\n } catch (error) {\n printMessage(error, 'error');\n printMessage(\n `Error getting offline connector servers: ${error.message}`,\n 'error'\n );\n }\n}\n\n/**\n * List all IDM configuration objects\n */\nexport async function listAllConfigEntities() {\n try {\n const configurations = await readConfigEntities();\n for (const configEntity of configurations) {\n printMessage(`${configEntity._id}`, 'data');\n }\n } catch (readConfigEntitiesError) {\n printMessage(readConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${readConfigEntitiesError}`,\n 'error'\n );\n }\n}\n\n/**\n * Export an IDM configuration object.\n * @param {String} id the desired configuration object\n * @param {String} file optional export file\n */\nexport async function exportConfigEntity(id, file) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`${id}`, 'idm');\n }\n const configEntity = await readConfigEntity(id);\n fs.writeFile(getFilePath(fileName, true), stringify(configEntity), (err) => {\n if (err) {\n return printMessage(`ERROR - can't save ${id} export to file`, 'error');\n }\n return '';\n });\n}\n\n/**\n * Export all IDM configuration objects into separate JSON files in a directory specified by <directory>\n */\nexport async function exportAllRawConfigEntities() {\n const exportedConfigurations = await exportConfigEntities();\n for (const [id, value] of Object.entries(exportedConfigurations.config)) {\n if (value != null) {\n fse.outputFile(\n getFilePath(`${id}.json`, true),\n stringify(value),\n (err) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${id} to file - ${err}`,\n 'error'\n );\n }\n }\n );\n }\n }\n}\n\n/**\n * Export all IDM configuration objects\n * @param {String} entitiesFile JSON file that specifies the config entities to export/import\n * @param {String} envFile File that defines environment specific variables for replacement during configuration export/import\n */\nexport async function exportAllConfigEntities(entitiesFile, envFile) {\n let entriesToExport = [];\n // read list of entities to export\n fs.readFile(entitiesFile, 'utf8', async (err, data) => {\n if (err) throw err;\n const entriesData = JSON.parse(data);\n entriesToExport = entriesData.idm;\n // console.log(`entriesToExport ${entriesToExport}`);\n\n // read list of configs to parameterize for environment specific values\n const envParams = propertiesReader(envFile);\n\n try {\n const configurations = await readConfigEntities();\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Exporting config objects...'\n );\n const entityPromises = [];\n for (const configEntity of configurations) {\n if (entriesToExport.includes(configEntity._id)) {\n entityPromises.push(readConfigEntity(configEntity._id));\n }\n }\n const results = await Promise.all(entityPromises);\n for (const item of results) {\n if (item != null) {\n let configEntityString = stringify(item);\n envParams.each((key, value) => {\n configEntityString = replaceall(\n value,\n `\\${${key}}`,\n configEntityString\n );\n });\n fse.outputFile(\n getFilePath(`${item._id}.json`, true),\n configEntityString,\n (error) => {\n if (err) {\n return printMessage(\n `ERROR - can't save config ${item._id} to file - ${error}`,\n 'error'\n );\n }\n }\n );\n }\n }\n stopProgressIndicator(null, 'success');\n } catch (readConfigEntitiesError) {\n printMessage(readConfigEntitiesError, 'error');\n printMessage(\n `Error getting config entities: ${readConfigEntitiesError}`,\n 'error'\n );\n }\n });\n}\n\n/**\n * Import an IDM configuration object by id from file.\n * @param entityId the configuration object to import\n * @param file optional file to import\n * @param validate validate script hooks\n */\nexport async function importConfigEntityByIdFromFile(\n entityId: string,\n file?: string,\n validate?: boolean\n) {\n if (!file) {\n file = getTypedFilename(entityId, 'idm');\n }\n\n const fileData = fs.readFileSync(\n path.resolve(process.cwd(), getFilePath(file)),\n 'utf8'\n );\n\n const entityData = JSON.parse(fileData);\n const isValid = areScriptHooksValid(entityData);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await updateConfigEntity(entityId, entityData);\n } catch (updateConfigEntityError) {\n printMessage(updateConfigEntityError, 'error');\n printMessage(`Error: ${updateConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import IDM configuration object from file.\n * @param file optional file to import\n * @param validate validate script hooks\n */\nexport async function importConfigEntityFromFile(\n file: string,\n validate?: boolean\n) {\n const fileData = fs.readFileSync(\n path.resolve(process.cwd(), getFilePath(file)),\n 'utf8'\n );\n const entityData = JSON.parse(fileData);\n const entityId = entityData._id;\n const isValid = areScriptHooksValid(entityData);\n if (validate && !isValid) {\n printMessage('Invalid IDM configuration object', 'error');\n return;\n }\n\n try {\n await updateConfigEntity(entityId, entityData);\n } catch (updateConfigEntityError) {\n printMessage(updateConfigEntityError, 'error');\n printMessage(`Error: ${updateConfigEntityError}`, 'error');\n }\n}\n\n/**\n * Import all IDM configuration objects from separate JSON files in a directory specified by <directory>\n * @param validate validate script hooks\n */\nexport async function importAllRawConfigEntities(validate?: boolean) {\n const baseDirectory = state.getDirectory();\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ path, content }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = areScriptHooksValid(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles.map((file) => {\n return updateConfigEntity(file.entityId, JSON.parse(file.content));\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Import all IDM configuration objects\n * @param entitiesFile JSON file that specifies the config entities to export/import\n * @param envFile File that defines environment specific variables for replacement during configuration export/import\n * @param validate validate script hooks\n */\nexport async function importAllConfigEntities(\n entitiesFile: string,\n envFile: string,\n validate?: boolean\n) {\n const baseDirectory = state.getDirectory();\n if (!fs.existsSync(baseDirectory)) {\n return;\n }\n const entriesToImport = JSON.parse(fs.readFileSync(entitiesFile, 'utf8')).idm;\n\n const envReader = propertiesReader(envFile);\n\n const files = await readFiles(baseDirectory);\n const jsonFiles = files\n .filter(({ path }) => path.toLowerCase().endsWith('.json'))\n .map(({ content, path }) => ({\n // Remove .json extension\n entityId: path.substring(0, path.length - 5),\n content,\n path,\n }));\n\n let everyScriptValid = true;\n for (const file of jsonFiles) {\n const jsObject = JSON.parse(file.content);\n const isScriptValid = areScriptHooksValid(jsObject);\n if (!isScriptValid) {\n printMessage(`Invalid script hook in ${file.path}`, 'error');\n everyScriptValid = false;\n }\n }\n\n if (validate && !everyScriptValid) {\n return;\n }\n\n createProgressIndicator(\n 'indeterminate',\n undefined,\n 'Importing config objects...'\n );\n\n const entityPromises = jsonFiles\n .filter(({ entityId }) => {\n return entriesToImport.includes(entityId);\n })\n .map(({ entityId, content }) => {\n const unsubstituted = unSubstituteEnvParams(content, envReader);\n return updateConfigEntity(entityId, JSON.parse(unsubstituted));\n });\n\n const results = await Promise.allSettled(entityPromises);\n const errors = results.filter(\n (result): result is PromiseRejectedResult => result.status === 'rejected'\n );\n\n if (errors.length > 0) {\n printMessage(`Failed to import ${errors.length} config objects:`, 'error');\n for (const error of errors) {\n printMessage(`- ${error.reason}`, 'error');\n }\n stopProgressIndicator(\n `Failed to import ${errors.length} config objects`,\n 'error'\n );\n return;\n }\n\n stopProgressIndicator(`Imported ${results.length} config objects`, 'success');\n}\n\n/**\n * Count number of managed objects of a given type\n * @param {String} type managed object type, e.g. alpha_user\n */\nexport async function countManagedObjects(type: string) {\n try {\n const result = await queryManagedObjects(type);\n printMessage(`${type}: ${result.length}`, 'data');\n } catch (error) {\n printMessage(error.response.data, 'error');\n printMessage(`Error querying managed objects by type: ${error}`, 'error');\n }\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,GAAG,MAAM,UAAU;AAC1B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,gBAAgB,MAAM,mBAAmB;AAChD,OAAOC,UAAU,MAAM,YAAY;AAEnC,SACEC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,QAChB,kBAAkB;AACzB,SAASC,gBAAgB,EAAEC,SAAS,QAAQ,4BAA4B;AAExE,MAAM;EAAEC;AAAU,CAAC,GAAGZ,KAAK,CAACa,KAAK,CAACC,IAAI;AACtC,MAAM;EAAEC,qBAAqB;EAAEC,mBAAmB;EAAEC;AAAY,CAAC,GAAGjB,KAAK,CAACa,KAAK;AAC/E,MAAM;EACJK,oBAAoB;EACpBC,kBAAkB;EAClBC,gBAAgB;EAChBC,oBAAoB;EACpBC;AACF,CAAC,GAAGtB,KAAK,CAACuB,GAAG,CAACC,MAAM;AACpB,MAAM;EAAEC;AAAoB,CAAC,GAAGzB,KAAK,CAACuB,GAAG,CAACG,OAAO;;AAEjD;AACA;AACA;AACA,OAAO,eAAeC,gCAAgCA,CAAA,EAAG;EACvD,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMV,oBAAoB,CAAC,CAAC;IACxC,MAAMW,OAAO,GAAGD,GAAG,CAChBE,MAAM,CAAEC,MAAM,IAAK,C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2CAA0C6B,KAAM,EAAC,EAAE,OAAO,CAAC;EAC3E;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "2.0.0-35",
3
+ "version": "2.0.0-37",
4
4
  "type": "module",
5
5
  "description": "A command line interface to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.",
6
6
  "keywords": [
@@ -116,7 +116,7 @@
116
116
  ]
117
117
  },
118
118
  "dependencies": {
119
- "@rockcarver/frodo-lib": "2.0.0-52",
119
+ "@rockcarver/frodo-lib": "2.0.0-54",
120
120
  "chokidar": "^3.5.3",
121
121
  "cli-progress": "^3.11.2",
122
122
  "cli-table3": "^0.6.3",
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin-export-full-cloud-config.js","names":["frodo","state","Option","exportEverythingToFile","exportEverythingToFiles","printMessage","verboseMessage","FrodoCommand","getTokens","login","program","description","addOption","default","action","host","realm","user","password","options","command","handleDefaultArgsAndOpts","all","file","useStringArrays","noDecode","decode","allSeparate","getDirectory","help","process","exitCode","extract","parse"],"sources":["../../../src/cli/admin/admin-export-full-cloud-config.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport { Option } from 'commander';\n\nimport {\n exportEverythingToFile,\n exportEverythingToFiles,\n} from '../../ops/AdminOps';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport { FrodoCommand } from '../FrodoCommand';\n\nconst { getTokens } = frodo.login;\n\nconst program = new FrodoCommand('frodo admin export-full-cloud-config');\n\nprogram\n .description(\n 'Export full cloud configuration for all ops that currently support export.'\n )\n .addOption(new Option('-f, --file <file>', 'Name of the export file.'))\n .addOption(new Option('-a, --all', 'Export everything to a single file.'))\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export everything to separate files in the -D directory. Ignored with -a.'\n )\n )\n .addOption(\n new Option(\n '--use-string-arrays',\n 'Where applicable, use string arrays to store multi-line text (e.g. scripts).'\n ).default(false, 'off')\n )\n .addOption(\n new Option(\n '--no-decode',\n 'Do not include decoded variable value in variable export'\n ).default(false, 'false')\n )\n .addOption(\n new Option(\n '-x, --extract',\n 'Extract scripts from the exported file, and save it to a separate file. Ignored with -a.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, realm, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(\n host,\n realm,\n user,\n password,\n options,\n command\n );\n // --all -a\n if (options.all && (await getTokens())) {\n verboseMessage('Exporting everything to a single file...');\n await exportEverythingToFile(options.file, {\n useStringArrays: options.useStringArrays,\n noDecode: options.decode,\n });\n // require --directory -D for all-separate function\n } else if (options.allSeparate && !state.getDirectory()) {\n printMessage(\n '-D or --directory required when using -A or --all-separate',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n // --all-separate -A\n } else if (options.allSeparate && (await getTokens())) {\n verboseMessage('Exporting everything to separate files...');\n await exportEverythingToFiles(options.extract, {\n useStringArrays: options.useStringArrays,\n noDecode: options.decode,\n });\n // unrecognized combination of options or no options\n } else {\n verboseMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,SAASC,MAAM,QAAQ,WAAW;AAElC,SACEC,sBAAsB,EACtBC,uBAAuB,QAClB,oBAAoB;AAC3B,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAM;EAAEC;AAAU,CAAC,GAAGR,KAAK,CAACS,KAAK;AAEjC,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,sCAAsC,CAAC;AAExEG,OAAO,CACJC,WAAW,CACV,4EACF,CAAC,CACAC,SAAS,CAAC,IAAIV,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,CAAC,CAAC,CACtEU,SAAS,CAAC,IAAIV,MAAM,CAAC,WAAW,EAAE,qCAAqC,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