@rockcarver/frodo-lib 0.16.2-8 → 0.17.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 +221 -1
- package/cjs/api/AgentApi.js +14 -61
- package/cjs/api/AgentApi.js.map +1 -1
- package/cjs/api/AgentApi.test.js.map +1 -1
- package/cjs/api/ApiTypes.js +0 -5
- package/cjs/api/ApiTypes.js.map +1 -1
- package/cjs/api/AuthenticateApi.js +9 -20
- package/cjs/api/AuthenticateApi.js.map +1 -1
- package/cjs/api/AuthenticateApi.test.js.map +1 -0
- package/cjs/api/BaseApi.js +82 -124
- package/cjs/api/BaseApi.js.map +1 -1
- package/cjs/api/CirclesOfTrustApi.js +8 -32
- package/cjs/api/CirclesOfTrustApi.js.map +1 -1
- package/cjs/api/IdmConfigApi.js +9 -34
- package/cjs/api/IdmConfigApi.js.map +1 -1
- package/cjs/api/LogApi.js +8 -31
- package/cjs/api/LogApi.js.map +1 -1
- package/cjs/api/ManagedObjectApi.js +34 -31
- package/cjs/api/ManagedObjectApi.js.map +1 -1
- package/cjs/api/NodeApi.js +10 -41
- package/cjs/api/NodeApi.js.map +1 -1
- package/cjs/api/NodeApi.test.js.map +1 -1
- package/cjs/api/OAuth2ClientApi.js +7 -26
- package/cjs/api/OAuth2ClientApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.js +28 -34
- package/cjs/api/OAuth2OIDCApi.js.map +1 -1
- package/cjs/api/OAuth2OIDCApi.test.js.map +1 -0
- package/cjs/api/OAuth2ProviderApi.js +5 -15
- package/cjs/api/OAuth2ProviderApi.js.map +1 -1
- package/cjs/api/RealmApi.js +8 -34
- package/cjs/api/RealmApi.js.map +1 -1
- package/cjs/api/Saml2Api.js +32 -118
- package/cjs/api/Saml2Api.js.map +1 -1
- package/cjs/api/ScriptApi.js +8 -30
- package/cjs/api/ScriptApi.js.map +1 -1
- package/cjs/api/SecretsApi.js +14 -64
- package/cjs/api/SecretsApi.js.map +1 -1
- package/cjs/api/SecretsApi.test.js.map +1 -1
- package/cjs/api/ServerInfoApi.js +6 -21
- package/cjs/api/ServerInfoApi.js.map +1 -1
- package/cjs/api/ServiceApi.js +49 -47
- package/cjs/api/ServiceApi.js.map +1 -1
- package/cjs/api/SocialIdentityProvidersApi.js +9 -36
- package/cjs/api/SocialIdentityProvidersApi.js.map +1 -1
- package/cjs/api/StartupApi.js +5 -24
- package/cjs/api/StartupApi.js.map +1 -1
- package/cjs/api/StartupApi.test.js.map +1 -1
- package/cjs/api/TreeApi.js +8 -30
- package/cjs/api/TreeApi.js.map +1 -1
- package/cjs/api/TreeApi.test.js.map +1 -1
- package/cjs/api/VariablesApi.js +9 -37
- package/cjs/api/VariablesApi.js.map +1 -1
- package/cjs/api/VariablesApi.test.js.map +1 -1
- package/cjs/api/utils/ApiUtils.js +47 -57
- package/cjs/api/utils/ApiUtils.js.map +1 -1
- package/cjs/api/utils/ApiUtils.test.js.map +1 -1
- package/cjs/api/utils/Base64.js +6 -15
- package/cjs/api/utils/Base64.js.map +1 -1
- package/cjs/ext/axios-curlirize/curlirize.js +2 -9
- package/cjs/ext/axios-curlirize/curlirize.js.map +1 -1
- package/cjs/ext/axios-curlirize/lib/CurlHelper.js +7 -22
- package/cjs/ext/axios-curlirize/lib/CurlHelper.js.map +1 -1
- package/cjs/index.js +30 -89
- package/cjs/index.js.map +1 -1
- package/cjs/ops/AdminOps.js +27 -165
- package/cjs/ops/AdminOps.js.map +1 -1
- package/cjs/ops/AgentOps.js +3 -160
- package/cjs/ops/AgentOps.js.map +1 -1
- package/cjs/ops/AgentOps.test.js.map +1 -1
- package/cjs/ops/AuthenticateOps.js +265 -226
- package/cjs/ops/AuthenticateOps.js.map +1 -1
- package/cjs/ops/AuthenticateOps.test.js.map +1 -1
- package/cjs/ops/CirclesOfTrustOps.js +13 -91
- package/cjs/ops/CirclesOfTrustOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.js +220 -136
- package/cjs/ops/ConnectionProfileOps.js.map +1 -1
- package/cjs/ops/ConnectionProfileOps.test.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.js +35 -379
- package/cjs/ops/EmailTemplateOps.js.map +1 -1
- package/cjs/ops/EmailTemplateOps.test.js.map +1 -1
- package/cjs/ops/IdmOps.js +52 -426
- package/cjs/ops/IdmOps.js.map +1 -1
- package/cjs/ops/IdmOps.test.js.map +1 -1
- package/cjs/ops/IdpOps.js +11 -94
- package/cjs/ops/IdpOps.js.map +1 -1
- package/cjs/ops/IdpOps.test.js.map +1 -1
- package/cjs/ops/JoseOps.js +81 -0
- package/cjs/ops/JoseOps.js.map +1 -0
- package/cjs/ops/JoseOps.test.js.map +1 -0
- package/cjs/ops/JourneyOps.js +140 -371
- package/cjs/ops/JourneyOps.js.map +1 -1
- package/cjs/ops/JourneyOps.test.js.map +1 -1
- package/cjs/ops/LogOps.js +14 -47
- package/cjs/ops/LogOps.js.map +1 -1
- package/cjs/ops/ManagedObjectOps.js +4 -12
- package/cjs/ops/ManagedObjectOps.js.map +1 -1
- package/cjs/ops/NodeOps.js +9 -67
- package/cjs/ops/NodeOps.js.map +1 -1
- package/cjs/ops/OAuth2ClientOps.js +10 -40
- package/cjs/ops/OAuth2ClientOps.js.map +1 -1
- package/cjs/ops/OpsTypes.js +0 -5
- package/cjs/ops/OpsTypes.js.map +1 -1
- package/cjs/ops/OrganizationOps.js +6 -25
- package/cjs/ops/OrganizationOps.js.map +1 -1
- package/cjs/ops/RealmOps.js +0 -19
- package/cjs/ops/RealmOps.js.map +1 -1
- package/cjs/ops/Saml2Ops.js +258 -802
- package/cjs/ops/Saml2Ops.js.map +1 -1
- package/cjs/ops/Saml2Ops.test.js.map +1 -1
- package/cjs/ops/ScriptOps.js +28 -73
- package/cjs/ops/ScriptOps.js.map +1 -1
- package/cjs/ops/SecretsOps.js +2 -58
- package/cjs/ops/SecretsOps.js.map +1 -1
- package/cjs/ops/ServiceAccountOps.js +61 -0
- package/cjs/ops/ServiceAccountOps.js.map +1 -0
- package/cjs/ops/ServiceAccountOps.test.js.map +1 -0
- package/cjs/ops/ServiceOps.js +55 -101
- package/cjs/ops/ServiceOps.js.map +1 -1
- package/cjs/ops/StartupOps.js +2 -23
- package/cjs/ops/StartupOps.js.map +1 -1
- package/cjs/ops/ThemeOps.js +230 -436
- package/cjs/ops/ThemeOps.js.map +1 -1
- package/cjs/ops/ThemeOps.test.js.map +1 -0
- package/cjs/ops/VariablesOps.js +0 -38
- package/cjs/ops/VariablesOps.js.map +1 -1
- package/cjs/ops/utils/Console.js +29 -62
- package/cjs/ops/utils/Console.js.map +1 -1
- package/cjs/ops/utils/DataProtection.js +13 -47
- package/cjs/ops/utils/DataProtection.js.map +1 -1
- package/cjs/ops/utils/DataProtection.test.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.js +36 -74
- package/cjs/ops/utils/ExportImportUtils.js.map +1 -1
- package/cjs/ops/utils/ExportImportUtils.test.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.js +27 -43
- package/cjs/ops/utils/OpsUtils.js.map +1 -1
- package/cjs/ops/utils/OpsUtils.test.js.map +1 -1
- package/cjs/ops/utils/ValidationUtils.js +0 -13
- package/cjs/ops/utils/ValidationUtils.js.map +1 -1
- package/cjs/ops/utils/ValidationUtils.test.js.map +1 -1
- package/cjs/ops/utils/Version.js +2 -12
- package/cjs/ops/utils/Version.js.map +1 -1
- package/cjs/ops/utils/Version.test.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.js +1 -2
- package/cjs/ops/utils/Wordwrap.js.map +1 -1
- package/cjs/ops/utils/Wordwrap.test.js.map +1 -0
- package/cjs/shared/State.js +239 -0
- package/cjs/shared/State.js.map +1 -0
- package/cjs/shared/State.test.js.map +1 -0
- package/cjs/storage/StaticStorage.js.map +1 -1
- package/cjs/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
- package/cjs/test/mocks/ForgeRockApiMockEngine.js +184 -80
- package/cjs/test/mocks/ForgeRockApiMockEngine.js.map +1 -1
- package/cjs/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
- package/cjs/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
- package/cjs/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
- package/cjs/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
- package/cjs/test/mocks/Saml2Api/findSaml2Providers/https:sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a_stub.json +18 -0
- package/cjs/test/mocks/Saml2Api/findSaml2Providers/iSPAzure_stub.json +18 -0
- package/cjs/test/mocks/Saml2Api/getProvider/aVNQQXp1cmU.json +1 -2
- package/cjs/test/mocks/Saml2Api/getProvider/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/U1BBenVyZQ.json +147 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQXp1cmU.json +182 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQnJvYWRjb20.json +149 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQRmVkbGV0.json +141 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aVNQQXp1cmU.json +1 -2
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/dm9sa2VyRGV2U1A.json +118 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zYW1sLm15dGVzdHJ1bi5jb20vc3A.json +66 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzExZmZhOWMtNTk3Mi00NzEzLWFjZTMtNjg4Yzk3MzI2MTRhLw.json +35 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aWRw.json +83 -0
- package/cjs/test/mocks/Saml2Api/getProviderByLocationAndId/remote/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/SPAzure.xml +74 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPAzure.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPBroadcom.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPFedlet.xml +78 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fsaml.mytestrun.com%2Fsp.xml +13 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/{dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.xml → https%3A%2F%2Fsts.windows.net%2F711ffa9c-5972-4713-ace3-688c9732614a%2F.xml} +0 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/{aVNQQXp1cmU.xml → iSPAzure.xml} +0 -0
- package/cjs/test/mocks/Saml2Api/getProviderMetadata/alpha/urn%3Afederation%3AMicrosoftOnline.xml +84 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/SPAzure.saml.json +243 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/iSPAzure.saml.json +242 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPAzure.saml.json +454 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPBroadcom.saml.json +586 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPFedlet.saml.json +241 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/idp.saml.json +185 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/saml.mytestrun.comsp.saml.json +101 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a.saml.json +113 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/urn:federation:MicrosoftOnline.saml.json +199 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Provider/volkerDevSP.saml.json +212 -0
- package/cjs/test/mocks/Saml2Ops/importSaml2Providers/allAlphaProviders.saml.json +2414 -0
- package/cjs/test/mocks/ScriptApi/getScript/5b29c5b7-b161-4a42-a41f-d6c85316b951.json +13 -0
- package/cjs/test/mocks/ScriptApi/getScript/85523e71-2d77-4577-b078-6f9674cc54e2.json +13 -0
- package/cjs/test/mocks/ScriptApi/getScript/90c4eca5-05f0-42f5-b9bf-88b693eabbbd.json +13 -0
- package/cjs/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
- package/cjs/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
- package/cjs/utils/AutoSetupPolly.js +79 -0
- package/cjs/utils/AutoSetupPolly.js.map +1 -0
- package/cjs/utils/SetupJest.js +6 -0
- package/cjs/utils/SetupJest.js.map +1 -0
- package/cjs/{test/mocks → utils}/snapshotResolve.js +10 -12
- package/cjs/utils/snapshotResolve.js.map +1 -0
- package/esm/api/AgentApi.mjs +19 -21
- package/esm/api/AgentApi.test.mjs +6 -15
- package/esm/api/ApiTypes.mjs +0 -5
- package/esm/api/AuthenticateApi.mjs +7 -10
- package/esm/api/AuthenticateApi.test.mjs +39 -0
- package/esm/api/BaseApi.mjs +96 -81
- package/esm/api/CirclesOfTrustApi.mjs +9 -12
- package/esm/api/IdmConfigApi.mjs +11 -12
- package/esm/api/LogApi.mjs +6 -10
- package/esm/api/ManagedObjectApi.mjs +23 -8
- package/esm/api/NodeApi.mjs +13 -15
- package/esm/api/NodeApi.test.mjs +13 -17
- package/esm/api/OAuth2ClientApi.mjs +7 -9
- package/esm/api/OAuth2OIDCApi.mjs +15 -9
- package/esm/api/OAuth2OIDCApi.test.mjs +53 -0
- package/esm/api/OAuth2ProviderApi.mjs +3 -5
- package/esm/api/RealmApi.mjs +10 -13
- package/esm/api/Saml2Api.mjs +31 -61
- package/esm/api/ScriptApi.mjs +9 -11
- package/esm/api/SecretsApi.mjs +21 -24
- package/esm/api/SecretsApi.test.mjs +9 -31
- package/esm/api/ServerInfoApi.mjs +5 -9
- package/esm/api/ServiceApi.mjs +53 -26
- package/esm/api/SocialIdentityProvidersApi.mjs +11 -13
- package/esm/api/StartupApi.mjs +5 -10
- package/esm/api/StartupApi.test.mjs +4 -7
- package/esm/api/TreeApi.mjs +9 -11
- package/esm/api/TreeApi.test.mjs +24 -61
- package/esm/api/VariablesApi.mjs +11 -13
- package/esm/api/VariablesApi.test.mjs +80 -222
- package/esm/api/utils/ApiUtils.mjs +45 -48
- package/esm/api/utils/ApiUtils.test.mjs +33 -32
- package/esm/api/utils/Base64.mjs +6 -9
- package/esm/ext/axios-curlirize/curlirize.mjs +2 -7
- package/esm/ext/axios-curlirize/lib/CurlHelper.mjs +7 -20
- package/esm/index.mjs +23 -13
- package/esm/ops/AdminOps.mjs +33 -119
- package/esm/ops/AgentOps.mjs +38 -81
- package/esm/ops/AgentOps.test.mjs +5 -45
- package/esm/ops/AuthenticateOps.mjs +241 -175
- package/esm/ops/AuthenticateOps.test.mjs +7 -9
- package/esm/ops/CirclesOfTrustOps.mjs +24 -61
- package/esm/ops/ConnectionProfileOps.mjs +192 -82
- package/esm/ops/ConnectionProfileOps.test.mjs +19 -19
- package/esm/ops/EmailTemplateOps.mjs +18 -276
- package/esm/ops/EmailTemplateOps.test.mjs +19 -44
- package/esm/ops/IdmOps.mjs +30 -327
- package/esm/ops/IdmOps.test.mjs +47 -54
- package/esm/ops/IdpOps.mjs +21 -59
- package/esm/ops/IdpOps.test.mjs +5 -5
- package/esm/ops/JoseOps.mjs +41 -0
- package/esm/ops/JoseOps.test.mjs +137 -0
- package/esm/ops/JourneyOps.mjs +147 -290
- package/esm/ops/JourneyOps.test.mjs +30 -28
- package/esm/ops/LogOps.mjs +15 -25
- package/esm/ops/ManagedObjectOps.mjs +6 -6
- package/esm/ops/NodeOps.mjs +9 -47
- package/esm/ops/OAuth2ClientOps.mjs +13 -19
- package/esm/ops/OpsTypes.mjs +1 -3
- package/esm/ops/OrganizationOps.mjs +7 -14
- package/esm/ops/RealmOps.mjs +4 -7
- package/esm/ops/Saml2Ops.mjs +199 -587
- package/esm/ops/Saml2Ops.test.mjs +303 -84
- package/esm/ops/ScriptOps.mjs +31 -47
- package/esm/ops/SecretsOps.mjs +15 -31
- package/esm/ops/ServiceAccountOps.mjs +41 -0
- package/esm/ops/ServiceAccountOps.test.mjs +51 -0
- package/esm/ops/ServiceOps.mjs +66 -83
- package/esm/ops/StartupOps.mjs +4 -13
- package/esm/ops/ThemeOps.mjs +189 -298
- package/esm/{api/ThemeApi.test.mjs → ops/ThemeOps.test.mjs} +91 -96
- package/esm/ops/VariablesOps.mjs +9 -18
- package/esm/ops/utils/Console.mjs +28 -46
- package/esm/ops/utils/DataProtection.mjs +15 -28
- package/esm/ops/utils/DataProtection.test.mjs +8 -8
- package/esm/ops/utils/ExportImportUtils.mjs +34 -43
- package/esm/ops/utils/ExportImportUtils.test.mjs +20 -18
- package/esm/ops/utils/OpsUtils.mjs +27 -21
- package/esm/ops/utils/OpsUtils.test.mjs +155 -27
- package/esm/ops/utils/ValidationUtils.mjs +0 -9
- package/esm/ops/utils/Version.mjs +2 -3
- package/esm/ops/utils/Version.test.mjs +0 -2
- package/esm/ops/utils/Wordwrap.mjs +1 -1
- package/esm/ops/utils/Wordwrap.test.mjs +19 -0
- package/esm/shared/State.mjs +164 -0
- package/esm/shared/State.test.mjs +249 -0
- package/esm/test/mocks/AuthenticateApi/step/default_steps.json +88 -0
- package/esm/test/mocks/ForgeRockApiMockEngine.mjs +169 -33
- package/esm/test/mocks/IdmConfigApi/getConfigEntity/managed.json +4420 -0
- package/esm/test/mocks/OAuth2OIDCApi/accessToken/body.json +6 -0
- package/esm/test/mocks/OAuth2OIDCApi/accessToken/headers.json +19 -0
- package/esm/test/mocks/OAuth2OIDCApi/authorize/headers.json +38 -0
- package/esm/test/mocks/Saml2Api/findSaml2Providers/https:sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a_stub.json +18 -0
- package/esm/test/mocks/Saml2Api/findSaml2Providers/iSPAzure_stub.json +18 -0
- package/esm/test/mocks/Saml2Api/getProvider/aVNQQXp1cmU.json +1 -2
- package/esm/test/mocks/Saml2Api/getProvider/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/U1BBenVyZQ.json +147 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQXp1cmU.json +182 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQQnJvYWRjb20.json +149 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aHR0cHM6Ly9pZGMuc2NoZXViZXIuaW8vYW0vc2FtbDIvSURQRmVkbGV0.json +141 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/aVNQQXp1cmU.json +1 -2
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/hosted/dm9sa2VyRGV2U1A.json +118 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zYW1sLm15dGVzdHJ1bi5jb20vc3A.json +66 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aHR0cHM6Ly9zdHMud2luZG93cy5uZXQvNzExZmZhOWMtNTk3Mi00NzEzLWFjZTMtNjg4Yzk3MzI2MTRhLw.json +35 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/aWRw.json +83 -0
- package/esm/test/mocks/Saml2Api/getProviderByLocationAndId/remote/dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.json +1 -3
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/SPAzure.xml +74 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPAzure.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPBroadcom.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fidc.scheuber.io%2Fam%2Fsaml2%2FIDPFedlet.xml +78 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/https%3A%2F%2Fsaml.mytestrun.com%2Fsp.xml +13 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/{dXJuOmZlZGVyYXRpb246TWljcm9zb2Z0T25saW5l.xml → https%3A%2F%2Fsts.windows.net%2F711ffa9c-5972-4713-ace3-688c9732614a%2F.xml} +0 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/{aVNQQXp1cmU.xml → iSPAzure.xml} +0 -0
- package/esm/test/mocks/Saml2Api/getProviderMetadata/alpha/urn%3Afederation%3AMicrosoftOnline.xml +84 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/SPAzure.saml.json +243 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/iSPAzure.saml.json +242 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPAzure.saml.json +454 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPBroadcom.saml.json +586 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idc.scheuber.ioamsaml2IDPFedlet.saml.json +241 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/idp.saml.json +185 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/saml.mytestrun.comsp.saml.json +101 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/sts.windows.net711ffa9c-5972-4713-ace3-688c9732614a.saml.json +113 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/urn:federation:MicrosoftOnline.saml.json +199 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Provider/volkerDevSP.saml.json +212 -0
- package/esm/test/mocks/Saml2Ops/importSaml2Providers/allAlphaProviders.saml.json +2414 -0
- package/esm/test/mocks/ScriptApi/getScript/5b29c5b7-b161-4a42-a41f-d6c85316b951.json +13 -0
- package/esm/test/mocks/ScriptApi/getScript/85523e71-2d77-4577-b078-6f9674cc54e2.json +13 -0
- package/esm/test/mocks/ScriptApi/getScript/90c4eca5-05f0-42f5-b9bf-88b693eabbbd.json +13 -0
- package/esm/test/mocks/ServerInfoApi/getServerInfo/info.json +25 -0
- package/esm/test/mocks/ServerInfoApi/getServerVersionInfo/version.json +8 -0
- package/esm/utils/AutoSetupPolly.mjs +72 -0
- package/esm/utils/SetupJest.mjs +3 -0
- package/esm/{test/mocks → utils}/snapshotResolve.mjs +10 -12
- package/package.json +38 -27
- package/types/api/AgentApi.d.ts.map +1 -1
- package/types/api/ApiTypes.d.ts +19 -15
- package/types/api/ApiTypes.d.ts.map +1 -1
- package/types/api/AuthenticateApi.d.ts +1 -1
- package/types/api/AuthenticateApi.d.ts.map +1 -1
- package/types/api/BaseApi.d.ts +2 -0
- package/types/api/BaseApi.d.ts.map +1 -1
- package/types/api/CirclesOfTrustApi.d.ts.map +1 -1
- package/types/api/IdmConfigApi.d.ts.map +1 -1
- package/types/api/LogApi.d.ts.map +1 -1
- package/types/api/ManagedObjectApi.d.ts +9 -1
- package/types/api/ManagedObjectApi.d.ts.map +1 -1
- package/types/api/NodeApi.d.ts.map +1 -1
- package/types/api/OAuth2ClientApi.d.ts.map +1 -1
- package/types/api/OAuth2OIDCApi.d.ts +4 -2
- package/types/api/OAuth2OIDCApi.d.ts.map +1 -1
- package/types/api/OAuth2ProviderApi.d.ts.map +1 -1
- package/types/api/RealmApi.d.ts.map +1 -1
- package/types/api/Saml2Api.d.ts +7 -13
- package/types/api/Saml2Api.d.ts.map +1 -1
- package/types/api/ScriptApi.d.ts.map +1 -1
- package/types/api/SecretsApi.d.ts.map +1 -1
- package/types/api/ServerInfoApi.d.ts.map +1 -1
- package/types/api/ServiceApi.d.ts +14 -7
- package/types/api/ServiceApi.d.ts.map +1 -1
- package/types/api/SocialIdentityProvidersApi.d.ts.map +1 -1
- package/types/api/StartupApi.d.ts.map +1 -1
- package/types/api/TreeApi.d.ts.map +1 -1
- package/types/api/VariablesApi.d.ts.map +1 -1
- package/types/api/utils/ApiUtils.d.ts +1 -0
- package/types/api/utils/ApiUtils.d.ts.map +1 -1
- package/types/api/utils/Base64.d.ts +1 -0
- package/types/api/utils/Base64.d.ts.map +1 -1
- package/types/index.d.ts +11 -5
- package/types/index.d.ts.map +1 -1
- package/types/ops/AgentOps.d.ts +1 -1
- package/types/ops/AgentOps.d.ts.map +1 -1
- package/types/ops/AuthenticateOps.d.ts +10 -2
- package/types/ops/AuthenticateOps.d.ts.map +1 -1
- package/types/ops/ConnectionProfileOps.d.ts +49 -21
- package/types/ops/ConnectionProfileOps.d.ts.map +1 -1
- package/types/ops/EmailTemplateOps.d.ts +14 -33
- package/types/ops/EmailTemplateOps.d.ts.map +1 -1
- package/types/ops/IdmOps.d.ts +29 -37
- package/types/ops/IdmOps.d.ts.map +1 -1
- package/types/ops/JoseOps.d.ts +33 -0
- package/types/ops/JoseOps.d.ts.map +1 -0
- package/types/ops/JourneyOps.d.ts.map +1 -1
- package/types/ops/LogOps.d.ts.map +1 -1
- package/types/ops/NodeOps.d.ts.map +1 -1
- package/types/ops/OAuth2ClientOps.d.ts.map +1 -1
- package/types/ops/OpsTypes.d.ts +17 -1
- package/types/ops/OpsTypes.d.ts.map +1 -1
- package/types/ops/OrganizationOps.d.ts.map +1 -1
- package/types/ops/Saml2Ops.d.ts +52 -55
- package/types/ops/Saml2Ops.d.ts.map +1 -1
- package/types/ops/ScriptOps.d.ts.map +1 -1
- package/types/ops/ServiceAccountOps.d.ts +20 -0
- package/types/ops/ServiceAccountOps.d.ts.map +1 -0
- package/types/ops/ServiceOps.d.ts +18 -10
- package/types/ops/ServiceOps.d.ts.map +1 -1
- package/types/ops/ThemeOps.d.ts +35 -50
- package/types/ops/ThemeOps.d.ts.map +1 -1
- package/types/ops/utils/Console.d.ts +1 -1
- package/types/ops/utils/Console.d.ts.map +1 -1
- package/types/ops/utils/DataProtection.d.ts.map +1 -1
- package/types/ops/utils/ExportImportUtils.d.ts +5 -2
- package/types/ops/utils/ExportImportUtils.d.ts.map +1 -1
- package/types/ops/utils/OpsUtils.d.ts +6 -0
- package/types/ops/utils/OpsUtils.d.ts.map +1 -1
- package/types/ops/utils/Wordwrap.d.ts.map +1 -1
- package/types/shared/State.d.ts +223 -0
- package/types/shared/State.d.ts.map +1 -0
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts +21 -1
- package/types/test/mocks/ForgeRockApiMockEngine.d.ts.map +1 -1
- package/types/utils/AutoSetupPolly.d.ts +1 -0
- package/types/utils/AutoSetupPolly.d.ts.map +1 -0
- package/types/utils/SetupJest.d.ts +1 -0
- package/types/utils/SetupJest.d.ts.map +1 -0
- package/types/utils/snapshotResolve.d.ts +1 -0
- package/types/utils/snapshotResolve.d.ts.map +1 -0
- package/cjs/api/EmailTemplateApi.js +0 -73
- package/cjs/api/EmailTemplateApi.js.map +0 -1
- package/cjs/api/ThemeApi.js +0 -367
- package/cjs/api/ThemeApi.js.map +0 -1
- package/cjs/api/ThemeApi.test.js.map +0 -1
- package/cjs/storage/SessionStorage.js +0 -91
- package/cjs/storage/SessionStorage.js.map +0 -1
- package/cjs/test/mocks/snapshotResolve.js.map +0 -1
- package/esm/api/EmailTemplateApi.mjs +0 -34
- package/esm/api/ThemeApi.mjs +0 -271
- package/esm/storage/SessionStorage.mjs +0 -79
- package/types/api/EmailTemplateApi.d.ts +0 -22
- package/types/api/EmailTemplateApi.d.ts.map +0 -1
- package/types/api/ThemeApi.d.ts +0 -56
- package/types/api/ThemeApi.d.ts.map +0 -1
- package/types/storage/SessionStorage.d.ts +0 -71
- package/types/storage/SessionStorage.d.ts.map +0 -1
- package/types/test/mocks/snapshotResolve.d.ts +0 -1
- package/types/test/mocks/snapshotResolve.d.ts.map +0 -1
|
@@ -1,55 +1,58 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import
|
|
4
|
+
import * as state from '../shared/State';
|
|
5
5
|
import DataProtection from './utils/DataProtection';
|
|
6
|
-
import { createObjectTable, createTable, printMessage } from './utils/Console';
|
|
6
|
+
import { createObjectTable, createTable, debugMessage, printMessage, verboseMessage } from './utils/Console';
|
|
7
7
|
import { FRODO_CONNECTION_PROFILES_PATH_KEY } from '../storage/StaticStorage';
|
|
8
|
-
|
|
8
|
+
import { createJwkRsa, createJwks, getJwkRsaPublic } from './JoseOps';
|
|
9
|
+
import { createServiceAccount } from './ServiceAccountOps';
|
|
10
|
+
import { saveJsonToFile } from './utils/ExportImportUtils';
|
|
11
|
+
import { isValidUrl } from './utils/OpsUtils';
|
|
12
|
+
const crypto = new DataProtection();
|
|
9
13
|
const fileOptions = {
|
|
10
14
|
indentation: 4
|
|
11
15
|
};
|
|
16
|
+
const legacyProfileFilename = '.frodorc';
|
|
17
|
+
const newProfileFilename = 'Connections.json';
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Get connection profiles file name
|
|
14
21
|
* @returns {String} connection profiles file name
|
|
15
22
|
*/
|
|
16
|
-
|
|
17
23
|
export function getConnectionProfilesPath() {
|
|
18
|
-
return
|
|
24
|
+
return state.getConnectionProfilesPath() || process.env[FRODO_CONNECTION_PROFILES_PATH_KEY] || `${os.homedir()}/.frodo/${newProfileFilename}`;
|
|
19
25
|
}
|
|
26
|
+
|
|
20
27
|
/**
|
|
21
|
-
* Find connection
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
* @returns {
|
|
28
|
+
* Find connection profiles
|
|
29
|
+
* @param {ConnectionsFileInterface} connectionProfiles connection profile object
|
|
30
|
+
* @param {string} host host url or unique substring
|
|
31
|
+
* @returns {SecureConnectionProfileInterface[]} Array of connection profiles
|
|
25
32
|
*/
|
|
26
|
-
|
|
27
|
-
function findConnectionProfile(connectionProfiles, host) {
|
|
33
|
+
function findConnectionProfiles(connectionProfiles, host) {
|
|
28
34
|
const profiles = [];
|
|
29
|
-
|
|
30
35
|
for (const tenant in connectionProfiles) {
|
|
31
36
|
if (tenant.includes(host)) {
|
|
32
|
-
const foundProfile =
|
|
37
|
+
const foundProfile = {
|
|
38
|
+
...connectionProfiles[tenant]
|
|
39
|
+
};
|
|
33
40
|
foundProfile.tenant = tenant;
|
|
34
41
|
profiles.push(foundProfile);
|
|
35
42
|
}
|
|
36
43
|
}
|
|
37
|
-
|
|
38
44
|
return profiles;
|
|
39
45
|
}
|
|
46
|
+
|
|
40
47
|
/**
|
|
41
48
|
* List connection profiles
|
|
42
49
|
* @param {boolean} long Long list format with details
|
|
43
50
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
51
|
export function listConnectionProfiles(long = false) {
|
|
47
52
|
const filename = getConnectionProfilesPath();
|
|
48
|
-
|
|
49
53
|
try {
|
|
50
54
|
const data = fs.readFileSync(filename, 'utf8');
|
|
51
55
|
const connectionsData = JSON.parse(data);
|
|
52
|
-
|
|
53
56
|
if (long) {
|
|
54
57
|
const table = createTable(['Host', 'Username', 'Log API Key']);
|
|
55
58
|
Object.keys(connectionsData).forEach(c => {
|
|
@@ -61,65 +64,86 @@ export function listConnectionProfiles(long = false) {
|
|
|
61
64
|
printMessage(`${c}`, 'data');
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
|
-
|
|
65
67
|
printMessage('Any unique substring of a saved host can be used as the value for host parameter in all commands', 'info');
|
|
66
68
|
} catch (e) {
|
|
67
69
|
printMessage(`No connections found in ${filename} (${e.message})`, 'error');
|
|
68
70
|
}
|
|
69
71
|
}
|
|
72
|
+
|
|
70
73
|
/**
|
|
71
|
-
*
|
|
74
|
+
* Migrate from .frodorc to Connections.json
|
|
72
75
|
*/
|
|
76
|
+
function migrateFromLegacyProfile() {
|
|
77
|
+
const legacyPath = `${os.homedir()}/.frodo/${legacyProfileFilename}`;
|
|
78
|
+
if (fs.existsSync(legacyPath)) {
|
|
79
|
+
fs.copyFileSync(legacyPath, `${os.homedir()}/.frodo/${newProfileFilename}`);
|
|
80
|
+
// for now, just add a "deprecated" suffix. May delete the old file
|
|
81
|
+
// in a future release
|
|
82
|
+
fs.renameSync(legacyPath, `${legacyPath}.deprecated`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
73
85
|
|
|
74
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Initialize connection profiles
|
|
88
|
+
*
|
|
89
|
+
* This method is called from app.ts and runs before any of the message handlers are registered.
|
|
90
|
+
* Therefore none of the Console message functions will produce any output.
|
|
91
|
+
*/
|
|
92
|
+
export async function initConnectionProfiles() {
|
|
75
93
|
// create connections.json file if it doesn't exist
|
|
76
94
|
const filename = getConnectionProfilesPath();
|
|
77
95
|
const folderName = path.dirname(filename);
|
|
78
|
-
|
|
79
96
|
if (!fs.existsSync(folderName)) {
|
|
80
97
|
fs.mkdirSync(folderName, {
|
|
81
98
|
recursive: true
|
|
82
99
|
});
|
|
83
|
-
|
|
84
100
|
if (!fs.existsSync(filename)) {
|
|
85
101
|
fs.writeFileSync(filename, JSON.stringify({}, null, fileOptions.indentation));
|
|
86
102
|
}
|
|
87
|
-
}
|
|
103
|
+
}
|
|
104
|
+
// encrypt the password and logApiSecret from clear text to aes-256-GCM
|
|
88
105
|
else {
|
|
106
|
+
migrateFromLegacyProfile();
|
|
89
107
|
const data = fs.readFileSync(filename, 'utf8');
|
|
90
108
|
const connectionsData = JSON.parse(data);
|
|
91
109
|
let convert = false;
|
|
92
|
-
Object.keys(connectionsData)
|
|
93
|
-
if (connectionsData[conn]
|
|
110
|
+
for (const conn of Object.keys(connectionsData)) {
|
|
111
|
+
if (connectionsData[conn]['password']) {
|
|
94
112
|
convert = true;
|
|
95
|
-
connectionsData[conn].encodedPassword = await
|
|
96
|
-
|
|
97
|
-
delete connectionsData[conn].password;
|
|
113
|
+
connectionsData[conn].encodedPassword = await crypto.encrypt(connectionsData[conn]['password']);
|
|
114
|
+
delete connectionsData[conn]['password'];
|
|
98
115
|
}
|
|
99
|
-
|
|
100
|
-
|
|
116
|
+
if (connectionsData[conn]['logApiSecret']) {
|
|
117
|
+
convert = true;
|
|
118
|
+
connectionsData[conn].encodedLogApiSecret = await crypto.encrypt(connectionsData[conn]['logApiSecret']);
|
|
119
|
+
delete connectionsData[conn]['logApiSecret'];
|
|
120
|
+
}
|
|
121
|
+
if (connectionsData[conn]['svcacctJwk']) {
|
|
122
|
+
convert = true;
|
|
123
|
+
connectionsData[conn].encodedSvcacctJwk = await crypto.encrypt(connectionsData[conn]['svcacctJwk']);
|
|
124
|
+
delete connectionsData[conn]['svcacctJwk'];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
101
127
|
if (convert) {
|
|
102
128
|
fs.writeFileSync(filename, JSON.stringify(connectionsData, null, fileOptions.indentation));
|
|
103
129
|
}
|
|
104
130
|
}
|
|
105
131
|
}
|
|
132
|
+
|
|
106
133
|
/**
|
|
107
134
|
* Get connection profile by host
|
|
108
135
|
* @param {String} host host tenant host url or unique substring
|
|
109
136
|
* @returns {Object} connection profile or null
|
|
110
137
|
*/
|
|
111
|
-
|
|
112
138
|
export async function getConnectionProfileByHost(host) {
|
|
113
139
|
try {
|
|
114
140
|
const filename = getConnectionProfilesPath();
|
|
115
141
|
const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));
|
|
116
|
-
const profiles =
|
|
117
|
-
|
|
142
|
+
const profiles = findConnectionProfiles(connectionsData, host);
|
|
118
143
|
if (profiles.length == 0) {
|
|
119
144
|
printMessage(`Profile for ${host} not found. Please specify credentials on command line`, 'error');
|
|
120
145
|
return null;
|
|
121
146
|
}
|
|
122
|
-
|
|
123
147
|
if (profiles.length > 1) {
|
|
124
148
|
printMessage(`Multiple matching profiles found.`, 'error');
|
|
125
149
|
profiles.forEach(p => {
|
|
@@ -128,76 +152,117 @@ export async function getConnectionProfileByHost(host) {
|
|
|
128
152
|
printMessage(`Please specify a unique sub-string`, 'error');
|
|
129
153
|
return null;
|
|
130
154
|
}
|
|
131
|
-
|
|
132
155
|
return {
|
|
133
156
|
tenant: profiles[0].tenant,
|
|
134
157
|
username: profiles[0].username ? profiles[0].username : null,
|
|
135
|
-
password: profiles[0].encodedPassword ? await
|
|
136
|
-
|
|
137
|
-
|
|
158
|
+
password: profiles[0].encodedPassword ? await crypto.decrypt(profiles[0].encodedPassword) : null,
|
|
159
|
+
logApiKey: profiles[0].logApiKey ? profiles[0].logApiKey : null,
|
|
160
|
+
logApiSecret: profiles[0].encodedLogApiSecret ? await crypto.decrypt(profiles[0].encodedLogApiSecret) : null,
|
|
138
161
|
authenticationService: profiles[0].authenticationService ? profiles[0].authenticationService : null,
|
|
139
|
-
authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides ? profiles[0].authenticationHeaderOverrides : {}
|
|
162
|
+
authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides ? profiles[0].authenticationHeaderOverrides : {},
|
|
163
|
+
svcacctId: profiles[0].svcacctId ? profiles[0].svcacctId : null,
|
|
164
|
+
svcacctJwk: profiles[0].encodedSvcacctJwk ? await crypto.decrypt(profiles[0].encodedSvcacctJwk) : null
|
|
140
165
|
};
|
|
141
166
|
} catch (e) {
|
|
142
167
|
printMessage(`Can not read saved connection info, please specify credentials on command line: ${e}`, 'error');
|
|
143
168
|
return null;
|
|
144
169
|
}
|
|
145
170
|
}
|
|
171
|
+
|
|
146
172
|
/**
|
|
147
173
|
* Get connection profile
|
|
148
174
|
* @returns {Object} connection profile or null
|
|
149
175
|
*/
|
|
150
|
-
|
|
151
176
|
export async function getConnectionProfile() {
|
|
152
|
-
return getConnectionProfileByHost(
|
|
177
|
+
return getConnectionProfileByHost(state.getHost());
|
|
153
178
|
}
|
|
179
|
+
|
|
154
180
|
/**
|
|
155
181
|
* Save connection profile
|
|
182
|
+
* @param {string} host host url for new profiles or unique substring for existing profiles
|
|
183
|
+
* @returns {Promise<boolean>} true if the operation succeeded, false otherwise
|
|
156
184
|
*/
|
|
157
|
-
|
|
158
|
-
export async function saveConnectionProfile() {
|
|
185
|
+
export async function saveConnectionProfile(host) {
|
|
159
186
|
const filename = getConnectionProfilesPath();
|
|
160
|
-
|
|
161
|
-
let
|
|
162
|
-
let
|
|
163
|
-
|
|
187
|
+
verboseMessage(`Saving connection profile in ${filename}`);
|
|
188
|
+
let profiles = {};
|
|
189
|
+
let profile = {
|
|
190
|
+
tenant: ''
|
|
191
|
+
};
|
|
164
192
|
try {
|
|
165
193
|
fs.statSync(filename);
|
|
166
194
|
const data = fs.readFileSync(filename, 'utf8');
|
|
167
|
-
|
|
195
|
+
profiles = JSON.parse(data);
|
|
168
196
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
printMessage(`Updating connection profile ${storage.session.getTenant()}`);
|
|
172
|
-
} else printMessage(`Adding connection profile ${storage.session.getTenant()}`);
|
|
173
|
-
} catch (e) {
|
|
174
|
-
printMessage(`Creating connection profiles file ${filename} with ${storage.session.getTenant()}`);
|
|
175
|
-
}
|
|
197
|
+
// find tenant
|
|
198
|
+
const found = findConnectionProfiles(profiles, host);
|
|
176
199
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
200
|
+
// replace tenant in session with real tenant url if necessary
|
|
201
|
+
if (found.length === 1) {
|
|
202
|
+
profile = found[0];
|
|
203
|
+
state.setHost(profile.tenant);
|
|
204
|
+
verboseMessage(`Existing profile: ${profile.tenant}`);
|
|
205
|
+
}
|
|
181
206
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
207
|
+
// connection profile not found, validate host is a real URL
|
|
208
|
+
if (found.length === 0) {
|
|
209
|
+
if (isValidUrl(host)) {
|
|
210
|
+
state.setHost(host);
|
|
211
|
+
verboseMessage(`New profile: ${host}`);
|
|
212
|
+
} else {
|
|
213
|
+
printMessage(`No existing profile found matching '${host}'. Provide a valid URL as the host argument to create a new profile.`, 'error');
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} catch (error) {
|
|
218
|
+
verboseMessage(`New profiles file ${filename} with new profile ${host}`);
|
|
185
219
|
}
|
|
186
220
|
|
|
187
|
-
|
|
188
|
-
|
|
221
|
+
// user account
|
|
222
|
+
if (state.getUsername()) profile.username = state.getUsername();
|
|
223
|
+
if (state.getPassword()) profile.encodedPassword = await crypto.encrypt(state.getPassword());
|
|
224
|
+
|
|
225
|
+
// log API
|
|
226
|
+
if (state.getLogApiKey()) profile.logApiKey = state.getLogApiKey();
|
|
227
|
+
if (state.getLogApiSecret()) profile.encodedLogApiSecret = await crypto.encrypt(state.getLogApiSecret());
|
|
228
|
+
|
|
229
|
+
// service account
|
|
230
|
+
if (state.getServiceAccountId()) profile.svcacctId = state.getServiceAccountId();
|
|
231
|
+
if (state.getServiceAccountJwk()) profile.encodedSvcacctJwk = await crypto.encrypt(state.getServiceAccountJwk());
|
|
232
|
+
|
|
233
|
+
// advanced settings
|
|
234
|
+
if (state.getAuthenticationService()) {
|
|
235
|
+
profile.authenticationService = state.getAuthenticationService();
|
|
236
|
+
printMessage('Advanced setting: Authentication Service: ' + state.getAuthenticationService(), 'info');
|
|
237
|
+
}
|
|
238
|
+
if (state.getAuthenticationHeaderOverrides() && Object.entries(state.getAuthenticationHeaderOverrides()).length) {
|
|
239
|
+
profile.authenticationHeaderOverrides = state.getAuthenticationHeaderOverrides();
|
|
189
240
|
printMessage('Advanced setting: Authentication Header Overrides: ', 'info');
|
|
190
|
-
printMessage(
|
|
241
|
+
printMessage(state.getAuthenticationHeaderOverrides(), 'info');
|
|
191
242
|
}
|
|
192
243
|
|
|
193
|
-
|
|
194
|
-
|
|
244
|
+
// remove the helper key 'tenant'
|
|
245
|
+
delete profile.tenant;
|
|
246
|
+
|
|
247
|
+
// update profiles
|
|
248
|
+
profiles[state.getHost()] = profile;
|
|
249
|
+
|
|
250
|
+
// sort profiles
|
|
251
|
+
const orderedProfiles = Object.keys(profiles).sort().reduce((obj, key) => {
|
|
252
|
+
obj[key] = profiles[key];
|
|
253
|
+
return obj;
|
|
254
|
+
}, {});
|
|
255
|
+
|
|
256
|
+
// save profiles
|
|
257
|
+
saveJsonToFile(orderedProfiles, filename, false);
|
|
258
|
+
verboseMessage(`Saved connection profile ${state.getHost()} in ${filename}`);
|
|
259
|
+
return true;
|
|
195
260
|
}
|
|
261
|
+
|
|
196
262
|
/**
|
|
197
263
|
* Delete connection profile
|
|
198
264
|
* @param {String} host host tenant host url or unique substring
|
|
199
265
|
*/
|
|
200
|
-
|
|
201
266
|
export function deleteConnectionProfile(host) {
|
|
202
267
|
const filename = getConnectionProfilesPath();
|
|
203
268
|
let connectionsData = {};
|
|
@@ -205,12 +270,11 @@ export function deleteConnectionProfile(host) {
|
|
|
205
270
|
if (err == null) {
|
|
206
271
|
const data = fs.readFileSync(filename, 'utf8');
|
|
207
272
|
connectionsData = JSON.parse(data);
|
|
208
|
-
const profiles =
|
|
209
|
-
|
|
273
|
+
const profiles = findConnectionProfiles(connectionsData, host);
|
|
210
274
|
if (profiles.length == 1) {
|
|
211
|
-
printMessage(`Deleting connection profile ${profiles[0].tenant}`);
|
|
212
275
|
delete connectionsData[profiles[0].tenant];
|
|
213
276
|
fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));
|
|
277
|
+
printMessage(`Deleted connection profile ${profiles[0].tenant}`);
|
|
214
278
|
} else {
|
|
215
279
|
if (profiles.length > 1) {
|
|
216
280
|
printMessage(`Multiple matching profiles found.`, 'error');
|
|
@@ -230,33 +294,79 @@ export function deleteConnectionProfile(host) {
|
|
|
230
294
|
}
|
|
231
295
|
});
|
|
232
296
|
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Describe connection profile
|
|
300
|
+
* @param {string} host Host URL or unique substring
|
|
301
|
+
* @param {boolean} showSecrets Whether secrets should be shown in clear text or not
|
|
302
|
+
*/
|
|
233
303
|
export async function describeConnectionProfile(host, showSecrets) {
|
|
234
304
|
const profile = await getConnectionProfileByHost(host);
|
|
235
|
-
|
|
236
305
|
if (profile) {
|
|
306
|
+
const present = '[present]';
|
|
307
|
+
const jwk = profile.svcacctJwk;
|
|
237
308
|
if (!showSecrets) {
|
|
309
|
+
if (profile.password) profile.password = present;
|
|
310
|
+
if (profile.logApiSecret) profile.logApiSecret = present;
|
|
311
|
+
if (profile.svcacctJwk) profile['svcacctJwk'] = present;
|
|
312
|
+
}
|
|
313
|
+
if (!profile.username) {
|
|
314
|
+
delete profile.username;
|
|
238
315
|
delete profile.password;
|
|
239
|
-
delete profile.secret;
|
|
240
316
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
delete profile.
|
|
244
|
-
|
|
317
|
+
if (!profile.logApiKey) {
|
|
318
|
+
delete profile.logApiKey;
|
|
319
|
+
delete profile.logApiSecret;
|
|
320
|
+
}
|
|
321
|
+
if (!profile.svcacctId) {
|
|
322
|
+
delete profile.svcacctId;
|
|
323
|
+
delete profile.svcacctJwk;
|
|
324
|
+
}
|
|
325
|
+
if (showSecrets && jwk) {
|
|
326
|
+
profile['svcacctJwk'] = 'see below';
|
|
327
|
+
}
|
|
328
|
+
if (!profile.authenticationService) {
|
|
329
|
+
delete profile.authenticationService;
|
|
245
330
|
}
|
|
246
|
-
|
|
247
331
|
const keyMap = {
|
|
248
332
|
tenant: 'Host',
|
|
249
333
|
username: 'Username',
|
|
250
334
|
password: 'Password',
|
|
251
|
-
|
|
252
|
-
|
|
335
|
+
logApiKey: 'Log API Key',
|
|
336
|
+
logApiSecret: 'Log API Secret',
|
|
253
337
|
authenticationService: 'Authentication Service',
|
|
254
|
-
authenticationHeaderOverrides: 'Authentication Header Overrides'
|
|
338
|
+
authenticationHeaderOverrides: 'Authentication Header Overrides',
|
|
339
|
+
svcacctId: 'Service Account Id',
|
|
340
|
+
svcacctJwk: 'Service Account JWK'
|
|
255
341
|
};
|
|
256
342
|
const table = createObjectTable(profile, keyMap);
|
|
257
343
|
printMessage(table.toString(), 'data');
|
|
344
|
+
if (showSecrets && jwk) {
|
|
345
|
+
printMessage(jwk, 'data');
|
|
346
|
+
}
|
|
258
347
|
} else {
|
|
259
348
|
printMessage(`No connection profile ${host} found`);
|
|
260
349
|
}
|
|
261
350
|
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Create a new service account using auto-generated parameters
|
|
354
|
+
* @returns {Promise<ObjectSkeletonInterface>} A promise resolving to a service account object
|
|
355
|
+
*/
|
|
356
|
+
export async function addNewServiceAccount() {
|
|
357
|
+
debugMessage(`ConnectionProfileOps.addNewServiceAccount: start`);
|
|
358
|
+
const name = `Frodo-SA-${new Date().getTime()}`;
|
|
359
|
+
debugMessage(`ConnectionProfileOps.addNewServiceAccount: name=${name}...`);
|
|
360
|
+
const description = `${state.getUsername()}'s Frodo Service Account`;
|
|
361
|
+
const scope = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];
|
|
362
|
+
const jwkPrivate = await createJwkRsa();
|
|
363
|
+
const jwkPublic = await getJwkRsaPublic(jwkPrivate);
|
|
364
|
+
const jwks = createJwks(jwkPublic);
|
|
365
|
+
const sa = await createServiceAccount(name, description, 'Active', scope, jwks);
|
|
366
|
+
debugMessage(`ConnectionProfileOps.addNewServiceAccount: id=${sa._id}`);
|
|
367
|
+
state.setServiceAccountId(sa._id);
|
|
368
|
+
state.setServiceAccountJwk(jwkPrivate);
|
|
369
|
+
debugMessage(`ConnectionProfileOps.addNewServiceAccount: end`);
|
|
370
|
+
return sa;
|
|
371
|
+
}
|
|
262
372
|
//# sourceMappingURL=ConnectionProfileOps.js.map
|
|
@@ -8,11 +8,11 @@ describe('ConnectionProfileOps', () => {
|
|
|
8
8
|
const user = 'frodo.baggins@shire.me';
|
|
9
9
|
const password = 'G@nd@lfTheW153';
|
|
10
10
|
const connectionProfilePath = `${homedir()}/connections1.json`;
|
|
11
|
-
state.
|
|
12
|
-
state.
|
|
13
|
-
state.
|
|
14
|
-
state.
|
|
15
|
-
await ConnectionProfile.saveConnectionProfile();
|
|
11
|
+
state.setHost(host);
|
|
12
|
+
state.setUsername(user);
|
|
13
|
+
state.setPassword(password);
|
|
14
|
+
state.setConnectionProfilesPath(connectionProfilePath);
|
|
15
|
+
await ConnectionProfile.saveConnectionProfile(host);
|
|
16
16
|
expect(fs.existsSync(connectionProfilePath)).toBeTruthy();
|
|
17
17
|
const connections = JSON.parse(fs.readFileSync(connectionProfilePath, 'utf8'));
|
|
18
18
|
expect(connections).toBeTruthy();
|
|
@@ -24,14 +24,14 @@ describe('ConnectionProfileOps', () => {
|
|
|
24
24
|
const host = 'https://openam-tenant-name.forgeblocks.com/am';
|
|
25
25
|
const user = 'frodo.baggins@shire.me';
|
|
26
26
|
const password = 'G@nd@lfTheW153';
|
|
27
|
-
const connectionProfilePath = `${homedir()}/connections2.json`;
|
|
28
|
-
|
|
27
|
+
const connectionProfilePath = `${homedir()}/connections2.json`;
|
|
28
|
+
// set the hard-coded master key
|
|
29
29
|
process.env[FRODO_CONNECTION_PROFILES_PATH_KEY] = connectionProfilePath;
|
|
30
|
-
state.
|
|
31
|
-
state.
|
|
32
|
-
state.
|
|
33
|
-
state.
|
|
34
|
-
await ConnectionProfile.saveConnectionProfile();
|
|
30
|
+
state.setHost(host);
|
|
31
|
+
state.setUsername(user);
|
|
32
|
+
state.setPassword(password);
|
|
33
|
+
state.setConnectionProfilesPath('');
|
|
34
|
+
await ConnectionProfile.saveConnectionProfile(host);
|
|
35
35
|
expect(ConnectionProfile.getConnectionProfilesPath()).toEqual(connectionProfilePath);
|
|
36
36
|
expect(fs.existsSync(connectionProfilePath)).toBeTruthy();
|
|
37
37
|
const connections = JSON.parse(fs.readFileSync(connectionProfilePath, 'utf8'));
|
|
@@ -45,14 +45,14 @@ describe('ConnectionProfileOps', () => {
|
|
|
45
45
|
const user = 'frodo.baggins@shire.me';
|
|
46
46
|
const password = 'G@nd@lfTheW153';
|
|
47
47
|
const connectionProfilePath = `${homedir()}/connections3.json`;
|
|
48
|
-
const masterKey = 'bxnQlhcU5VfyDs+BBPhRhK09yHaNtdIIk85HUMKBnqg=';
|
|
49
|
-
|
|
48
|
+
const masterKey = 'bxnQlhcU5VfyDs+BBPhRhK09yHaNtdIIk85HUMKBnqg=';
|
|
49
|
+
// set the hard-coded master key
|
|
50
50
|
process.env[FRODO_MASTER_KEY_KEY] = masterKey;
|
|
51
|
-
state.
|
|
52
|
-
state.
|
|
53
|
-
state.
|
|
54
|
-
state.
|
|
55
|
-
await ConnectionProfile.saveConnectionProfile();
|
|
51
|
+
state.setHost(host);
|
|
52
|
+
state.setUsername(user);
|
|
53
|
+
state.setPassword(password);
|
|
54
|
+
state.setConnectionProfilesPath(connectionProfilePath);
|
|
55
|
+
await ConnectionProfile.saveConnectionProfile(host);
|
|
56
56
|
expect(fs.existsSync(connectionProfilePath)).toBeTruthy();
|
|
57
57
|
const connections = JSON.parse(fs.readFileSync(connectionProfilePath, 'utf8'));
|
|
58
58
|
expect(connections).toBeTruthy();
|