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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ 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-35] - 2023-11-30
11
+
10
12
  ## [2.0.0-34] - 2023-11-29
11
13
 
12
14
  ## [2.0.0-33] - 2023-11-26
@@ -1435,7 +1437,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1435
1437
  - Fixed problem with adding connection profiles
1436
1438
  - Miscellaneous bug fixes
1437
1439
 
1438
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-34...HEAD
1440
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-35...HEAD
1441
+
1442
+ [2.0.0-35]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-34...v2.0.0-35
1439
1443
 
1440
1444
  [2.0.0-34]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-33...v2.0.0-34
1441
1445
 
@@ -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,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EY,SAAS,CACR,I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,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,CAAC,IAAIZ,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CAC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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,EACX,iNACF,CACF,CAAC,CACAY,SAAS,CAAC,IAAIZ,MAAM,CAAC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,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,EAAEC,KAAK,QAAQ,uBAAuB;AAEpD,SAASC,MAAM,QAAQ,WAAW;AA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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,7 +6,7 @@ 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.');
@@ -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 '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"}
@@ -12,7 +12,7 @@ const {
12
12
  } = frodo.utils;
13
13
  const {
14
14
  exportFullConfiguration,
15
- generateRfc7523AuthZGrantArtifacts: _generateRfc7523AuthZGrantArtifacts,
15
+ generateRfc7523AuthZGrantArtefacts: _generateRfc7523AuthZGrantArtefacts,
16
16
  executeRfc7523AuthZGrantFlow: _executeRfc7523AuthZGrantFlow
17
17
  } = frodo.admin;
