@rockcarver/frodo-cli 2.0.0-5 → 2.0.0-6
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 +35 -1
- package/esm/cli/admin/admin-federation-export.js +42 -0
- package/esm/cli/admin/admin-federation-export.js.map +1 -0
- package/esm/cli/admin/admin-federation-import.js +46 -0
- package/esm/cli/admin/admin-federation-import.js.map +1 -0
- package/esm/cli/admin/admin-federation-list.js +26 -0
- package/esm/cli/admin/admin-federation-list.js.map +1 -0
- package/esm/cli/admin/admin-federation.js +13 -0
- package/esm/cli/admin/admin-federation.js.map +1 -0
- package/esm/cli/admin/admin.js +1 -0
- package/esm/cli/admin/admin.js.map +1 -1
- package/esm/ops/AdminFederationOps.js +208 -0
- package/esm/ops/AdminFederationOps.js.map +1 -0
- package/esm/ops/OAuth2ClientOps.js +1 -1
- package/esm/ops/OAuth2ClientOps.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,38 @@ 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-6] - 2023-06-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- \#251: Support for Identity Cloud admin federation configuration:
|
|
15
|
+
|
|
16
|
+
- `frodo admin federation` Manage admin federation configuration.
|
|
17
|
+
- `export` Export admin federation providers.
|
|
18
|
+
- `import` Import admin federation providers.
|
|
19
|
+
- `list` List admin federation providers.
|
|
20
|
+
|
|
21
|
+
Examples:
|
|
22
|
+
|
|
23
|
+
- List all configured admin federation providers:<br>
|
|
24
|
+
`frodo admin federation list <myTenant>`
|
|
25
|
+
|
|
26
|
+
`frodo admin federation list <myTenant> <username> <password>`
|
|
27
|
+
- Export all admin federation providers to a single file:<br>
|
|
28
|
+
`frodo admin federation export -a <myTenant>`
|
|
29
|
+
|
|
30
|
+
`frodo admin federation export -a <myTenant> <username> <password>`
|
|
31
|
+
- Import all admin federation providers from a single file:<br>
|
|
32
|
+
`frodo admin federation import -a -f allProviders.admin.federation.json <myTenant>`
|
|
33
|
+
|
|
34
|
+
`frodo admin federation import -a -f allProviders.admin.federation.json <myTenant> <username> <password>`<br>
|
|
35
|
+
|
|
36
|
+
**_Note_**: Only tenant admins can perform admin federation operations, service accounts do not have the required privileges. Therefore, the connection profile used must contain username and password or they must be provided through command arguments.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- Update to frodo-lib 2.0.0-8
|
|
41
|
+
|
|
10
42
|
## [2.0.0-5] - 2023-06-21
|
|
11
43
|
|
|
12
44
|
## [2.0.0-4] - 2023-06-16
|
|
@@ -1210,7 +1242,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1210
1242
|
- Fixed problem with adding connection profiles
|
|
1211
1243
|
- Miscellaneous bug fixes
|
|
1212
1244
|
|
|
1213
|
-
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-
|
|
1245
|
+
[Unreleased]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-6...HEAD
|
|
1246
|
+
|
|
1247
|
+
[2.0.0-6]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-5...v2.0.0-6
|
|
1214
1248
|
|
|
1215
1249
|
[2.0.0-5]: https://github.com/rockcarver/frodo-cli/compare/v2.0.0-4...v2.0.0-5
|
|
1216
1250
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { frodo } from '@rockcarver/frodo-lib';
|
|
2
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
3
|
+
import { Option } from 'commander';
|
|
4
|
+
import { printMessage, verboseMessage } from '../../utils/Console';
|
|
5
|
+
import { exportAdminFederationProviderToFile, exportAdminFederationProvidersToFile, exportAdminFederationProvidersToFiles } from '../../ops/AdminFederationOps';
|
|
6
|
+
const program = new FrodoCommand('frodo admin federation export', ['realm']);
|
|
7
|
+
program.description('Export admin federation providers.').addOption(new Option('-i, --idp-id <idp-id>', 'Id/name of a provider. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file [file]', 'Name of the file to write the exported provider(s) to. Ignored with -A.')).addOption(new Option('-a, --all', 'Export all the providers to a single file. Ignored with -t and -i.')).addOption(new Option('-A, --all-separate', 'Export all the providers as separate files <provider name>.admin.federation.json. Ignored with -t, -i, and -a.')).action(
|
|
8
|
+
// implement command logic inside action handler
|
|
9
|
+
async (host, user, password, options, command) => {
|
|
10
|
+
command.handleDefaultArgsAndOpts(host, user, password, options, command);
|
|
11
|
+
if (await frodo.login.getTokens(true)) {
|
|
12
|
+
// export by id/name
|
|
13
|
+
if (options.idpId) {
|
|
14
|
+
verboseMessage(`Exporting provider "${options.idpId}...`);
|
|
15
|
+
const outcome = await exportAdminFederationProviderToFile(options.idpId, options.file);
|
|
16
|
+
if (!outcome) process.exitCode = 1;
|
|
17
|
+
}
|
|
18
|
+
// --all -a
|
|
19
|
+
else if (options.all) {
|
|
20
|
+
verboseMessage('Exporting all providers to a single file...');
|
|
21
|
+
const outcome = await exportAdminFederationProvidersToFile(options.file);
|
|
22
|
+
if (!outcome) process.exitCode = 1;
|
|
23
|
+
}
|
|
24
|
+
// --all-separate -A
|
|
25
|
+
else if (options.allSeparate) {
|
|
26
|
+
verboseMessage('Exporting all providers to separate files...');
|
|
27
|
+
const outcome = await exportAdminFederationProvidersToFiles();
|
|
28
|
+
if (!outcome) process.exitCode = 1;
|
|
29
|
+
}
|
|
30
|
+
// unrecognized combination of options or no options
|
|
31
|
+
else {
|
|
32
|
+
printMessage('Unrecognized combination of options or no options...', 'error');
|
|
33
|
+
program.help();
|
|
34
|
+
process.exitCode = 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// end command logic inside action handler
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
program.parse();
|
|
42
|
+
//# sourceMappingURL=admin-federation-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-federation-export.js","names":["frodo","FrodoCommand","Option","printMessage","verboseMessage","exportAdminFederationProviderToFile","exportAdminFederationProvidersToFile","exportAdminFederationProvidersToFiles","program","description","addOption","action","host","user","password","options","command","handleDefaultArgsAndOpts","login","getTokens","idpId","outcome","file","process","exitCode","all","allSeparate","help","parse"],"sources":["cli/admin/admin-federation-export.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport {\n exportAdminFederationProviderToFile,\n exportAdminFederationProvidersToFile,\n exportAdminFederationProvidersToFiles,\n} from '../../ops/AdminFederationOps';\n\nconst program = new FrodoCommand('frodo admin federation export', ['realm']);\n\nprogram\n .description('Export admin federation providers.')\n .addOption(\n new Option(\n '-i, --idp-id <idp-id>',\n 'Id/name of a provider. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file [file]',\n 'Name of the file to write the exported provider(s) to. Ignored with -A.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Export all the providers to a single file. Ignored with -t and -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Export all the providers as separate files <provider name>.admin.federation.json. Ignored with -t, -i, and -a.'\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 if (await frodo.login.getTokens(true)) {\n // export by id/name\n if (options.idpId) {\n verboseMessage(`Exporting provider \"${options.idpId}...`);\n const outcome = await exportAdminFederationProviderToFile(\n options.idpId,\n options.file\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all -a\n else if (options.all) {\n verboseMessage('Exporting all providers to a single file...');\n const outcome = await exportAdminFederationProvidersToFile(\n options.file\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all-separate -A\n else if (options.allSeparate) {\n verboseMessage('Exporting all providers to separate files...');\n const outcome = await exportAdminFederationProvidersToFiles();\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage(\n 'Unrecognized combination of options or no options...',\n 'error'\n );\n program.help();\n process.exitCode = 1;\n }\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SACEC,mCAAmC,EACnCC,oCAAoC,EACpCC,qCAAqC,QAChC,8BAA8B;AAErC,MAAMC,OAAO,GAAG,IAAIP,YAAY,CAAC,+BAA+B,EAAE,CAAC,OAAO,CAAC,CAAC;AAE5EO,OAAO,CACJC,WAAW,CAAC,oCAAoC,CAAC,CACjDC,SAAS,CACR,IAAIR,MAAM,CACR,uBAAuB,EACvB,6DACF,CACF,CAAC,CACAQ,SAAS,CACR,IAAIR,MAAM,CACR,mBAAmB,EACnB,yEACF,CACF,CAAC,CACAQ,SAAS,CACR,IAAIR,MAAM,CACR,WAAW,EACX,oEACF,CACF,CAAC,CACAQ,SAAS,CACR,IAAIR,MAAM,CACR,oBAAoB,EACpB,gHACF,CACF,CAAC,CACAS,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EAChDA,OAAO,CAACC,wBAAwB,CAACL,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,CAAC;EACxE,IAAI,MAAMhB,KAAK,CAACkB,KAAK,CAACC,SAAS,CAAC,IAAI,CAAC,EAAE;IACrC;IACA,IAAIJ,OAAO,CAACK,KAAK,EAAE;MACjBhB,cAAc,CAAE,uBAAsBW,OAAO,CAACK,KAAM,KAAI,CAAC;MACzD,MAAMC,OAAO,GAAG,MAAMhB,mCAAmC,CACvDU,OAAO,CAACK,KAAK,EACbL,OAAO,CAACO,IACV,CAAC;MACD,IAAI,CAACD,OAAO,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpC;IACA;IAAA,KACK,IAAIT,OAAO,CAACU,GAAG,EAAE;MACpBrB,cAAc,CAAC,6CAA6C,CAAC;MAC7D,MAAMiB,OAAO,GAAG,MAAMf,oCAAoC,CACxDS,OAAO,CAACO,IACV,CAAC;MACD,IAAI,CAACD,OAAO,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpC;IACA;IAAA,KACK,IAAIT,OAAO,CAACW,WAAW,EAAE;MAC5BtB,cAAc,CAAC,8CAA8C,CAAC;MAC9D,MAAMiB,OAAO,GAAG,MAAMd,qCAAqC,CAAC,CAAC;MAC7D,IAAI,CAACc,OAAO,EAAEE,OAAO,CAACC,QAAQ,GAAG,CAAC;IACpC;IACA;IAAA,KACK;MACHrB,YAAY,CACV,sDAAsD,EACtD,OACF,CAAC;MACDK,OAAO,CAACmB,IAAI,CAAC,CAAC;MACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;IACtB;EACF;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { frodo } from '@rockcarver/frodo-lib';
|
|
2
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
3
|
+
import { Option } from 'commander';
|
|
4
|
+
import { printMessage, verboseMessage } from '../../utils/Console';
|
|
5
|
+
import { importAdminFederationProviderFromFile, importAdminFederationProvidersFromFile, importAdminFederationProvidersFromFiles, importFirstAdminFederationProviderFromFile } from '../../ops/AdminFederationOps';
|
|
6
|
+
const program = new FrodoCommand('frodo admin federation import', ['realm']);
|
|
7
|
+
program.description('Import admin federation providers.').addOption(new Option('-i, --idp-id <id>', 'Provider id. If specified, -a and -A are ignored.')).addOption(new Option('-f, --file <file>', 'Name of the file to import the provider(s) from.')).addOption(new Option('-a, --all', 'Import all the providers from single file. Ignored with -t or -i.')).addOption(new Option('-A, --all-separate', 'Import all the providers from separate files (*.admin.federation.json) in the current directory. Ignored with -t or -i or -a.')).action(
|
|
8
|
+
// implement command logic inside action handler
|
|
9
|
+
async (host, user, password, options, command) => {
|
|
10
|
+
command.handleDefaultArgsAndOpts(host, user, password, options, command);
|
|
11
|
+
// import by id
|
|
12
|
+
if (options.file && options.idpId && (await frodo.login.getTokens(true))) {
|
|
13
|
+
verboseMessage(`Importing provider "${options.idpId}"...`);
|
|
14
|
+
const outcome = await importAdminFederationProviderFromFile(options.idpId, options.file);
|
|
15
|
+
if (!outcome) process.exitCode = 1;
|
|
16
|
+
}
|
|
17
|
+
// --all -a
|
|
18
|
+
else if (options.all && options.file && (await frodo.login.getTokens(true))) {
|
|
19
|
+
verboseMessage(`Importing all providers from a single file (${options.file})...`);
|
|
20
|
+
const outcome = await importAdminFederationProvidersFromFile(options.file);
|
|
21
|
+
if (!outcome) process.exitCode = 1;
|
|
22
|
+
}
|
|
23
|
+
// --all-separate -A
|
|
24
|
+
else if (options.allSeparate && !options.file && (await frodo.login.getTokens(true))) {
|
|
25
|
+
verboseMessage('Importing all providers from separate files in current directory...');
|
|
26
|
+
const outcome = await importAdminFederationProvidersFromFiles();
|
|
27
|
+
if (!outcome) process.exitCode = 1;
|
|
28
|
+
}
|
|
29
|
+
// import first provider from file
|
|
30
|
+
else if (options.file && (await frodo.login.getTokens(true))) {
|
|
31
|
+
verboseMessage(`Importing first provider from file "${options.file}"...`);
|
|
32
|
+
const outcome = await importFirstAdminFederationProviderFromFile(options.file);
|
|
33
|
+
if (!outcome) process.exitCode = 1;
|
|
34
|
+
}
|
|
35
|
+
// unrecognized combination of options or no options
|
|
36
|
+
else {
|
|
37
|
+
printMessage('Unrecognized combination of options or no options...');
|
|
38
|
+
program.help();
|
|
39
|
+
process.exitCode = 1;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// end command logic inside action handler
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
program.parse();
|
|
46
|
+
//# sourceMappingURL=admin-federation-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-federation-import.js","names":["frodo","FrodoCommand","Option","printMessage","verboseMessage","importAdminFederationProviderFromFile","importAdminFederationProvidersFromFile","importAdminFederationProvidersFromFiles","importFirstAdminFederationProviderFromFile","program","description","addOption","action","host","user","password","options","command","handleDefaultArgsAndOpts","file","idpId","login","getTokens","outcome","process","exitCode","all","allSeparate","help","parse"],"sources":["cli/admin/admin-federation-import.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { FrodoCommand } from '../FrodoCommand';\nimport { Option } from 'commander';\nimport { printMessage, verboseMessage } from '../../utils/Console';\nimport {\n importAdminFederationProviderFromFile,\n importAdminFederationProvidersFromFile,\n importAdminFederationProvidersFromFiles,\n importFirstAdminFederationProviderFromFile,\n} from '../../ops/AdminFederationOps';\n\nconst program = new FrodoCommand('frodo admin federation import', ['realm']);\n\nprogram\n .description('Import admin federation providers.')\n .addOption(\n new Option(\n '-i, --idp-id <id>',\n 'Provider id. If specified, -a and -A are ignored.'\n )\n )\n .addOption(\n new Option(\n '-f, --file <file>',\n 'Name of the file to import the provider(s) from.'\n )\n )\n .addOption(\n new Option(\n '-a, --all',\n 'Import all the providers from single file. Ignored with -t or -i.'\n )\n )\n .addOption(\n new Option(\n '-A, --all-separate',\n 'Import all the providers from separate files (*.admin.federation.json) in the current directory. Ignored with -t or -i or -a.'\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 // import by id\n if (\n options.file &&\n options.idpId &&\n (await frodo.login.getTokens(true))\n ) {\n verboseMessage(`Importing provider \"${options.idpId}\"...`);\n const outcome = await importAdminFederationProviderFromFile(\n options.idpId,\n options.file\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all -a\n else if (\n options.all &&\n options.file &&\n (await frodo.login.getTokens(true))\n ) {\n verboseMessage(\n `Importing all providers from a single file (${options.file})...`\n );\n const outcome = await importAdminFederationProvidersFromFile(\n options.file\n );\n if (!outcome) process.exitCode = 1;\n }\n // --all-separate -A\n else if (\n options.allSeparate &&\n !options.file &&\n (await frodo.login.getTokens(true))\n ) {\n verboseMessage(\n 'Importing all providers from separate files in current directory...'\n );\n const outcome = await importAdminFederationProvidersFromFiles();\n if (!outcome) process.exitCode = 1;\n }\n // import first provider from file\n else if (options.file && (await frodo.login.getTokens(true))) {\n verboseMessage(\n `Importing first provider from file \"${options.file}\"...`\n );\n const outcome = await importFirstAdminFederationProviderFromFile(\n options.file\n );\n if (!outcome) process.exitCode = 1;\n }\n // unrecognized combination of options or no options\n else {\n printMessage('Unrecognized combination of options or no options...');\n program.help();\n process.exitCode = 1;\n }\n }\n // end command logic inside action handler\n );\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,YAAY,EAAEC,cAAc,QAAQ,qBAAqB;AAClE,SACEC,qCAAqC,EACrCC,sCAAsC,EACtCC,uCAAuC,EACvCC,0CAA0C,QACrC,8BAA8B;AAErC,MAAMC,OAAO,GAAG,IAAIR,YAAY,CAAC,+BAA+B,EAAE,CAAC,OAAO,CAAC,CAAC;AAE5EQ,OAAO,CACJC,WAAW,CAAC,oCAAoC,CAAC,CACjDC,SAAS,CACR,IAAIT,MAAM,CACR,mBAAmB,EACnB,mDACF,CACF,CAAC,CACAS,SAAS,CACR,IAAIT,MAAM,CACR,mBAAmB,EACnB,kDACF,CACF,CAAC,CACAS,SAAS,CACR,IAAIT,MAAM,CACR,WAAW,EACX,mEACF,CACF,CAAC,CACAS,SAAS,CACR,IAAIT,MAAM,CACR,oBAAoB,EACpB,+HACF,CACF,CAAC,CACAU,MAAM;AACL;AACA,OAAOC,I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AAK,CAACC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;IAC5DlB,cAAc,CACX,uCAAsCY,OAAO,CAACG,IAAK,MACtD,CAAC;IACD,MAAMI,OAAO,GAAG,MAAMf,0CAA0C,CAC9DQ,OAAO,CAACG,IACV,CAAC;IACD,IAAI,CAACI,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC;EACA;EAAA,KACK;IACHtB,YAAY,CAAC,sDAAsD,CAAC;IACpEM,OAAO,CAACmB,IAAI,CAAC,CAAC;IACdJ,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHhB,OAAO,CAACoB,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { frodo } from '@rockcarver/frodo-lib';
|
|
2
|
+
import { FrodoCommand } from '../FrodoCommand';
|
|
3
|
+
import { verboseMessage } from '../../utils/Console';
|
|
4
|
+
import { listAdminFederationProviders } from '../../ops/AdminFederationOps';
|
|
5
|
+
const program = new FrodoCommand('frodo admin federation list', ['realm']);
|
|
6
|
+
program.description('List admin federation providers.')
|
|
7
|
+
// .addOption(
|
|
8
|
+
// new Option('-l, --long', 'Long with all fields.').default(false, 'false')
|
|
9
|
+
// )
|
|
10
|
+
.action(
|
|
11
|
+
// implement command logic inside action handler
|
|
12
|
+
async (host, user, password, options, command) => {
|
|
13
|
+
command.handleDefaultArgsAndOpts(host, user, password, options, command);
|
|
14
|
+
if (await frodo.login.getTokens(true)) {
|
|
15
|
+
verboseMessage(`Listing admin federation providers...`);
|
|
16
|
+
const outcome = await listAdminFederationProviders();
|
|
17
|
+
if (!outcome) process.exitCode = 1;
|
|
18
|
+
} else {
|
|
19
|
+
process.exitCode = 1;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// end command logic inside action handler
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
program.parse();
|
|
26
|
+
//# sourceMappingURL=admin-federation-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-federation-list.js","names":["frodo","FrodoCommand","verboseMessage","listAdminFederationProviders","program","description","action","host","user","password","options","command","handleDefaultArgsAndOpts","login","getTokens","outcome","process","exitCode","parse"],"sources":["cli/admin/admin-federation-list.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport { FrodoCommand } from '../FrodoCommand';\nimport { verboseMessage } from '../../utils/Console';\nimport { listAdminFederationProviders } from '../../ops/AdminFederationOps';\n\nconst program = new FrodoCommand('frodo admin federation list', ['realm']);\n\nprogram\n .description('List admin federation providers.')\n // .addOption(\n // new Option('-l, --long', 'Long with all fields.').default(false, 'false')\n // )\n .action(\n // implement command logic inside action handler\n async (host, user, password, options, command) => {\n command.handleDefaultArgsAndOpts(host, user, password, options, command);\n if (await frodo.login.getTokens(true)) {\n verboseMessage(`Listing admin federation providers...`);\n const outcome = await listAdminFederationProviders();\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;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SAASC,4BAA4B,QAAQ,8BAA8B;AAE3E,MAAMC,OAAO,GAAG,IAAIH,YAAY,CAAC,6BAA6B,EAAE,CAAC,OAAO,CAAC,CAAC;AAE1EG,OAAO,CACJC,WAAW,CAAC,kCAAkC;AAC/C;AACA;AACA;AAAA,CACCC,MAAM;AACL;AACA,OAAOC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,KAAK;EAChDA,OAAO,CAACC,wBAAwB,CAACL,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,CAAC;EACxE,IAAI,MAAMX,KAAK,CAACa,KAAK,CAACC,SAAS,CAAC,IAAI,CAAC,EAAE;IACrCZ,cAAc,CAAE,uCAAsC,CAAC;IACvD,MAAMa,OAAO,GAAG,MAAMZ,4BAA4B,CAAC,CAAC;IACpD,IAAI,CAACY,OAAO,EAAEC,OAAO,CAACC,QAAQ,GAAG,CAAC;EACpC,CAAC,MAAM;IACLD,OAAO,CAACC,QAAQ,GAAG,CAAC;EACtB;AACF;AACA;AACF,CAAC;;AAEHb,OAAO,CAACc,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FrodoStubCommand } from '../FrodoCommand';
|
|
2
|
+
const program = new FrodoStubCommand('frodo admin federation');
|
|
3
|
+
program.description('Manages admin federation configuration.');
|
|
4
|
+
|
|
5
|
+
// program.command('delete', 'Delete admin federation provider.');
|
|
6
|
+
|
|
7
|
+
// program.command('describe', 'Describe admin federation provider.');
|
|
8
|
+
|
|
9
|
+
program.command('export', 'Export admin federation providers.');
|
|
10
|
+
program.command('import', 'Import admin federation providers.');
|
|
11
|
+
program.command('list', 'List admin federation providers.');
|
|
12
|
+
program.parse();
|
|
13
|
+
//# sourceMappingURL=admin-federation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-federation.js","names":["FrodoStubCommand","program","description","command","parse"],"sources":["cli/admin/admin-federation.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\n\nconst program = new FrodoStubCommand('frodo admin federation');\n\nprogram.description('Manages admin federation configuration.');\n\n// program.command('delete', 'Delete admin federation provider.');\n\n// program.command('describe', 'Describe admin federation provider.');\n\nprogram.command('export', 'Export admin federation providers.');\n\nprogram.command('import', 'Import admin federation providers.');\n\nprogram.command('list', 'List admin federation providers.');\n\nprogram.parse();\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAElD,MAAMC,OAAO,GAAG,IAAID,gBAAgB,CAAC,wBAAwB,CAAC;AAE9DC,OAAO,CAACC,WAAW,CAAC,yCAAyC,CAAC;;AAE9D;;AAEA;;AAEAD,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oCAAoC,CAAC;AAE/DF,OAAO,CAACE,OAAO,CAAC,QAAQ,EAAE,oCAAoC,CAAC;AAE/DF,OAAO,CAACE,OAAO,CAAC,MAAM,EAAE,kCAAkC,CAAC;AAE3DF,OAAO,CAACG,KAAK,CAAC,CAAC"}
|
package/esm/cli/admin/admin.js
CHANGED
|
@@ -4,6 +4,7 @@ import { fileURLToPath } from 'url';
|
|
|
4
4
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
5
|
export default function setup() {
|
|
6
6
|
const program = new FrodoStubCommand('admin').description('Platform admin tasks.').executableDir(__dirname);
|
|
7
|
+
program.command('federation', 'Manage admin federation configuration.');
|
|
7
8
|
program.command('create-oauth2-client-with-admin-privileges', 'Create an oauth2 client with admin privileges.');
|
|
8
9
|
program.command('get-access-token', 'Get an access token using client credentials grant type.');
|
|
9
10
|
program.command('list-oauth2-clients-with-admin-privileges', 'List oauth2 clients with admin privileges.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","names":["FrodoStubCommand","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["cli/admin/admin.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\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(\n 'create-oauth2-client-with-admin-privileges',\n 'Create an oauth2 client with admin privileges.'\n );\n\n program.command(\n 'get-access-token',\n 'Get an access token using client credentials grant type.'\n );\n\n program.command(\n 'list-oauth2-clients-with-admin-privileges',\n 'List oauth2 clients with admin privileges.'\n );\n\n program.command(\n 'grant-oauth2-client-admin-privileges',\n 'Grant an oauth2 client admin privileges.'\n );\n\n program.command(\n 'revoke-oauth2-client-admin-privileges',\n 'Revoke admin privileges from an oauth2 client.'\n );\n\n program.command(\n 'list-oauth2-clients-with-custom-privileges',\n 'List oauth2 clients with custom privileges.'\n );\n\n program.command(\n 'list-static-user-mappings',\n 'List all subjects of static user mappings that are not oauth2 clients.'\n );\n\n program.command(\n 'remove-static-user-mapping',\n \"Remove a subject's static user mapping.\"\n );\n\n program.command(\n 'add-autoid-static-user-mapping',\n 'Add AutoId static user mapping to enable dashboards and other AutoId-based functionality.'\n );\n\n program.command(\n 'hide-generic-extension-attributes',\n 'Hide generic extension attributes.'\n );\n\n program.command(\n 'show-generic-extension-attributes',\n 'Show generic extension attributes.'\n );\n\n program.command('repair-org-model', 'Repair org model.');\n\n return program;\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAClD,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIT,gBAAgB,CAAC,OAAO,CAAC,CAC1CU,WAAW,CAAC,uBAAuB,CAAC,CACpCC,aAAa,CAACR,SAAS,CAAC;EAE3BM,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,kBAAkB,EAClB,0DACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2CAA2C,EAC3C,4CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,sCAAsC,EACtC,0CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,uCAAuC,EACvC,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,6CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2BAA2B,EAC3B,wEACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4BAA4B,EAC5B,yCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,gCAAgC,EAChC,2FACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;EAExD,OAAOH,OAAO;AAChB"}
|
|
1
|
+
{"version":3,"file":"admin.js","names":["FrodoStubCommand","path","fileURLToPath","__dirname","dirname","import","meta","url","setup","program","description","executableDir","command"],"sources":["cli/admin/admin.ts"],"sourcesContent":["import { FrodoStubCommand } from '../FrodoCommand';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\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 'get-access-token',\n 'Get an access token using client credentials grant type.'\n );\n\n program.command(\n 'list-oauth2-clients-with-admin-privileges',\n 'List oauth2 clients with admin privileges.'\n );\n\n program.command(\n 'grant-oauth2-client-admin-privileges',\n 'Grant an oauth2 client admin privileges.'\n );\n\n program.command(\n 'revoke-oauth2-client-admin-privileges',\n 'Revoke admin privileges from an oauth2 client.'\n );\n\n program.command(\n 'list-oauth2-clients-with-custom-privileges',\n 'List oauth2 clients with custom privileges.'\n );\n\n program.command(\n 'list-static-user-mappings',\n 'List all subjects of static user mappings that are not oauth2 clients.'\n );\n\n program.command(\n 'remove-static-user-mapping',\n \"Remove a subject's static user mapping.\"\n );\n\n program.command(\n 'add-autoid-static-user-mapping',\n 'Add AutoId static user mapping to enable dashboards and other AutoId-based functionality.'\n );\n\n program.command(\n 'hide-generic-extension-attributes',\n 'Hide generic extension attributes.'\n );\n\n program.command(\n 'show-generic-extension-attributes',\n 'Show generic extension attributes.'\n );\n\n program.command('repair-org-model', 'Repair org model.');\n\n return program;\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,iBAAiB;AAClD,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AAEnC,MAAMC,SAAS,GAAGF,IAAI,CAACG,OAAO,CAACF,aAAa,CAACG,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAE9D,eAAe,SAASC,KAAKA,CAAA,EAAG;EAC9B,MAAMC,OAAO,GAAG,IAAIT,gBAAgB,CAAC,OAAO,CAAC,CAC1CU,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,kBAAkB,EAClB,0DACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2CAA2C,EAC3C,4CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,sCAAsC,EACtC,0CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,uCAAuC,EACvC,gDACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4CAA4C,EAC5C,6CACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,2BAA2B,EAC3B,wEACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,4BAA4B,EAC5B,yCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,gCAAgC,EAChC,2FACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CACb,mCAAmC,EACnC,oCACF,CAAC;EAEDH,OAAO,CAACG,OAAO,CAAC,kBAAkB,EAAE,mBAAmB,CAAC;EAExD,OAAOH,OAAO;AAChB"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { frodo } from '@rockcarver/frodo-lib';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { createProgressBar, debugMessage, failSpinner, printMessage, showSpinner, stopProgressBar, succeedSpinner, updateProgressBar } from '../utils/Console';
|
|
4
|
+
import { getTypedFilename, saveJsonToFile } from '../utils/ExportImportUtils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* List providers
|
|
8
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
9
|
+
*/
|
|
10
|
+
export async function listAdminFederationProviders() {
|
|
11
|
+
let outcome = false;
|
|
12
|
+
try {
|
|
13
|
+
const providers = await frodo.cloud.adminFed.getAdminFederationProviders();
|
|
14
|
+
providers.sort((a, b) => a._id.localeCompare(b._id));
|
|
15
|
+
providers.forEach(socialIdentityProvider => {
|
|
16
|
+
printMessage(`${socialIdentityProvider._id}`, 'data');
|
|
17
|
+
});
|
|
18
|
+
outcome = true;
|
|
19
|
+
} catch (err) {
|
|
20
|
+
printMessage(`listAdminFederationProviders ERROR: ${err.message}`, 'error');
|
|
21
|
+
printMessage(err, 'error');
|
|
22
|
+
}
|
|
23
|
+
return outcome;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Export provider by id
|
|
28
|
+
* @param {string} providerId provider id/name
|
|
29
|
+
* @param {string} file optional export file name
|
|
30
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
31
|
+
*/
|
|
32
|
+
export async function exportAdminFederationProviderToFile(providerId, file = '') {
|
|
33
|
+
let outcome = false;
|
|
34
|
+
let fileName = file;
|
|
35
|
+
if (!fileName) {
|
|
36
|
+
fileName = getTypedFilename(providerId, 'admin.federation');
|
|
37
|
+
}
|
|
38
|
+
createProgressBar(1, `Exporting ${providerId}`);
|
|
39
|
+
try {
|
|
40
|
+
updateProgressBar(`Writing file ${fileName}`);
|
|
41
|
+
const fileData = await frodo.cloud.adminFed.exportAdminFederationProvider(providerId);
|
|
42
|
+
saveJsonToFile(fileData, fileName);
|
|
43
|
+
stopProgressBar(`Exported ${providerId['brightCyan']} to ${fileName['brightCyan']}.`);
|
|
44
|
+
outcome = true;
|
|
45
|
+
} catch (err) {
|
|
46
|
+
stopProgressBar(`${err}`);
|
|
47
|
+
printMessage(`${err}`, 'error');
|
|
48
|
+
}
|
|
49
|
+
return outcome;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Export all providers
|
|
54
|
+
* @param {string} file optional export file name
|
|
55
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
56
|
+
*/
|
|
57
|
+
export async function exportAdminFederationProvidersToFile(file = '') {
|
|
58
|
+
let outcome = false;
|
|
59
|
+
showSpinner(`Exporting all providers...`);
|
|
60
|
+
try {
|
|
61
|
+
let fileName = file;
|
|
62
|
+
if (!fileName) {
|
|
63
|
+
fileName = getTypedFilename(`allProviders`, 'admin.federation');
|
|
64
|
+
}
|
|
65
|
+
const fileData = await frodo.cloud.adminFed.exportAdminFederationProviders();
|
|
66
|
+
saveJsonToFile(fileData, fileName);
|
|
67
|
+
succeedSpinner(`Exported all providers to ${fileName}`);
|
|
68
|
+
outcome = true;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
var _error$response;
|
|
71
|
+
failSpinner(`Error exporting all providers.`);
|
|
72
|
+
printMessage(((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) || error, 'error');
|
|
73
|
+
}
|
|
74
|
+
return outcome;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Export all providers to individual files
|
|
79
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
80
|
+
*/
|
|
81
|
+
export async function exportAdminFederationProvidersToFiles() {
|
|
82
|
+
let outcome = false;
|
|
83
|
+
try {
|
|
84
|
+
const allIdpsData = await frodo.cloud.adminFed.getAdminFederationProviders();
|
|
85
|
+
createProgressBar(allIdpsData.length, 'Exporting providers');
|
|
86
|
+
for (const idpData of allIdpsData) {
|
|
87
|
+
updateProgressBar(`Writing provider ${idpData._id}`);
|
|
88
|
+
const fileName = getTypedFilename(idpData._id, 'admin.federation');
|
|
89
|
+
const fileData = await frodo.cloud.adminFed.exportAdminFederationProvider(idpData._id);
|
|
90
|
+
saveJsonToFile(fileData, fileName);
|
|
91
|
+
}
|
|
92
|
+
stopProgressBar(`${allIdpsData.length} providers exported.`);
|
|
93
|
+
outcome = true;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
var _error$response2;
|
|
96
|
+
failSpinner(`Error exporting all providers.`);
|
|
97
|
+
printMessage(((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) || error, 'error');
|
|
98
|
+
}
|
|
99
|
+
return outcome;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Import provider by id/name
|
|
104
|
+
* @param {string} providerId provider id/name
|
|
105
|
+
* @param {string} file import file name
|
|
106
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
107
|
+
*/
|
|
108
|
+
export async function importAdminFederationProviderFromFile(providerId, file) {
|
|
109
|
+
let outcome = false;
|
|
110
|
+
showSpinner(`Importing provider ${providerId} from ${file}...`);
|
|
111
|
+
try {
|
|
112
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
113
|
+
const fileData = JSON.parse(data);
|
|
114
|
+
await frodo.cloud.adminFed.importAdminFederationProvider(providerId, fileData);
|
|
115
|
+
succeedSpinner(`Successfully imported provider ${providerId} from ${file}.`);
|
|
116
|
+
outcome = true;
|
|
117
|
+
} catch (error) {
|
|
118
|
+
var _error$response3;
|
|
119
|
+
failSpinner(`Error importing provider ${providerId} from ${file}.`);
|
|
120
|
+
printMessage(((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data) || error, 'error');
|
|
121
|
+
}
|
|
122
|
+
return outcome;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Import first provider from file
|
|
127
|
+
* @param {String} file import file name
|
|
128
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
129
|
+
*/
|
|
130
|
+
export async function importFirstAdminFederationProviderFromFile(file) {
|
|
131
|
+
let outcome = false;
|
|
132
|
+
debugMessage(`cli.AdminFederationOps.importFirstAdminFederationProviderFromFile: begin`);
|
|
133
|
+
showSpinner(`Importing first provider from ${file}...`);
|
|
134
|
+
try {
|
|
135
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
136
|
+
const fileData = JSON.parse(data);
|
|
137
|
+
await frodo.cloud.adminFed.importFirstAdminFederationProvider(fileData);
|
|
138
|
+
succeedSpinner(`Successfully imported first provider from ${file}.`);
|
|
139
|
+
outcome = true;
|
|
140
|
+
} catch (error) {
|
|
141
|
+
var _error$response4;
|
|
142
|
+
failSpinner(`Error importing first provider from ${file}.`);
|
|
143
|
+
printMessage(((_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.data) || error, 'error');
|
|
144
|
+
}
|
|
145
|
+
debugMessage(`cli.AdminFederationOps.importFirstAdminFederationProviderFromFile: end`);
|
|
146
|
+
return outcome;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Import all providers from file
|
|
151
|
+
* @param {string} file import file name
|
|
152
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
153
|
+
*/
|
|
154
|
+
export async function importAdminFederationProvidersFromFile(file) {
|
|
155
|
+
let outcome = false;
|
|
156
|
+
debugMessage(`cli.AdminFederationOps.importAdminFederationProvidersFromFile: begin`);
|
|
157
|
+
showSpinner(`Importing providers from ${file}...`);
|
|
158
|
+
try {
|
|
159
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
160
|
+
const fileData = JSON.parse(data);
|
|
161
|
+
await frodo.cloud.adminFed.importAdminFederationProviders(fileData);
|
|
162
|
+
succeedSpinner(`Imported providers from ${file}.`);
|
|
163
|
+
outcome = true;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
var _error$response5;
|
|
166
|
+
failSpinner(`Error importing ${file}.`);
|
|
167
|
+
printMessage(((_error$response5 = error.response) === null || _error$response5 === void 0 ? void 0 : _error$response5.data) || error, 'error');
|
|
168
|
+
}
|
|
169
|
+
debugMessage(`cli.AdminFederationOps.importAdminFederationProvidersFromFile: end`);
|
|
170
|
+
return outcome;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Import providers from *.idp.json files in current working directory
|
|
175
|
+
* @returns {Promise<boolean>} true if successful, false otherwise
|
|
176
|
+
*/
|
|
177
|
+
export async function importAdminFederationProvidersFromFiles() {
|
|
178
|
+
const errors = [];
|
|
179
|
+
try {
|
|
180
|
+
debugMessage(`cli.AdminFederationOps.importAdminFederationProvidersFromFiles: begin`);
|
|
181
|
+
const names = fs.readdirSync('.');
|
|
182
|
+
const files = names.filter(name => name.toLowerCase().endsWith('.admin.federation.json'));
|
|
183
|
+
createProgressBar(files.length, 'Importing providers...');
|
|
184
|
+
let total = 0;
|
|
185
|
+
for (const file of files) {
|
|
186
|
+
try {
|
|
187
|
+
const data = fs.readFileSync(file, 'utf8');
|
|
188
|
+
const fileData = JSON.parse(data);
|
|
189
|
+
const count = Object.keys(fileData.idp).length;
|
|
190
|
+
total += count;
|
|
191
|
+
await frodo.cloud.adminFed.importAdminFederationProviders(fileData);
|
|
192
|
+
updateProgressBar(`Imported ${count} provider(s) from ${file}`);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
errors.push(error);
|
|
195
|
+
updateProgressBar(`Error importing provider(s) from ${file}`);
|
|
196
|
+
printMessage(error, 'error');
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
stopProgressBar(`Finished importing ${total} provider(s) from ${files.length} file(s).`);
|
|
200
|
+
} catch (error) {
|
|
201
|
+
errors.push(error);
|
|
202
|
+
stopProgressBar(`Error importing provider(s) from file(s).`);
|
|
203
|
+
printMessage(error, 'error');
|
|
204
|
+
}
|
|
205
|
+
debugMessage(`cli.AdminFederationOps.importAdminFederationProvidersFromFiles: end`);
|
|
206
|
+
return 0 === errors.length;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=AdminFederationOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminFederationOps.js","names":["frodo","fs","createProgressBar","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","getTypedFilename","saveJsonToFile","listAdminFederationProviders","outcome","providers","cloud","adminFed","getAdminFederationProviders","sort","a","b","_id","localeCompare","forEach","socialIdentityProvider","err","message","exportAdminFederationProviderToFile","providerId","file","fileName","fileData","exportAdminFederationProvider","exportAdminFederationProvidersToFile","exportAdminFederationProviders","error","_error$response","response","data","exportAdminFederationProvidersToFiles","allIdpsData","length","idpData","_error$response2","importAdminFederationProviderFromFile","readFileSync","JSON","parse","importAdminFederationProvider","_error$response3","importFirstAdminFederationProviderFromFile","importFirstAdminFederationProvider","_error$response4","importAdminFederationProvidersFromFile","importAdminFederationProviders","_error$response5","importAdminFederationProvidersFromFiles","errors","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","idp","push"],"sources":["ops/AdminFederationOps.ts"],"sourcesContent":["import { frodo } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createProgressBar,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { getTypedFilename, saveJsonToFile } from '../utils/ExportImportUtils';\n\n/**\n * List providers\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function listAdminFederationProviders(): Promise<boolean> {\n let outcome = false;\n try {\n const providers = await frodo.cloud.adminFed.getAdminFederationProviders();\n providers.sort((a, b) => a._id.localeCompare(b._id));\n providers.forEach((socialIdentityProvider) => {\n printMessage(`${socialIdentityProvider._id}`, 'data');\n });\n outcome = true;\n } catch (err) {\n printMessage(`listAdminFederationProviders ERROR: ${err.message}`, 'error');\n printMessage(err, 'error');\n }\n return outcome;\n}\n\n/**\n * Export provider by id\n * @param {string} providerId provider id/name\n * @param {string} file optional export file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportAdminFederationProviderToFile(\n providerId: string,\n file = ''\n): Promise<boolean> {\n let outcome = false;\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(providerId, 'admin.federation');\n }\n createProgressBar(1, `Exporting ${providerId}`);\n try {\n updateProgressBar(`Writing file ${fileName}`);\n const fileData = await frodo.cloud.adminFed.exportAdminFederationProvider(\n providerId\n );\n saveJsonToFile(fileData, fileName);\n stopProgressBar(\n `Exported ${providerId['brightCyan']} to ${fileName['brightCyan']}.`\n );\n outcome = true;\n } catch (err) {\n stopProgressBar(`${err}`);\n printMessage(`${err}`, 'error');\n }\n return outcome;\n}\n\n/**\n * Export all providers\n * @param {string} file optional export file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportAdminFederationProvidersToFile(\n file = ''\n): Promise<boolean> {\n let outcome = false;\n showSpinner(`Exporting all providers...`);\n try {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(`allProviders`, 'admin.federation');\n }\n const fileData =\n await frodo.cloud.adminFed.exportAdminFederationProviders();\n saveJsonToFile(fileData, fileName);\n succeedSpinner(`Exported all providers to ${fileName}`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all providers.`);\n printMessage(error.response?.data || error, 'error');\n }\n return outcome;\n}\n\n/**\n * Export all providers to individual files\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportAdminFederationProvidersToFiles(): Promise<boolean> {\n let outcome = false;\n try {\n const allIdpsData =\n await frodo.cloud.adminFed.getAdminFederationProviders();\n createProgressBar(allIdpsData.length, 'Exporting providers');\n for (const idpData of allIdpsData) {\n updateProgressBar(`Writing provider ${idpData._id}`);\n const fileName = getTypedFilename(idpData._id, 'admin.federation');\n const fileData = await frodo.cloud.adminFed.exportAdminFederationProvider(\n idpData._id\n );\n saveJsonToFile(fileData, fileName);\n }\n stopProgressBar(`${allIdpsData.length} providers exported.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all providers.`);\n printMessage(error.response?.data || error, 'error');\n }\n return outcome;\n}\n\n/**\n * Import provider by id/name\n * @param {string} providerId provider id/name\n * @param {string} file import file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importAdminFederationProviderFromFile(\n providerId: string,\n file: string\n): Promise<boolean> {\n let outcome = false;\n showSpinner(`Importing provider ${providerId} from ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.cloud.adminFed.importAdminFederationProvider(\n providerId,\n fileData\n );\n succeedSpinner(\n `Successfully imported provider ${providerId} from ${file}.`\n );\n outcome = true;\n } catch (error) {\n failSpinner(`Error importing provider ${providerId} from ${file}.`);\n printMessage(error.response?.data || error, 'error');\n }\n return outcome;\n}\n\n/**\n * Import first provider from file\n * @param {String} file import file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstAdminFederationProviderFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(\n `cli.AdminFederationOps.importFirstAdminFederationProviderFromFile: begin`\n );\n showSpinner(`Importing first provider from ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.cloud.adminFed.importFirstAdminFederationProvider(fileData);\n succeedSpinner(`Successfully imported first provider from ${file}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error importing first provider from ${file}.`);\n printMessage(error.response?.data || error, 'error');\n }\n debugMessage(\n `cli.AdminFederationOps.importFirstAdminFederationProviderFromFile: end`\n );\n return outcome;\n}\n\n/**\n * Import all providers from file\n * @param {string} file import file name\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importAdminFederationProvidersFromFile(\n file: string\n): Promise<boolean> {\n let outcome = false;\n debugMessage(\n `cli.AdminFederationOps.importAdminFederationProvidersFromFile: begin`\n );\n showSpinner(`Importing providers from ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.cloud.adminFed.importAdminFederationProviders(fileData);\n succeedSpinner(`Imported providers from ${file}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error.response?.data || error, 'error');\n }\n debugMessage(\n `cli.AdminFederationOps.importAdminFederationProvidersFromFile: end`\n );\n return outcome;\n}\n\n/**\n * Import providers from *.idp.json files in current working directory\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importAdminFederationProvidersFromFiles(): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(\n `cli.AdminFederationOps.importAdminFederationProvidersFromFiles: begin`\n );\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.admin.federation.json')\n );\n createProgressBar(files.length, 'Importing providers...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n const count = Object.keys(fileData.idp).length;\n total += count;\n await frodo.cloud.adminFed.importAdminFederationProviders(fileData);\n updateProgressBar(`Imported ${count} provider(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing provider(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} provider(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing provider(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(\n `cli.AdminFederationOps.importAdminFederationProvidersFromFiles: end`\n );\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,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AC;IACzD,IAAIwB,KAAK,GAAG,CAAC;IACb,KAAK,MAAMpC,IAAI,IAAI+B,KAAK,EAAE;MACxB,IAAI;QACF,MAAMtB,IAAI,GAAGrC,EAAE,CAAC4C,YAAY,CAAChB,IAAI,EAAE,MAAM,CAAC;QAC1C,MAAME,QAAQ,GAAGe,IAAI,CAACC,KAAK,CAACT,IAAI,CAAC;QACjC,MAAM4B,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACrC,QAAQ,CAACsC,GAAG,CAAC,CAAC5B,MAAM;QAC9CwB,KAAK,IAAIC,KAAK;QACd,MAAMlE,KAAK,CAACe,KAAK,CAACC,QAAQ,CAACsC,8BAA8B,CAACvB,QAAQ,CAAC;QACnEtB,iBAAiB,CAAE,YAAWyD,KAAM,qBAAoBrC,IAAK,EAAC,CAAC;MACjE,CAAC,CAAC,OAAOM,KAAK,EAAE;QACdsB,MAAM,CAACa,IAAI,CAACnC,KAAK,CAAC;QAClB1B,iBAAiB,CAAE,oCAAmCoB,IAAK,EAAC,CAAC;QAC7DxB,YAAY,CAAC8B,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACA5B,eAAe,CACZ,sBAAqB0D,KAAM,qBAAoBL,KAAK,CAACnB,MAAO,WAC/D,CAAC;EACH,CAAC,CAAC,OAAON,KAAK,EAAE;IACdsB,MAAM,CAACa,IAAI,CAACnC,KAAK,CAAC;IAClB5B,eAAe,CAAE,2CAA0C,CAAC;IAC5DF,YAAY,CAAC8B,KAAK,EAAE,OAAO,CAAC;EAC9B;EACAhC,YAAY,CACT,qEACH,CAAC;EACD,OAAO,CAAC,KAAKsD,MAAM,CAAChB,MAAM;AAC5B"}
|
|
@@ -28,7 +28,7 @@ export async function listOAuth2Clients(long = false) {
|
|
|
28
28
|
'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer'
|
|
29
29
|
};
|
|
30
30
|
clients.forEach(client => {
|
|
31
|
-
table.push([client._id, client.coreOAuth2ClientConfig.status === 'Active' ? 'Active'['brightGreen'] : client.coreOAuth2ClientConfig.status
|
|
31
|
+
table.push([client._id, client.coreOAuth2ClientConfig.status === 'Active' ? 'Active'['brightGreen'] : client.coreOAuth2ClientConfig.status['brightRed'], client.coreOAuth2ClientConfig.clientType, client.advancedOAuth2ClientConfig.grantTypes.map(type => grantTypesMap[type]).join('\n'), client.coreOAuth2ClientConfig.scopes.join('\n'), client.coreOAuth2ClientConfig.redirectionUris.join('\n')
|
|
32
32
|
// wordwrap(client.description, 30),
|
|
33
33
|
]);
|
|
34
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuth2ClientOps.js","names":["frodo","state","fs","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","listOAuth2Clients","long","clients","oauth2oidc","client","getOAuth2Clients","sort","a","b","_id","localeCompare","table","grantTypesMap","authorization_code","client_credentials","refresh_token","password","implicit","forEach","push","coreOAuth2ClientConfig","status","brightRed","clientType","advancedOAuth2ClientConfig","grantTypes","map","type","join","scopes","redirectionUris","toString","error","exportOAuth2ClientToFile","clientId","file","options","useStringArrays","deps","outcome","fileName","utils","impex","getTypedFilename","exportData","exportOAuth2Client","message","exportOAuth2ClientsToFile","titleCase","helper","getRealmName","getRealm","exportOAuth2Clients","exportOAuth2ClientsToFiles","errors","length","importOAuth2ClientFromFile","data","readFileSync","fileData","JSON","parse","importOAuth2Client","importFirstOAuth2ClientFromFile","importFirstOAuth2Client","importOAuth2ClientsFromFile","applicationData","importOAuth2Clients","importOAuth2ClientsFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","application"],"sources":["ops/OAuth2ClientOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport type {\n OAuth2ClientExportInterface,\n OAuth2ClientExportOptions,\n OAuth2ClientImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OAuth2ClientOps';\n\n/**\n * List OAuth2 clients\n */\nexport async function listOAuth2Clients(long = false) {\n try {\n const clients = await frodo.oauth2oidc.client.getOAuth2Clients();\n clients.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable([\n 'Client Id',\n 'Status',\n 'Client Type',\n 'Grant Types',\n 'Scopes',\n 'Redirect URIs',\n // 'Description',\n ]);\n const grantTypesMap = {\n authorization_code: 'Authz Code',\n client_credentials: 'Client Creds',\n refresh_token: 'Refresh Token',\n password: 'ROPC',\n 'urn:ietf:params:oauth:grant-type:uma-ticket': 'UMA',\n implicit: 'Implicit',\n 'urn:ietf:params:oauth:grant-type:device_code': 'Device Code',\n 'urn:ietf:params:oauth:grant-type:saml2-bearer': 'SAML2 Bearer',\n 'urn:openid:params:grant-type:ciba': 'CIBA',\n 'urn:ietf:params:oauth:grant-type:token-exchange': 'Token Exchange',\n 'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer',\n };\n clients.forEach((client) => {\n table.push([\n client._id,\n client.coreOAuth2ClientConfig.status === 'Active'\n ? 'Active'['brightGreen']\n : client.coreOAuth2ClientConfig.status.brightRed,\n client.coreOAuth2ClientConfig.clientType,\n client.advancedOAuth2ClientConfig.grantTypes\n .map((type) => grantTypesMap[type])\n .join('\\n'),\n client.coreOAuth2ClientConfig.scopes.join('\\n'),\n client.coreOAuth2ClientConfig.redirectionUris.join('\\n'),\n // wordwrap(client.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n clients.forEach((client) => {\n printMessage(`${client._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Export OAuth2 client to file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientToFile(\n clientId: string,\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: begin`);\n showSpinner(`Exporting ${clientId}...`);\n try {\n let fileName = frodo.utils.impex.getTypedFilename(clientId, 'oauth2.app');\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.oauth2oidc.client.exportOAuth2Client(\n clientId,\n options\n );\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${clientId} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${clientId}: ${error.message}`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: end`);\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to file\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFile(\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: begin`);\n showSpinner(`Exporting all clients...`);\n try {\n let fileName = frodo.utils.impex.getTypedFilename(\n `all${frodo.utils.impex.titleCase(\n frodo.helper.utils.getRealmName(state.getRealm())\n )}Applications`,\n 'oauth2.app'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.oauth2oidc.client.exportOAuth2Clients(\n options\n );\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all clients to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all clients`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(\n `cli.OAuth2ClientOps.exportOAuth2ClientsToFile: end [${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to separate files\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFiles(\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: begin`);\n const errors = [];\n try {\n const clients = await frodo.oauth2oidc.client.getOAuth2Clients();\n createProgressBar(clients.length, 'Exporting clients...');\n for (const client of clients) {\n const file = frodo.utils.impex.getTypedFilename(client._id, 'oauth2.app');\n try {\n const exportData: OAuth2ClientExportInterface =\n await frodo.oauth2oidc.client.exportOAuth2Client(client._id, options);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${client._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${client._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting client(s) to file(s)`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientFromFile(\n clientId: string,\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${clientId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.oauth2oidc.client.importOAuth2Client(\n clientId,\n fileData,\n options\n );\n outcome = true;\n succeedSpinner(`Imported ${clientId}.`);\n } catch (error) {\n failSpinner(`Error importing ${clientId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstOAuth2ClientFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.oauth2oidc.client.importFirstOAuth2Client(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const applicationData = JSON.parse(data);\n await frodo.oauth2oidc.client.importOAuth2Clients(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from files\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFiles(\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.oauth2.app.json')\n );\n createProgressBar(files.length, 'Importing clients...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: OAuth2ClientExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await frodo.oauth2oidc.client.importOAuth2Clients(fileData, options);\n updateProgressBar(`Imported ${count} client(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing client(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} client(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing client(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,cAAc,QAAQ,4BAA4B;AAO3D;AACA;AACA;AACA,OAAO,eAAeC,iBAAiBA,CAACC,IAAI,GAAG,KAAK,EAAE;EACpD,IAAI;IACF,MAAMC,OAAO,GAAG,MAAMf,KAAK,CAACgB,UAAU,CAACC,MAAM,CAACC,gBAAgB,CAAC,CAAC;IAChEH,OAAO,CAACI,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,GAAG,CAACC,aAAa,CAACF,CAAC,CAACC,GAAG,CAAC,CAAC;IAClD,IAAIR,IAAI,EAAE;MACR,MAAMU,KAAK,GAAGpB,WAAW,CAAC,CACxB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,QAAQ,EACR;MACA;MAAA,CACD,CAAC;;MACF,MAAMqB,aAAa,GAAG;Q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AGC,MAAM,CAACC,IAAI,CAACpB,QAAQ,CAACqB,WAAW,CAAC,CAACzB,MAAM;QACtDqB,KAAK,IAAIC,KAAK;QACd,MAAM1F,KAAK,CAACgB,UAAU,CAACC,MAAM,CAAC+D,mBAAmB,CAACR,QAAQ,EAAEvB,OAAO,CAAC;QACpEtC,iBAAiB,CAAE,YAAW+E,KAAM,mBAAkB1C,IAAK,EAAC,CAAC;MAC/D,CAAC,CAAC,OAAOH,KAAK,EAAE;QACdsB,MAAM,CAACnC,IAAI,CAACa,KAAK,CAAC;QAClBlC,iBAAiB,CAAE,kCAAiCqC,IAAK,EAAC,CAAC;QAC3DzC,YAAY,CAACsC,KAAK,EAAE,OAAO,CAAC;MAC9B;IACF;IACApC,eAAe,CACZ,sBAAqBgF,KAAM,mBAAkBL,KAAK,CAAChB,MAAO,WAC7D,CAAC;EACH,CAAC,CAAC,OAAOvB,KAAK,EAAE;IACdsB,MAAM,CAACnC,IAAI,CAACa,KAAK,CAAC;IAClBpC,eAAe,CAAE,yCAAwC,CAAC;IAC1DF,YAAY,CAACsC,KAAK,EAAE,OAAO,CAAC;EAC9B;EACAxC,YAAY,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK8D,MAAM,CAACC,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"OAuth2ClientOps.js","names":["frodo","state","fs","createProgressBar","createTable","debugMessage","failSpinner","printMessage","showSpinner","stopProgressBar","succeedSpinner","updateProgressBar","saveJsonToFile","listOAuth2Clients","long","clients","oauth2oidc","client","getOAuth2Clients","sort","a","b","_id","localeCompare","table","grantTypesMap","authorization_code","client_credentials","refresh_token","password","implicit","forEach","push","coreOAuth2ClientConfig","status","clientType","advancedOAuth2ClientConfig","grantTypes","map","type","join","scopes","redirectionUris","toString","error","exportOAuth2ClientToFile","clientId","file","options","useStringArrays","deps","outcome","fileName","utils","impex","getTypedFilename","exportData","exportOAuth2Client","message","exportOAuth2ClientsToFile","titleCase","helper","getRealmName","getRealm","exportOAuth2Clients","exportOAuth2ClientsToFiles","errors","length","importOAuth2ClientFromFile","data","readFileSync","fileData","JSON","parse","importOAuth2Client","importFirstOAuth2ClientFromFile","importFirstOAuth2Client","importOAuth2ClientsFromFile","applicationData","importOAuth2Clients","importOAuth2ClientsFromFiles","names","readdirSync","files","filter","name","toLowerCase","endsWith","total","count","Object","keys","application"],"sources":["ops/OAuth2ClientOps.ts"],"sourcesContent":["import { frodo, state } from '@rockcarver/frodo-lib';\nimport fs from 'fs';\nimport {\n createProgressBar,\n createTable,\n debugMessage,\n failSpinner,\n printMessage,\n showSpinner,\n stopProgressBar,\n succeedSpinner,\n updateProgressBar,\n} from '../utils/Console';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport type {\n OAuth2ClientExportInterface,\n OAuth2ClientExportOptions,\n OAuth2ClientImportOptions,\n} from '@rockcarver/frodo-lib/types/ops/OAuth2ClientOps';\nimport { ReadableStrings } from '@rockcarver/frodo-lib/types/api/ApiTypes';\n\n/**\n * List OAuth2 clients\n */\nexport async function listOAuth2Clients(long = false) {\n try {\n const clients = await frodo.oauth2oidc.client.getOAuth2Clients();\n clients.sort((a, b) => a._id.localeCompare(b._id));\n if (long) {\n const table = createTable([\n 'Client Id',\n 'Status',\n 'Client Type',\n 'Grant Types',\n 'Scopes',\n 'Redirect URIs',\n // 'Description',\n ]);\n const grantTypesMap = {\n authorization_code: 'Authz Code',\n client_credentials: 'Client Creds',\n refresh_token: 'Refresh Token',\n password: 'ROPC',\n 'urn:ietf:params:oauth:grant-type:uma-ticket': 'UMA',\n implicit: 'Implicit',\n 'urn:ietf:params:oauth:grant-type:device_code': 'Device Code',\n 'urn:ietf:params:oauth:grant-type:saml2-bearer': 'SAML2 Bearer',\n 'urn:openid:params:grant-type:ciba': 'CIBA',\n 'urn:ietf:params:oauth:grant-type:token-exchange': 'Token Exchange',\n 'urn:ietf:params:oauth:grant-type:jwt-bearer': 'JWT Bearer',\n };\n clients.forEach((client) => {\n table.push([\n client._id,\n client.coreOAuth2ClientConfig.status === 'Active'\n ? 'Active'['brightGreen']\n : (client.coreOAuth2ClientConfig.status as string)['brightRed'],\n client.coreOAuth2ClientConfig.clientType,\n (client.advancedOAuth2ClientConfig.grantTypes as ReadableStrings)\n .map((type) => grantTypesMap[type])\n .join('\\n'),\n (client.coreOAuth2ClientConfig.scopes as ReadableStrings).join('\\n'),\n (client.coreOAuth2ClientConfig.redirectionUris as string[]).join(\n '\\n'\n ),\n // wordwrap(client.description, 30),\n ]);\n });\n printMessage(table.toString(), 'data');\n } else {\n clients.forEach((client) => {\n printMessage(`${client._id}`, 'data');\n });\n }\n } catch (error) {\n printMessage(`Error listing applications - ${error}`, 'error');\n }\n}\n\n/**\n * Export OAuth2 client to file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientToFile(\n clientId: string,\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: begin`);\n showSpinner(`Exporting ${clientId}...`);\n try {\n let fileName = frodo.utils.impex.getTypedFilename(clientId, 'oauth2.app');\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.oauth2oidc.client.exportOAuth2Client(\n clientId,\n options\n );\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported ${clientId} to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting ${clientId}: ${error.message}`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientToFile: end`);\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to file\n * @param {string} file file name\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFile(\n file: string,\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFile: begin`);\n showSpinner(`Exporting all clients...`);\n try {\n let fileName = frodo.utils.impex.getTypedFilename(\n `all${frodo.utils.impex.titleCase(\n frodo.helper.utils.getRealmName(state.getRealm())\n )}Applications`,\n 'oauth2.app'\n );\n if (file) {\n fileName = file;\n }\n const exportData = await frodo.oauth2oidc.client.exportOAuth2Clients(\n options\n );\n saveJsonToFile(exportData, fileName);\n succeedSpinner(`Exported all clients to ${fileName}.`);\n outcome = true;\n } catch (error) {\n failSpinner(`Error exporting all clients`);\n printMessage(`${error.message}`, 'error');\n }\n debugMessage(\n `cli.OAuth2ClientOps.exportOAuth2ClientsToFile: end [${outcome}]`\n );\n return outcome;\n}\n\n/**\n * Export all OAuth2 clients to separate files\n * @param {OAuth2ClientExportOptions} options export options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function exportOAuth2ClientsToFiles(\n options: OAuth2ClientExportOptions = { useStringArrays: true, deps: true }\n) {\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: begin`);\n const errors = [];\n try {\n const clients = await frodo.oauth2oidc.client.getOAuth2Clients();\n createProgressBar(clients.length, 'Exporting clients...');\n for (const client of clients) {\n const file = frodo.utils.impex.getTypedFilename(client._id, 'oauth2.app');\n try {\n const exportData: OAuth2ClientExportInterface =\n await frodo.oauth2oidc.client.exportOAuth2Client(client._id, options);\n saveJsonToFile(exportData, file);\n updateProgressBar(`Exported ${client._id}.`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error exporting ${client._id}.`);\n }\n }\n stopProgressBar(`Export complete.`);\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error exporting client(s) to file(s)`);\n }\n debugMessage(`cli.OAuth2ClientOps.exportOAuth2ClientsToFiles: end`);\n return 0 === errors.length;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} clientId client id\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientFromFile(\n clientId: string,\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${clientId}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.oauth2oidc.client.importOAuth2Client(\n clientId,\n fileData,\n options\n );\n outcome = true;\n succeedSpinner(`Imported ${clientId}.`);\n } catch (error) {\n failSpinner(`Error importing ${clientId}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import first OAuth2 client from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importFirstOAuth2ClientFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n await frodo.oauth2oidc.client.importFirstOAuth2Client(fileData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importFirstOAuth2ClientFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from file\n * @param {string} file file name\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFile(\n file: string,\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n let outcome = false;\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: begin`);\n showSpinner(`Importing ${file}...`);\n try {\n const data = fs.readFileSync(file, 'utf8');\n const applicationData = JSON.parse(data);\n await frodo.oauth2oidc.client.importOAuth2Clients(applicationData, options);\n outcome = true;\n succeedSpinner(`Imported ${file}.`);\n } catch (error) {\n failSpinner(`Error importing ${file}.`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFile: end`);\n return outcome;\n}\n\n/**\n * Import OAuth2 clients from files\n * @param {OAuth2ClientImportOptions} options import options\n * @returns {Promise<boolean>} true if successful, false otherwise\n */\nexport async function importOAuth2ClientsFromFiles(\n options: OAuth2ClientImportOptions = { deps: true }\n): Promise<boolean> {\n const errors = [];\n try {\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: begin`);\n const names = fs.readdirSync('.');\n const files = names.filter((name) =>\n name.toLowerCase().endsWith('.oauth2.app.json')\n );\n createProgressBar(files.length, 'Importing clients...');\n let total = 0;\n for (const file of files) {\n try {\n const data = fs.readFileSync(file, 'utf8');\n const fileData: OAuth2ClientExportInterface = JSON.parse(data);\n const count = Object.keys(fileData.application).length;\n total += count;\n await frodo.oauth2oidc.client.importOAuth2Clients(fileData, options);\n updateProgressBar(`Imported ${count} client(s) from ${file}`);\n } catch (error) {\n errors.push(error);\n updateProgressBar(`Error importing client(s) from ${file}`);\n printMessage(error, 'error');\n }\n }\n stopProgressBar(\n `Finished importing ${total} client(s) from ${files.length} file(s).`\n );\n } catch (error) {\n errors.push(error);\n stopProgressBar(`Error importing client(s) from file(s).`);\n printMessage(error, 'error');\n }\n debugMessage(`cli.OAuth2ClientOps.importOAuth2ClientsFromFiles: end`);\n return 0 === errors.length;\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,KAAK,QAAQ,uBAAuB;AACpD,OAAOC,EAAE,MAAM,IAAI;AACnB,SACEC,iBAAiB,EACjBC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,iBAAiB,QACZ,kBAAkB;AAC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,CAAE,uDAAsD,CAAC;EACrE,OAAO,CAAC,KAAK6D,MAAM,CAACC,MAAM;AAC5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockcarver/frodo-cli",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-6",
|
|
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": [
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@rockcarver/frodo-lib": "2.0.0-
|
|
102
|
+
"@rockcarver/frodo-lib": "2.0.0-8",
|
|
103
103
|
"chokidar": "^3.5.3",
|
|
104
104
|
"cli-progress": "^3.11.2",
|
|
105
105
|
"cli-table3": "^0.6.3",
|