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

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-34] - 2023-11-29
11
+
10
12
  ## [2.0.0-33] - 2023-11-26
11
13
 
12
14
  ## [2.0.0-32] - 2023-11-21
@@ -1433,7 +1435,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1433
1435
  - Fixed problem with adding connection profiles
1434
1436
  - Miscellaneous bug fixes
1435
1437
 
1436
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-33...HEAD
1438
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-34...HEAD
1439
+
1440
+ [2.0.0-34]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-33...v2.0.0-34
1437
1441
 
1438
1442
  [2.0.0-33]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-32...v2.0.0-33
1439
1443
 
@@ -2,6 +2,7 @@ import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import fs from 'fs';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
+ import * as s from '../../help/SampleData';
5
6
  import { executeRfc7523AuthZGrantFlow } from '../../ops/AdminOps.js';
6
7
  import { printMessage } from '../../utils/Console.js';
7
8
  import { FrodoCommand } from '../FrodoCommand.js';
@@ -9,7 +10,7 @@ const {
9
10
  getTokens
10
11
  } = frodo.login;
11
12
  const program = new FrodoCommand('frodo admin execute-rfc7523-authz-grant-flow');
12
- 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.')).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-artifacts --help'['brightCyan']} to see how to create the required configuration artifacts for ${'frodo admin execute-rfc7523-authz-grant-flow'['brightCyan']}:\n`).action(
13
14
  // implement command logic inside action handler
14
15
  async (host, realm, user, password, options, command) => {
15
16
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
@@ -1 +1 @@
1
- {"version":3,"file":"admin-execute-rfc7523-authz-grant-flow.js","names":["frodo","state","Option","fs","v4","uuidv4","executeRfc7523AuthZGrantFlow","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","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 { 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 .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,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,IAAIX,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,iBAAiB,EACjB,kFACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EW,SAAS,CACR,IAAIX,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAACY,OAAO,CACtE,yBACF,CACF,CAAC,CACAD,SAAS,CAAC,IAAIX,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC,CACzDa,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,Q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","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,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ACJC,QAAQ,EACRC,OAAO,EACPC,OACF,CAAC;EACD,IAAI,MAAMd,SAAS,CAAC,CAAC,EAAE;IACrBF,YAAY,CACT,8DAA6DP,KAAK,CAACyB,QAAQ,CAAC,CAAE,MACjF,CAAC;IACD,IAAIC,QAAQ,GAAGtB,MAAM,CAAC,CAAC;IACvB,IAAIkB,OAAO,CAACI,QAAQ,EAAE;MACpBA,QAAQ,GAAGJ,OAAO,CAACI,QAAQ;IAC7B;IACA,IAAIC,GAAW,GAAGC,SAAS;IAC3B,IAAIN,OAAO,CAACO,OAAO,EAAE;MACnB,IAAI;QACF,MAAMC,IAAI,GAAG5B,EAAE,CAAC6B,YAAY,CAACT,OAAO,CAACO,OAAO,CAAC;QAC7CF,GAAG,GAAGK,IAAI,CAACC,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,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"}
@@ -2,6 +2,7 @@ import { frodo, state } from '@rockcarver/frodo-lib';
2
2
  import { Option } from 'commander';
3
3
  import fs from 'fs';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
+ import * as s from '../../help/SampleData';
5
6
  import { generateRfc7523AuthZGrantArtifacts } from '../../ops/AdminOps.js';
6
7
  import { printMessage } from '../../utils/Console.js';
7
8
  import { FrodoCommand } from '../FrodoCommand.js';
@@ -9,7 +10,7 @@ const {
9
10
  getTokens
10
11
  } = frodo.login;
11
12
  const program = new FrodoCommand('frodo admin generate-rfc7523-authz-grant-artifacts');
12
- 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.')).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.')).action(
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(
13
14
  // implement command logic inside action handler
14
15
  async (host, realm, user, password, options, command) => {
15
16
  command.handleDefaultArgsAndOpts(host, realm, user, password, options, command);
@@ -1 +1 @@
1
- {"version":3,"file":"admin-generate-rfc7523-authz-grant-artifacts.js","names":["frodo","state","Option","fs","v4","uuidv4","generateRfc7523AuthZGrantArtifacts","printMessage","FrodoCommand","getTokens","login","program","description","addOption","default","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 { 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.'\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 .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,SAASC,kCAAkC,QAAQ,uBAAuB;AAC1E,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,oDACF,CAAC;AAEDG,OAAO,CACJC,WAAW,CAAC,iDAAiD,CAAC,CAC9DC,SAAS,CAAC,IAAIX,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CACvDW,SAAS,CACR,IAAIX,MAAM,CACR,mBAAmB,EACnB,yDACF,CACF,CAAC,CACAW,SAAS,CACR,IAAIX,MAAM,CACR,iBAAiB,EACjB,kFACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC,CAAC,CAC3EW,SAAS,CACR,IAAIX,MAAM,CAAC,iBAAiB,EAAE,iCAAiC,CAAC,CAACY,OAAO,CACtE,yBACF,CACF,CAAC,CACAD,SAAS,CACR,IAAIX,MAAM,CACR,WAAW,EACX,iNACF,CACF,CAAC,CACAW,SAAS,CAAC,IAAIX,MAAM,CAAC,QAAQ,EAAE,wBAAwB,C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AAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHhC,OAAO,CAACoB,KAAK,CAAC,CAAC"}
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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,GAAGtB,MAAM,CAAC,CAAC;IACvB,IAAIkB,OAAO,CAACI,QAAQ,EAAE;MACpBA,QAAQ,GAAGJ,OAAO,CAACI,QAAQ;IAC7B;IACA,IAAIC,GAAW,GAAGC,SAAS;IAC3B,IAAIN,OAAO,CAACO,OAAO,EAAE;MACnB,IAAI;QACF,MAAMC,IAAI,GAAG5B,EAAE,CAAC6B,YAAY,CAACT,OAAO,CAACO,OAAO,CAAC;QAC7CF,GAAG,GAAGK,IAAI,CAACC,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"}
@@ -91,36 +91,48 @@ export async function executeRfc7523AuthZGrantFlow(clientId, iss, jwk, sub, scop
91
91
  let tokenResponse;
92
92
  let spinnerId;
93
93
  try {
94
- spinnerId = createProgressIndicator('indeterminate', 0, 'Executing rfc7523 authz grant flow...');
95
94
  let issuer;
96
95
  // make sure we have an issuer
97
96
  if (!iss) {
97
+ let issSpinnerId;
98
98
  try {
99
+ issSpinnerId = createProgressIndicator('indeterminate', 0, 'No issuer provided, attempting to find suitable issuer...');
99
100
  if (!issuer) issuer = await readOAuth2TrustedJwtIssuer(clientId + '-issuer');
100
- iss = issuer.issuer;
101
+ iss = issuer.issuer.value;
102
+ stopProgressIndicator(issSpinnerId, `Found suitable issuer: ${clientId + '-issuer'} - ${iss}`, 'success');
101
103
  } catch (error) {
102
- throw new Error(`No issuer provided and no suitable issuer could be found: ${error.message}`);
104
+ stopProgressIndicator(issSpinnerId, `No issuer provided and no suitable issuer could be found: ${error.message}`, 'fail');
103
105
  }
104
106
  }
105
107
  // make sure we have a JWK
106
108
  if (!jwk) {
109
+ let jwkSpinnerId;
107
110
  try {
111
+ jwkSpinnerId = createProgressIndicator('indeterminate', 0, 'No JWK provided, attempting to locate a suitable JWK...');
108
112
  jwk = JSON.parse(fs.readFileSync(getJwkFilePath(clientId), 'utf8'));
113
+ stopProgressIndicator(jwkSpinnerId, `Loaded private key JWK from: ${getJwkFilePath(clientId)}`, 'success');
109
114
  } catch (error) {
110
- throw new Error(`No JWK provided and no suitable JWK could be loaded from file: ${error.message}`);
115
+ stopProgressIndicator(jwkSpinnerId, `No JWK provided and no suitable JWK could be loaded from file: ${error.message}`, 'fail');
111
116
  }
112
117
  }
113
118
  // make sure we have a subject
114
119
  if (!sub) {
120
+ let subSpinnerId;
115
121
  try {
122
+ subSpinnerId = createProgressIndicator('indeterminate', 0, 'Executing rfc7523 authz grant flow...');
116
123
  if (!issuer) issuer = await frodo.oauth2oidc.issuer.readOAuth2TrustedJwtIssuer(clientId + '-issuer');
117
- if (issuer.allowedSubjects && issuer.allowedSubjects.length) sub = issuer.allowedSubjects[0];
124
+ if (issuer.allowedSubjects.value && issuer.allowedSubjects.value.length) sub = issuer.allowedSubjects.value[0];
118
125
  } catch (error) {
119
- throw new Error(`No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`);
126
+ stopProgressIndicator(subSpinnerId, `No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`, 'fail');
127
+ }
128
+ if (sub) {
129
+ stopProgressIndicator(subSpinnerId, `Using first subject from issuer's allowed subjects: ${sub}`, 'success');
130
+ } else {
131
+ stopProgressIndicator(subSpinnerId, `No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`, 'success');
120
132
  }
