@rockcarver/frodo-cli 0.24.5 → 0.24.6-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md 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
+ ## [0.24.6-0] - 2023-06-21
11
+
10
12
  ## [0.24.5] - 2023-05-31
11
13
 
12
14
  ### Added
@@ -1200,7 +1202,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1200
1202
  - Fixed problem with adding connection profiles
1201
1203
  - Miscellaneous bug fixes
1202
1204
 
1203
- [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.24.5...HEAD
1205
+ [Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v0.24.6-0...HEAD
1206
+
1207
+ [0.24.6-0]: https://github.com/rockcarver/frodo-cli/compare/v0.24.5...v0.24.6-0
1204
1208
 
1205
1209
  [0.24.5]: https://github.com/rockcarver/frodo-cli/compare/v0.24.4...v0.24.5
1206
1210
 
@@ -27,7 +27,9 @@ async (host, user, password, options, command) => {
27
27
  if (options.authenticationHeaderOverrides) {
28
28
  state.setAuthenticationHeaderOverrides(JSON.parse(options.authenticationHeaderOverrides));
29
29
  }
30
- const forceLoginAsUser = !options.sa || (state.getLogApiKey() && state.getLogApiSecret() ? false : true);
30
+ const needSa = options.sa && !state.getServiceAccountId() && !state.getServiceAccountJwk();
31
+ const needLogApiKey = options.logApi && !state.getLogApiKey() && !state.getLogApiSecret() && needSa;
32
+ const forceLoginAsUser = needSa || needLogApiKey;
31
33
  if (options.validate && (await getTokens(forceLoginAsUser)) || !options.validate) {
32
34
  verboseMessage(`Saving connection profile for tenant ${state.getHost()}...`);
33
35
  // if cloud deployment add service account
@@ -60,7 +62,7 @@ async (host, user, password, options, command) => {
60
62
  // if cloud deployment add log api key and secret
61
63
  verboseMessage(options);
62
64
  verboseMessage(state);
63
- if (options.validate && state.getDeploymentType() === constants.CLOUD_DEPLOYMENT_TYPE_KEY && options.logApi) {
65
+ if (options.validate && state.getDeploymentType() === constants.CLOUD_DEPLOYMENT_TYPE_KEY && needLogApiKey) {
64
66
  // validate and add existing log api key and secret
65
67
  if (options.logApiKey && options.logApiSecret) {
66
68
  verboseMessage(`Validating and adding log api key and secret...`);
@@ -1 +1 @@
1
- {"version":3,"file":"conn-save.js","names":["FrodoCommand","Option","Authenticate","ConnectionProfile","ServiceAccount","state","constants","verboseMessage","printMessage","addExistingServiceAccount","provisionCreds","getTokens","saveConnectionProfile","addNewServiceAccount","isServiceAccountsFeatureAvailable","program","alias","description","addOption","action","host","user","password","options","command","handleDefaultArgsAndOpts","setLogApiKey","logApiKey","setLogApiSecret","logApiSecret","authenticationService","setAuthenticationService","authenticationHeaderOverrides","setAuthenticationHeaderOverrides","JSON","parse","forceLoginAsUser","sa","getLogApiKey","getLogApiSecret","validate","getHost","getDeploymentType","CLOUD_DEPLOYMENT_TYPE_KEY","saId","saJwkFile","getServiceAccountId","name","_id","error","_error$response","_error$response2","_error$response2$data","response","data","message","process","exitCode","logApi","creds","api_key_id","api_key_secret","_error$response3","_error$response4","_error$response4$data"],"sources":["cli/conn/conn-save.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ConnectionProfile,\n ServiceAccount,\n state,\n constants,\n} from '@rockcarver/frodo-lib';\nimport { verboseMessage, printMessage } from '../../utils/Console';\nimport { addExistingServiceAccount } from '../../ops/ConnectionProfileOps.js';\nimport { provisionCreds } from '../../ops/LogOps';\n\nconst { getTokens } = Authenticate;\nconst { saveConnectionProfile, addNewServiceAccount } = ConnectionProfile;\nconst { isServiceAccountsFeatureAvailable } = ServiceAccount;\n\nconst program = new FrodoCommand('frodo conn save', ['realm']);\n\nprogram\n .alias('add')\n .description('Save connection profiles.')\n .addOption(\n new Option(\n '--sa-id <uuid>',\n \"Service account's uuid. If specified, must also include --sa-jwk-file. Ignored with --no-sa.\"\n )\n )\n .addOption(\n new Option(\n '--sa-jwk-file <file>',\n \"File containing the service account's java web key (jwk). Jwk must contain private key! If specified, must also include --sa-id. Ignored with --no-sa.\"\n )\n )\n .addOption(new Option('--no-sa', 'Do not create and add service account.'))\n .addOption(\n new Option(\n '--log-api-key [key]',\n 'Log API key. If specified, must also include --log-api-secret. Ignored with --no-log-api.'\n )\n )\n .addOption(\n new Option(\n '--log-api-secret [secret]',\n 'Log API secret. If specified, must also include --log-api-key. Ignored with --no-log-api.'\n )\n )\n .addOption(\n new Option('--no-log-api', 'Do not create and add log API key and secret.')\n )\n .addOption(new Option('--no-validate', 'Do not validate connection.'))\n .addOption(\n new Option(\n '--authentication-service [service]',\n 'Name of the authentication service/tree to use.'\n )\n )\n .addOption(\n new Option(\n '--authentication-header-overrides [headers]',\n 'Map of headers: {\"host\":\"am.example.com:8081\"}.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n state.setLogApiKey(options.logApiKey);\n state.setLogApiSecret(options.logApiSecret);\n if (options.authenticationService) {\n state.setAuthenticationService(options.authenticationService);\n }\n if (options.authenticationHeaderOverrides) {\n state.setAuthenticationHeaderOverrides(\n JSON.parse(options.authenticationHeaderOverrides)\n );\n }\n const forceLoginAsUser =\n !options.sa ||\n (state.getLogApiKey() && state.getLogApiSecret() ? false : true);\n if (\n (options.validate && (await getTokens(forceLoginAsUser))) ||\n !options.validate\n ) {\n verboseMessage(\n `Saving connection profile for tenant ${state.getHost()}...`\n );\n // if cloud deployment add service account\n if (\n options.validate &&\n state.getDeploymentType() === constants.CLOUD_DEPLOYMENT_TYPE_KEY &&\n options.sa &&\n (await isServiceAccountsFeatureAvailable())\n ) {\n // validate and add existing service account\n if (options.saId && options.saJwkFile) {\n verboseMessage(`Validating and adding service account...`);\n if (\n await addExistingServiceAccount(\n options.saId,\n options.saJwkFile,\n options.validate\n )\n ) {\n printMessage(\n `Validated and added service account with id ${options.saId} to profile.`\n );\n }\n }\n // add new service account if none already exists in the profile\n else if (!state.getServiceAccountId()) {\n try {\n verboseMessage(`Creating service account...`);\n const sa = await addNewServiceAccount();\n printMessage(\n `Created and added service account ${sa.name} with id ${sa._id} to profile.`\n );\n } catch (error) {\n printMessage(error.response?.data, 'error');\n printMessage(\n `Error creating service account: ${error.response?.data?.message}`,\n 'error'\n );\n process.exitCode = 1;\n }\n }\n }\n // add existing service account without validation\n else if (\n !options.validate &&\n options.saId &&\n options.saJwkFile &&\n options.sa\n ) {\n addExistingServiceAccount(\n options.saId,\n options.saJwkFile,\n options.validate\n );\n }\n // if cloud deployment add log api key and secret\n verboseMessage(options);\n verboseMessage(state);\n if (\n options.validate &&\n state.getDeploymentType() === constants.CLOUD_DEPLOYMENT_TYPE_KEY &&\n options.logApi\n ) {\n // validate and add existing log api key and secret\n if (options.logApiKey && options.logApiSecret) {\n verboseMessage(`Validating and adding log api key and secret...`);\n if (\n await addExistingServiceAccount(\n options.logApiKey,\n options.logApiSecret,\n options.validate\n )\n ) {\n printMessage(\n `Added log API key ${options.logApiKey} to profile.`\n );\n }\n }\n // add new log api key and secret if none already exists in the profile\n else if (!state.getLogApiKey()) {\n try {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n printMessage(\n `Created log API key ${creds.api_key_id} and secret.`\n );\n } catch (error) {\n printMessage(error.response?.data, 'error');\n printMessage(\n `Error creating log API key and secret: ${error.response?.data?.message}`,\n 'error'\n );\n process.exitCode = 1;\n }\n }\n }\n // add existing log api key and secret without validation\n // storing log API key and secret in the connection profile is happening default, therefore no code required here\n if (await saveConnectionProfile(host)) {\n printMessage(`Saved connection profile ${state.getHost()}`);\n } else {\n process.exitCode = 1;\n }\n } else {\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,YAAY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AC;IAC7D,CAAC,MAAM;MACLe,OAAO,CAACC,QAAQ,GAAG,CAAC;IACtB;EACF,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEH1C,OAAO,CAACoB,KAAK,CAAC,CAAC"}
1
+ {"version":3,"file":"conn-save.js","names":["FrodoCommand","Option","Authenticate","ConnectionProfile","ServiceAccount","state","constants","verboseMessage","printMessage","addExistingServiceAccount","provisionCreds","getTokens","saveConnectionProfile","addNewServiceAccount","isServiceAccountsFeatureAvailable","program","alias","description","addOption","action","host","user","password","options","command","handleDefaultArgsAndOpts","setLogApiKey","logApiKey","setLogApiSecret","logApiSecret","authenticationService","setAuthenticationService","authenticationHeaderOverrides","setAuthenticationHeaderOverrides","JSON","parse","needSa","sa","getServiceAccountId","getServiceAccountJwk","needLogApiKey","logApi","getLogApiKey","getLogApiSecret","forceLoginAsUser","validate","getHost","getDeploymentType","CLOUD_DEPLOYMENT_TYPE_KEY","saId","saJwkFile","name","_id","error","_error$response","_error$response2","_error$response2$data","response","data","message","process","exitCode","creds","api_key_id","api_key_secret","_error$response3","_error$response4","_error$response4$data"],"sources":["cli/conn/conn-save.ts"],"sourcesContent":["import { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport {\n Authenticate,\n ConnectionProfile,\n ServiceAccount,\n state,\n constants,\n} from '@rockcarver/frodo-lib';\nimport { verboseMessage, printMessage } from '../../utils/Console';\nimport { addExistingServiceAccount } from '../../ops/ConnectionProfileOps.js';\nimport { provisionCreds } from '../../ops/LogOps';\n\nconst { getTokens } = Authenticate;\nconst { saveConnectionProfile, addNewServiceAccount } = ConnectionProfile;\nconst { isServiceAccountsFeatureAvailable } = ServiceAccount;\n\nconst program = new FrodoCommand('frodo conn save', ['realm']);\n\nprogram\n .alias('add')\n .description('Save connection profiles.')\n .addOption(\n new Option(\n '--sa-id <uuid>',\n \"Service account's uuid. If specified, must also include --sa-jwk-file. Ignored with --no-sa.\"\n )\n )\n .addOption(\n new Option(\n '--sa-jwk-file <file>',\n \"File containing the service account's java web key (jwk). Jwk must contain private key! If specified, must also include --sa-id. Ignored with --no-sa.\"\n )\n )\n .addOption(new Option('--no-sa', 'Do not create and add service account.'))\n .addOption(\n new Option(\n '--log-api-key [key]',\n 'Log API key. If specified, must also include --log-api-secret. Ignored with --no-log-api.'\n )\n )\n .addOption(\n new Option(\n '--log-api-secret [secret]',\n 'Log API secret. If specified, must also include --log-api-key. Ignored with --no-log-api.'\n )\n )\n .addOption(\n new Option('--no-log-api', 'Do not create and add log API key and secret.')\n )\n .addOption(new Option('--no-validate', 'Do not validate connection.'))\n .addOption(\n new Option(\n '--authentication-service [service]',\n 'Name of the authentication service/tree to use.'\n )\n )\n .addOption(\n new Option(\n '--authentication-header-overrides [headers]',\n 'Map of headers: {\"host\":\"am.example.com:8081\"}.'\n )\n )\n .action(\n // implement command logic inside action handler\n async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n state.setLogApiKey(options.logApiKey);\n state.setLogApiSecret(options.logApiSecret);\n if (options.authenticationService) {\n state.setAuthenticationService(options.authenticationService);\n }\n if (options.authenticationHeaderOverrides) {\n state.setAuthenticationHeaderOverrides(\n JSON.parse(options.authenticationHeaderOverrides)\n );\n }\n const needSa =\n options.sa &&\n !state.getServiceAccountId() &&\n !state.getServiceAccountJwk();\n const needLogApiKey =\n options.logApi &&\n !state.getLogApiKey() &&\n !state.getLogApiSecret() &&\n needSa;\n const forceLoginAsUser = needSa || needLogApiKey;\n if (\n (options.validate && (await getTokens(forceLoginAsUser))) ||\n !options.validate\n ) {\n verboseMessage(\n `Saving connection profile for tenant ${state.getHost()}...`\n );\n // if cloud deployment add service account\n if (\n options.validate &&\n state.getDeploymentType() === constants.CLOUD_DEPLOYMENT_TYPE_KEY &&\n options.sa &&\n (await isServiceAccountsFeatureAvailable())\n ) {\n // validate and add existing service account\n if (options.saId && options.saJwkFile) {\n verboseMessage(`Validating and adding service account...`);\n if (\n await addExistingServiceAccount(\n options.saId,\n options.saJwkFile,\n options.validate\n )\n ) {\n printMessage(\n `Validated and added service account with id ${options.saId} to profile.`\n );\n }\n }\n // add new service account if none already exists in the profile\n else if (!state.getServiceAccountId()) {\n try {\n verboseMessage(`Creating service account...`);\n const sa = await addNewServiceAccount();\n printMessage(\n `Created and added service account ${sa.name} with id ${sa._id} to profile.`\n );\n } catch (error) {\n printMessage(error.response?.data, 'error');\n printMessage(\n `Error creating service account: ${error.response?.data?.message}`,\n 'error'\n );\n process.exitCode = 1;\n }\n }\n }\n // add existing service account without validation\n else if (\n !options.validate &&\n options.saId &&\n options.saJwkFile &&\n options.sa\n ) {\n addExistingServiceAccount(\n options.saId,\n options.saJwkFile,\n options.validate\n );\n }\n // if cloud deployment add log api key and secret\n verboseMessage(options);\n verboseMessage(state);\n if (\n options.validate &&\n state.getDeploymentType() === constants.CLOUD_DEPLOYMENT_TYPE_KEY &&\n needLogApiKey\n ) {\n // validate and add existing log api key and secret\n if (options.logApiKey && options.logApiSecret) {\n verboseMessage(`Validating and adding log api key and secret...`);\n if (\n await addExistingServiceAccount(\n options.logApiKey,\n options.logApiSecret,\n options.validate\n )\n ) {\n printMessage(\n `Added log API key ${options.logApiKey} to profile.`\n );\n }\n }\n // add new log api key and secret if none already exists in the profile\n else if (!state.getLogApiKey()) {\n try {\n const creds = await provisionCreds();\n state.setLogApiKey(creds.api_key_id);\n state.setLogApiSecret(creds.api_key_secret);\n printMessage(\n `Created log API key ${creds.api_key_id} and secret.`\n );\n } catch (error) {\n printMessage(error.response?.data, 'error');\n printMessage(\n `Error creating log API key and secret: ${error.response?.data?.message}`,\n 'error'\n );\n process.exitCode = 1;\n }\n }\n }\n // add existing log api key and secret without validation\n // storing log API key and secret in the connection profile is happening default, therefore no code required here\n if (await saveConnectionProfile(host)) {\n printMessage(`Saved connection profile ${state.getHost()}`);\n } else {\n process.exitCode = 1;\n }\n } else {\n process.exitCode = 1;\n }\n }\n // end command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BA,qBAAA,CAAsBR,OAAQ,EAAC,EACzE,OACF,CAAC;UACDC,OAAO,CAACC,QAAQ,GAAG,CAAC;QACtB;MACF;IACF;IACA;IACA;IACA,IAAI,MAAMjD,qBAAqB,CAACQ,IAAI,CAAC,EAAE;MACrCZ,YAAY,CAAE,4BAA2BH,KAAK,CAACyC,OAAO,CAAC,CAAE,EAAC,CAAC;IAC7D,CAAC,MAAM;MACLc,OAAO,CAACC,QAAQ,GAAG,CAAC;IACtB;EACF,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEH9C,OAAO,CAACoB,KAAK,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockcarver/frodo-cli",
3
- "version": "0.24.5",
3
+ "version": "0.24.6-0",
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": [