18
18
  const {
@@ -27,58 +27,58 @@ function getJwkFilePath(clientId) {
27
27
  function getJwksFilePath(clientId) {
28
28
  return getFilePath(getTypedFilename(clientId + '_public', 'jwks'), true);
29
29
  }
30
- export async function generateRfc7523AuthZGrantArtifacts(clientId, iss, jwk, sub, scope, options, json) {
31
- let artifacts;
30
+ export async function generateRfc7523AuthZGrantArtefacts(clientId, iss, jwk, sub, scope, options, json) {
31
+ let artefacts;
32
32
  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.');
33
+ const barId = createProgressIndicator('determinate', options.save ? 3 : 1, 'Generating artefacts...');
34
+ artefacts = await _generateRfc7523AuthZGrantArtefacts(clientId, iss, jwk, sub, scope, options);
35
+ updateProgressIndicator(barId, 'Successfully generated artefacts.');
36
36
  let jwkFile;
37
37
  let jwksFile;
38
38
  if (options.save) {
39
39
  const jwkBarId = createProgressIndicator('determinate', 1, 'Saving JWK (private key)...');
40
40
  jwkFile = getJwkFilePath(clientId);
41
- saveJsonToFile(artifacts.jwk, jwkFile, false);
41
+ saveJsonToFile(artefacts.jwk, jwkFile, false);
42
42
  updateProgressIndicator(jwkBarId, `Saved JWK to ${jwkFile}.`);
43
43
  updateProgressIndicator(barId, 'Successfully saved JWK (private key).');
44
44
  stopProgressIndicator(jwkBarId);
45
45
  const jwksBarId = createProgressIndicator('determinate', 1, 'Saving JWKS (public key)...');
46
46
  jwksFile = getJwksFilePath(clientId);
47
- saveJsonToFile(artifacts.jwks, jwksFile, false);
47
+ saveJsonToFile(artefacts.jwks, jwksFile, false);
48
48
  updateProgressIndicator(jwksBarId, `Saved JWKS to ${jwksFile}.`);
49
49
  stopProgressIndicator(jwksBarId);
50
50
  updateProgressIndicator(barId, 'Successfully saved JWKS (public key).');
51
51
  }
52
- stopProgressIndicator(barId, `Successfully generated ${options.save ? 'and saved artifacts' : 'artifacts'}.`);
52
+ stopProgressIndicator(barId, `Successfully generated ${options.save ? 'and saved artefacts' : 'artefacts'}.`);
53
53
  cleanupProgressIndicators();
54
54
  if (json) {
55
- printMessage(artifacts, 'data');
55
+ printMessage(artefacts, 'data');
56
56
  } else {
57
- var _artifacts$issuer$all, _artifacts$issuer$all2;
57
+ var _artefacts$issuer$all, _artefacts$issuer$all2;
58
58
  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
59
  const client = createKeyValueTable();
60
60
  client.push(['Client ID'['brightCyan'], clientId]);
61
61
  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]);
62
+ client.push(['Scopes'['brightCyan'], artefacts.client.coreOAuth2ClientConfig.scopes.value.join(', ')]);
63
+ client.push(['Client Type'['brightCyan'], artefacts.client.coreOAuth2ClientConfig.clientType.value]);
64
+ client.push(['Grant Types'['brightCyan'], artefacts.client.advancedOAuth2ClientConfig.grantTypes.value.join(', ')]);
65
+ client.push(['Implied Consent'['brightCyan'], artefacts.client.advancedOAuth2ClientConfig.isConsentImplied.value]);
66
+ client.push(['Token Endpoint Authentication '['brightCyan'], artefacts.client.advancedOAuth2ClientConfig.tokenEndpointAuthMethod.value]);
67
+ client.push(['Public Key Selector'['brightCyan'], artefacts.client.signEncOAuth2ClientConfig.publicKeyLocation.value]);
68
68
  client.push(['JWKS (Public Key)'['brightCyan'], options.save ? `${jwksFile}` : 'See below']);
69
69
  printMessage(`\n${client.toString()}`);
70
70
  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
71
  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`]);
72
+ issuer.push(['Name'['brightCyan'], artefacts.issuer._id]);
73
+ issuer.push(['JWT Issuer'['brightCyan'], artefacts.issuer.issuer.value]);
74
+ 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
75
  issuer.push(['JWKS (Public Key)'['brightCyan'], options.save ? `${jwksFile}` : 'See below']);
76
76
  printMessage(`\n${issuer.toString()}`);
77
77
  if (!options.save) {
78
78
  printMessage('\nJWK (Private Key)'['brightCyan']);
79
- printMessage(stringify(artifacts.jwk));
79
+ printMessage(stringify(artefacts.jwk));
80
80
  printMessage('\nJWKS (Public Key)'['brightCyan']);
81
- printMessage(stringify(artifacts.jwks));
81
+ printMessage(stringify(artefacts.jwks));
82
82
  }
83
83
  }
84
84
  return true;
@@ -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]: {\n [id]: value,\n },\n },\n `${baseDirectory}/${type}/${filename}`\n );\n });\n }\n }\n });\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAWpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,yBAAyB,EACzBC,mBAAmB,EACnBC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACz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,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","extractScriptToFile","getRealmName","getTypedFilename","titleCase","saveJsonToFile","getFilePath","getWorkingDirectory","utils","exportFullConfiguration","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","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 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\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]: {\n [id]: value,\n },\n },\n `${baseDirectory}/${type}/${filename}`\n );\n });\n }\n }\n });\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AAWpD,OAAOC,EAAE,MAAM,IAAI;AAEnB,SACEC,yBAAyB,EACzBC,mBAAmB,EACnBC,uBAAuB,EACvBC,YAAY,EACZC,qBAAqB,EACrBC,uBAAuB,QAClB,kBAAkB;AACzB,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,MAAM;EACJC,YAAY;EACZC,gBAAgB;EAChBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC;AACF,CAAC,GAAGf,KAAK,CAACgB,KAAK;AACf,MAAM;EACJC,uBAAuB;EACvBC,kCAAkC,EAAEC,mCAAmC;EACvEC,4BAA4B,EAAEC;AAChC,CAAC,GAAGrB,KAAK,CAACsB,KAAK;AACf,MAAM;EAAEC;AAAU,CAAC,GAAGvB,KAAK,CAACgB,KAAK,CAACQ,IAAI;AACtC,MAAM;EAAEC;AAA2B,CAAC,GAAGzB,KAAK,CAAC0B,UAAU,CAACC,MAAM;AAE9D,SAASC,cAAcA,CAACC,QAAgB,EAAU;EACh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;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"}
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-36",
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-53",
120
120
  "chokidar": "^3.5.3",
121
121
  "cli-progress": "^3.11.2",
122
122
  "cli-table3": "^0.6.3",