feat: Add config-manager push saml command#93
Conversation
17d9021 to
69afd91
Compare
69afd91 to
174bab7
Compare
| ); | ||
|
|
||
| if (await getTokens(false, true, deploymentTypes)) { | ||
| verboseMessage('Exporting config entity saml'); |
There was a problem hiding this comment.
I'd probably reword this to "Exporting SAML configuration..."
Config entity is a term that Frodo uses when referring to IDM configuration, which SAML is AM configuration
| if (await getTokens(false, true, deploymentTypes)) { | ||
| verboseMessage('Exporting config entity saml'); | ||
| const outcome = await configManagerImportSaml(); | ||
| if (!outcome) process.exitCode = 1; | ||
| } | ||
| // unrecognized combination of options or no options | ||
| else { | ||
| printMessage( | ||
| 'Unrecognized combination of options or no options...', | ||
| 'error' | ||
| ); | ||
| program.help(); | ||
| process.exitCode = 1; | ||
| } |
There was a problem hiding this comment.
Change this code to look something like this:
We are changing it so that way we don't display the help menu when the failure is caused by something other than options. Since it's possible the command can be run without options, we don't need to display the help menu here.
|
|
||
| program | ||
| .description('Import saml configuration.') | ||
|
|
| const { CLOUD_DEPLOYMENT_TYPE_KEY, FORGEOPS_DEPLOYMENT_TYPE_KEY } = | ||
| frodo.utils.constants; | ||
|
|
||
| const deploymentTypes = [ | ||
| CLOUD_DEPLOYMENT_TYPE_KEY, | ||
| FORGEOPS_DEPLOYMENT_TYPE_KEY, | ||
| ]; |
There was a problem hiding this comment.
Remove deployment types here, since SAML is supported by all deployments at the moment.
| * Import all SAML entity providers from all *.saml.json files in the current directory | ||
| * @returns {Promise<boolean>} true if successful, false otherwise | ||
| */ | ||
|
|
There was a problem hiding this comment.
Remove this space between the comment and the function
| const samlImportData: Saml2ExportInterface = { | ||
| script: {}, | ||
| saml: { hosted, remote, metadata }, | ||
| }; | ||
|
|
||
| const cotImportData: CirclesOfTrustExportInterface = { | ||
| script: {}, | ||
| saml: { hosted: {}, remote: {}, metadata: {}, cot }, | ||
| }; |
There was a problem hiding this comment.
I would merge this into one object:
const samlImportData: Saml2ExportInterface = {
script: {},
saml: { hosted, remote, metadata, cot },
};You then pass this object into both of the functions below. The saml imports will ignore the circles of trust passed in, and vice versa for the circle of trust imports.
| saml: { hosted: {}, remote: {}, metadata: {}, cot }, | ||
| }; | ||
|
|
||
| await importSaml2Providers(samlImportData, { deps: true }); |
There was a problem hiding this comment.
No need to pass in options here, just do:
await importSaml2Providers(samlImportData);Dependencies are just scripts, which config manager doesn't support importing with this command
|
|
||
| /* | ||
| // ForgeOps | ||
| FRODO_MOCK=record FRODO_NO_CACHE=1 FRODO_HOST=https://nightly.gcp.forgeops.com/am frodo config-manager push saml -D test/e2e/exports/fr-config-manager/forgeops -m forgeops |
There was a problem hiding this comment.
Remember to add tests for the -n, --name option, and also the realm argument
No description provided.