121
- if (!sub) throw new Error(`No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`);
122
133
  }
123
134
  // we got everything we need, let's get that token
135
+ spinnerId = createProgressIndicator('indeterminate', 0, 'Executing rfc7523 authz grant flow...');
124
136
  tokenResponse = await _executeRfc7523AuthZGrantFlow(clientId, iss, jwk, sub, scope);
125
137
  stopProgressIndicator(spinnerId, 'Successfully executed rfc7523 authz grant flow.', 'success');
126
138
  } catch (error) {
@@ -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","Error","message","JSON","parse","readFileSync","_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 spinnerId = createProgressIndicator(\n 'indeterminate',\n 0,\n 'Executing rfc7523 authz grant flow...'\n );\n let issuer: OAuth2TrustedJwtIssuerSkeleton;\n // make sure we have an issuer\n if (!iss) {\n try {\n if (!issuer)\n issuer = await readOAuth2TrustedJwtIssuer(clientId + '-issuer');\n iss = issuer.issuer as string;\n } catch (error) {\n throw new Error(\n `No issuer provided and no suitable issuer could be found: ${error.message}`\n );\n }\n }\n // make sure we have a JWK\n if (!jwk) {\n try {\n jwk = JSON.parse(fs.readFileSync(getJwkFilePath(clientId), 'utf8'));\n } catch (error) {\n throw new Error(\n `No JWK provided and no suitable JWK could be loaded from file: ${error.message}`\n );\n }\n }\n // make sure we have a subject\n if (!sub) {\n try {\n if (!issuer)\n issuer = await frodo.oauth2oidc.issuer.readOAuth2TrustedJwtIssuer(\n clientId + '-issuer'\n );\n if (\n (issuer.allowedSubjects as string[]) &&\n (issuer.allowedSubjects as string[]).length\n )\n sub = (issuer.allowedSubjects as string[])[0];\n } catch (error) {\n throw new Error(\n `No subject provided and no suitable subject could be extracted from the trusted issuer configuration: ${error.message}`\n );\n }\n if (!sub)\n throw new Error(\n `No subject provided and no suitable subject could be extracted from the trusted issuer's list of allowed subjects.`\n );\n }\n // we got everything we need, let's get that token\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,K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B,KAAK,CAACN,YAAY,CAACT,KAAK,CAAC6C,QAAQ,CAAC,CAAC,CAAE,OAAM,EACpD,yBACF,CAAC;QACDjC,cAAc,CACZ;UACE4F,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,EAAEjD,KAAK,CAAgB,KAAK;UAC1D,MAAMmD,QAAQ,GACZZ,IAAI,IAAI,QAAQ,GACX,GAAEU,EAAG,OAAM,GACZzF,gBAAgB,CAACwC,KAAK,CAACuD,IAAI,GAAGvD,KAAK,CAACuD,IAAI,GAAGN,EAAE,EAAEV,IAAI,CAAC;UAC1D,IAAIA,IAAI,IAAI,QAAQ,IAAIY,QAAQ,CAACK,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9CzG,EAAE,CAAC2F,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/BjF,mBAAmB,CAACwE,UAAU,EAA2BmB,EAAE,EAAEV,IAAI,CAAC;UACpE;UACA7E,cAAc,CACZ;YACE,CAAC6E,IAAI,GAAG;cACN,CAACU,EAAE,GAAGjD;YACR;UACF,CAAC,EACA,GAAEmC,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","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;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,u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ACyD,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "2.0.0-34",
3
+ "version": "2.0.0-35",
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": [