@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CirclesOfTrustOps.js","names":["getFileDataTemplate","meta","script","saml","hosted","remote","metadata","cot","listCirclesOfTrust","long","cotList","getCirclesOfTrust","result","error","printMessage","sort","a","b","_id","localeCompare","forEach","table","createTable","push","description","status","trustedProviders","map","provider","split","join","toString","exportDependencies","cotData","fileData","exportCircleOfTrust","cotId","file","fileName","getTypedFilename","createProgressIndicator","_","cloneDeep","getCircleOfTrust","updateProgressIndicator","saveJsonToFile","stopProgressIndicator","brightCyan","err","exportCirclesOfTrustToFile","getRealmString","allCotData","length","_rev","exportCirclesOfTrustToFiles","importDependencies","importCircleOfTrust","fs","readFile","data","JSON","parse","validateImport","get","createCircleOfTrust","createProviderErr","response","importFirstCircleOfTrust","hasOwnProperty","call","createCircleOfTrustErr","importCirclesOfTrustFromFile","Object","keys","importCirclesOfTrustFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","total","totalErrors","readFileSync","errors"],"sources":["ops/CirclesOfTrustOps.ts"],"sourcesContent":["import fs from 'fs';\nimport _ from 'lodash';\nimport {\n createTable,\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n} from './utils/Console';\nimport {\n getCirclesOfTrust,\n getCircleOfTrust,\n createCircleOfTrust,\n} from '../api/CirclesOfTrustApi';\nimport {\n getRealmString,\n getTypedFilename,\n saveJsonToFile,\n validateImport,\n} from './utils/ExportImportUtils';\n\n// use a function vs a template variable to avoid problems in loops\nfunction getFileDataTemplate() {\n return {\n meta: {},\n script: {},\n saml: {\n hosted: {},\n remote: {},\n metadata: {},\n cot: {},\n },\n };\n}\n\n/**\n * List entity providers\n * @param {String} long Long list format with details\n */\nexport async function listCirclesOfTrust(long = false) {\n let cotList = [];\n try {\n cotList = (await getCirclesOfTrust()).result;\n } catch (error) {\n printMessage(`getCirclesOfTrust ERROR: ${error}`, 'error');\n printMessage(error, 'data');\n }\n cotList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n cotList.forEach((cot) => {\n printMessage(`${cot._id}`, 'data');\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Description'['brightCyan'],\n 'Status'['brightCyan'],\n 'Trusted Providers'['brightCyan'],\n ]);\n cotList.forEach((cot) => {\n table.push([\n cot._id,\n cot.description,\n cot.status,\n cot.trustedProviders\n .map((provider) => provider.split('|')[0])\n .join('\\n'),\n ]);\n });\n printMessage(table.toString());\n }\n}\n\n/**\n * Include dependencies in the export file\n * @param {Object} cotData Object representing a SAML circle of trust\n * @param {Object} fileData File data object to add dependencies to\n */\nasync function exportDependencies(cotData, fileData) {\n // TODO: Export dependencies\n return [cotData, fileData];\n}\n\n/**\n * Export a single circle of trust to file\n * @param {String} cotId circle of trust id/name\n * @param {String} file Optional filename\n */\nexport async function exportCircleOfTrust(cotId, file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(cotId, 'cot.saml');\n }\n createProgressIndicator(1, `Exporting circle of trust ${cotId}`);\n try {\n const cotData = _.cloneDeep(getCircleOfTrust(cotId));\n delete cotData['_rev'];\n updateProgressIndicator(`Exporting ${cotId}`);\n const fileData = getFileDataTemplate();\n fileData.saml.cot[cotId] = cotData;\n await exportDependencies(cotData, fileData);\n saveJsonToFile(fileData, fileName);\n stopProgressIndicator(\n `Exported ${cotId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressIndicator(`${err}`);\n printMessage(err, 'error');\n }\n}\n\n/**\n * Export all circles of trust to one file\n * @param {String} file Optional filename\n */\nexport async function exportCirclesOfTrustToFile(file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(\n `all${getRealmString()}CirclesOfTrust`,\n 'cot.saml'\n );\n }\n const fileData = getFileDataTemplate();\n let allCotData = [];\n try {\n allCotData = _.cloneDeep((await getCirclesOfTrust()).result);\n createProgressIndicator(allCotData.length, 'Exporting circles of trust');\n for (const cotData of allCotData) {\n delete cotData._rev;\n updateProgressIndicator(`Exporting circle of trust ${cotData._id}`);\n // eslint-disable-next-line no-await-in-loop\n await exportDependencies(cotData, fileData);\n fileData.saml.cot[cotData._id] = cotData;\n }\n saveJsonToFile(fileData, fileName);\n stopProgressIndicator(\n `${allCotData.length} circle(s) of trust exported to ${fileName}.`\n );\n } catch (error) {\n printMessage(`getCirclesOfTrust ERROR: ${error}`, 'error');\n printMessage(error, 'data');\n }\n}\n\n/**\n * Export all circles of trust to individual files\n */\nexport async function exportCirclesOfTrustToFiles() {\n let allCotData = [];\n try {\n allCotData = _.cloneDeep((await getCirclesOfTrust()).result);\n createProgressIndicator(allCotData.length, 'Exporting circles of trust');\n for (const cotData of allCotData) {\n delete cotData._rev;\n updateProgressIndicator(`Exporting circle of trust ${cotData._id}`);\n const fileName = getTypedFilename(cotData._id, 'cot.saml');\n const fileData = getFileDataTemplate();\n // eslint-disable-next-line no-await-in-loop\n await exportDependencies(cotData, fileData);\n fileData.saml.cot[cotData._id] = cotData;\n saveJsonToFile(fileData, fileName);\n }\n stopProgressIndicator(`${allCotData.length} providers exported.`);\n } catch (error) {\n printMessage(`getCirclesOfTrust ERROR: ${error}`, 'error');\n printMessage(error, 'data');\n }\n}\n\n/**\n * Include dependencies from the import file\n * @param {Object} cotData Object representing a SAML circle of trust\n * @param {Object} fileData File data object to read dependencies from\n */\nasync function importDependencies(cotData, fileData) {\n // TODO: Import dependencies\n return [cotData, fileData];\n}\n\n/**\n * Import a SAML circle of trust by id/name from file\n * @param {String} cotId Circle of trust id/name\n * @param {String} file Import file name\n */\nexport async function importCircleOfTrust(cotId, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(1, 'Importing circle of trust...');\n const cotData = _.get(fileData, ['saml', 'cot', cotId]);\n if (cotData) {\n updateProgressIndicator(`Importing ${cotId}`);\n await importDependencies(cotData, fileData);\n try {\n await createCircleOfTrust(cotData);\n stopProgressIndicator(`Successfully imported ${cotId}.`);\n } catch (createProviderErr) {\n stopProgressIndicator(`Error importing ${cotId}.`);\n printMessage(`Error importing ${cotId}`, 'error');\n printMessage(createProviderErr.response.data, 'error');\n }\n } else {\n stopProgressIndicator(\n `Circle of trust ${cotId.brightCyan} not found in ${file.brightCyan}!`\n );\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import first SAML circle of trust from file\n * @param {String} file Import file name\n */\nexport async function importFirstCircleOfTrust(file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(1, 'Importing circle of trust...');\n for (const cotId in fileData.saml.cot) {\n if ({}.hasOwnProperty.call(fileData.saml.cot, cotId)) {\n const cotData = _.cloneDeep(fileData.saml.cot[cotId]);\n updateProgressIndicator(`Importing ${cotId}`);\n // eslint-disable-next-line no-await-in-loop\n await importDependencies(cotData, fileData);\n try {\n await createCircleOfTrust(cotData);\n stopProgressIndicator(`Successfully imported ${cotId}.`);\n } catch (createCircleOfTrustErr) {\n stopProgressIndicator(`Error importing ${cotId}.`);\n printMessage(`Error importing ${cotId}`, 'error');\n printMessage(createCircleOfTrustErr.response.data, 'error');\n }\n break;\n }\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML circles of trust from file\n * @param {String} file Import file name\n */\nexport async function importCirclesOfTrustFromFile(file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(\n Object.keys(fileData.saml.cot).length,\n 'Importing circles of trust...'\n );\n for (const cotId in fileData.saml.cot) {\n if ({}.hasOwnProperty.call(fileData.saml.cot, cotId)) {\n const cotData = _.cloneDeep(fileData.saml.cot[cotId]);\n // eslint-disable-next-line no-await-in-loop\n await importDependencies(cotData, fileData);\n try {\n // eslint-disable-next-line no-await-in-loop\n await createCircleOfTrust(cotData);\n updateProgressIndicator(`Imported ${cotId}`);\n } catch (createCircleOfTrustErr) {\n printMessage(`\\nError importing ${cotId}`, 'error');\n printMessage(createCircleOfTrustErr.response.data, 'error');\n }\n }\n }\n stopProgressIndicator(`Circles of trust imported.`);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML circles of trust from all *.cot.saml.json files in the current directory\n */\nexport async function importCirclesOfTrustFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.cot.saml.json')\n );\n createProgressIndicator(jsonFiles.length, 'Importing circles or trust...');\n let total = 0;\n let totalErrors = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n total += _.keys(fileData.saml.cot).length;\n let errors = 0;\n for (const cotId in fileData.saml.cot) {\n if ({}.hasOwnProperty.call(fileData.saml.cot, cotId)) {\n const cotData = _.cloneDeep(fileData.saml.cot[cotId]);\n // eslint-disable-next-line no-await-in-loop\n await importDependencies(cotData, fileData);\n try {\n // eslint-disable-next-line no-await-in-loop\n await createCircleOfTrust(cotData);\n // updateProgressIndicator(`Imported ${cotId}`);\n } catch (createCircleOfTrustErr) {\n errors += 1;\n printMessage(`\\nError importing ${cotId}`, 'error');\n printMessage(createCircleOfTrustErr.response.data, 'error');\n }\n }\n }\n totalErrors += errors;\n updateProgressIndicator(\n `Imported ${\n _.keys(fileData.saml.cot).length - errors\n } circle(s) of trust from ${file}`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n `Imported ${total - totalErrors} of ${total} circle(s) of trust from ${\n jsonFiles.length\n } file(s).`\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAOA;;AAKA;;;;;;;;AAOA;AACA,SAASA,mBAAT,GAA+B;EAC7B,OAAO;IACLC,IAAI,EAAE,EADD;IAELC,MAAM,EAAE,EAFH;IAGLC,IAAI,EAAE;MACJC,MAAM,EAAE,EADJ;MAEJC,MAAM,EAAE,EAFJ;MAGJC,QAAQ,EAAE,EAHN;MAIJC,GAAG,EAAE;IAJD;EAHD,CAAP;AAUD;AAED;AACA;AACA;AACA;;;SACsBC,kB;;;AAkCtB;AACA;AACA;AACA;AACA;;;;0CAtCO,aAAgD;IAAA,IAAdC,IAAc,uEAAP,KAAO;IACrD,IAAIC,OAAO,GAAG,EAAd;;IACA,IAAI;MACFA,OAAO,GAAG,OAAO,IAAAC,oCAAA,GAAP,EAA4BC,MAAtC;IACD,CAFD,CAEE,OAAOC,KAAP,EAAc;MACd,IAAAC,qBAAA,qCAAyCD,KAAzC,GAAkD,OAAlD;MACA,IAAAC,qBAAA,EAAaD,KAAb,EAAoB,MAApB;IACD;;IACDH,OAAO,CAACK,IAAR,CAAa,CAACC,CAAD,EAAIC,CAAJ,KAAUD,CAAC,CAACE,GAAF,CAAMC,aAAN,CAAoBF,CAAC,CAACC,GAAtB,CAAvB;;IACA,IAAI,CAACT,IAAL,EAAW;MACTC,OAAO,CAACU,OAAR,CAAiBb,GAAD,IAAS;QACvB,IAAAO,qBAAA,YAAgBP,GAAG,CAACW,GAApB,GAA2B,MAA3B;MACD,CAFD;IAGD,CAJD,MAIO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,CAACtB,OAAD,EAAUC,QAAV,CAAxB;;YACA,IAAI;cACF;cACA,MAAM,IAAA8B,sCAAA,EAAoB/B,OAApB,CAAN,CAFE,CAGF;YACD,CAJD,CAIE,OAAOqC,sBAAP,EAA+B;cAC/Be,MAAM,IAAI,CAAV;cACA,IAAAvE,qBAAA,8BAAkCsB,KAAlC,GAA2C,OAA3C;cACA,IAAAtB,qBAAA,EAAawD,sBAAsB,CAACJ,QAAvB,CAAgCP,IAA7C,EAAmD,OAAnD;YACD;UACF;QACF;;QACDwB,WAAW,IAAIE,MAAf;QACA,IAAAzC,gCAAA,qBAEIH,eAAA,CAAEgC,IAAF,CAAOvC,QAAQ,CAAC/B,IAAT,CAAcI,GAArB,EAA0B6C,MAA1B,GAAmCiC,MAFvC,sCAG8BhD,IAH9B;MAKD,CAzBD,MAyBO;QACL,IAAAvB,qBAAA,0BAA8BuB,IAA9B,eAA8C,OAA9C;MACD;IACF;;IACD,IAAAS,8BAAA,qBACcoC,KAAK,GAAGC,WADtB,iBACwCD,KADxC,sCAEIL,SAAS,CAACzB,MAFd;EAKD,C"}
|
|
1
|
+
{"version":3,"file":"CirclesOfTrustOps.js","names":["getFileDataTemplate","meta","script","saml","hosted","remote","metadata","cot","listCirclesOfTrust","long","cotList","getCirclesOfTrust","result","error","printMessage","sort","a","b","_id","localeCompare","forEach","table","createTable","push","description","status","trustedProviders","map","provider","split","join","toString","exportDependencies","cotData","fileData","exportCircleOfTrust","cotId","file","fileName","getTypedFilename","createProgressIndicator","_","cloneDeep","getCircleOfTrust","updateProgressIndicator","saveJsonToFile","stopProgressIndicator","brightCyan","err","exportCirclesOfTrustToFile","getRealmString","allCotData","length","_rev","exportCirclesOfTrustToFiles","importDependencies","importCircleOfTrust","fs","readFile","data","JSON","parse","validateImport","get","createCircleOfTrust","createProviderErr","response","importFirstCircleOfTrust","hasOwnProperty","call","createCircleOfTrustErr","importCirclesOfTrustFromFile","Object","keys","importCirclesOfTrustFromFiles","names","readdirSync","jsonFiles","filter","name","toLowerCase","endsWith","total","totalErrors","readFileSync","errors"],"sources":["ops/CirclesOfTrustOps.ts"],"sourcesContent":["import fs from 'fs';\nimport _ from 'lodash';\nimport {\n createTable,\n printMessage,\n createProgressIndicator,\n updateProgressIndicator,\n stopProgressIndicator,\n} from './utils/Console';\nimport {\n getCirclesOfTrust,\n getCircleOfTrust,\n createCircleOfTrust,\n} from '../api/CirclesOfTrustApi';\nimport {\n getRealmString,\n getTypedFilename,\n saveJsonToFile,\n validateImport,\n} from './utils/ExportImportUtils';\n\n// use a function vs a template variable to avoid problems in loops\nfunction getFileDataTemplate() {\n return {\n meta: {},\n script: {},\n saml: {\n hosted: {},\n remote: {},\n metadata: {},\n cot: {},\n },\n };\n}\n\n/**\n * List entity providers\n * @param {String} long Long list format with details\n */\nexport async function listCirclesOfTrust(long = false) {\n let cotList = [];\n try {\n cotList = (await getCirclesOfTrust()).result;\n } catch (error) {\n printMessage(`getCirclesOfTrust ERROR: ${error}`, 'error');\n printMessage(error, 'data');\n }\n cotList.sort((a, b) => a._id.localeCompare(b._id));\n if (!long) {\n cotList.forEach((cot) => {\n printMessage(`${cot._id}`, 'data');\n });\n } else {\n const table = createTable([\n 'Name'['brightCyan'],\n 'Description'['brightCyan'],\n 'Status'['brightCyan'],\n 'Trusted Providers'['brightCyan'],\n ]);\n cotList.forEach((cot) => {\n table.push([\n cot._id,\n cot.description,\n cot.status,\n cot.trustedProviders\n .map((provider) => provider.split('|')[0])\n .join('\\n'),\n ]);\n });\n printMessage(table.toString());\n }\n}\n\n/**\n * Include dependencies in the export file\n * @param {Object} cotData Object representing a SAML circle of trust\n * @param {Object} fileData File data object to add dependencies to\n */\nasync function exportDependencies(cotData, fileData) {\n // TODO: Export dependencies\n return [cotData, fileData];\n}\n\n/**\n * Export a single circle of trust to file\n * @param {String} cotId circle of trust id/name\n * @param {String} file Optional filename\n */\nexport async function exportCircleOfTrust(cotId, file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(cotId, 'cot.saml');\n }\n createProgressIndicator(1, `Exporting circle of trust ${cotId}`);\n try {\n const cotData = _.cloneDeep(getCircleOfTrust(cotId));\n delete cotData['_rev'];\n updateProgressIndicator(`Exporting ${cotId}`);\n const fileData = getFileDataTemplate();\n fileData.saml.cot[cotId] = cotData;\n await exportDependencies(cotData, fileData);\n saveJsonToFile(fileData, fileName);\n stopProgressIndicator(\n `Exported ${cotId.brightCyan} to ${fileName.brightCyan}.`\n );\n } catch (err) {\n stopProgressIndicator(`${err}`);\n printMessage(err, 'error');\n }\n}\n\n/**\n * Export all circles of trust to one file\n * @param {String} file Optional filename\n */\nexport async function exportCirclesOfTrustToFile(file = null) {\n let fileName = file;\n if (!fileName) {\n fileName = getTypedFilename(\n `all${getRealmString()}CirclesOfTrust`,\n 'cot.saml'\n );\n }\n const fileData = getFileDataTemplate();\n let allCotData = [];\n try {\n allCotData = _.cloneDeep((await getCirclesOfTrust()).result);\n createProgressIndicator(allCotData.length, 'Exporting circles of trust');\n for (const cotData of allCotData) {\n delete cotData._rev;\n updateProgressIndicator(`Exporting circle of trust ${cotData._id}`);\n // eslint-disable-next-line no-await-in-loop\n await exportDependencies(cotData, fileData);\n fileData.saml.cot[cotData._id] = cotData;\n }\n saveJsonToFile(fileData, fileName);\n stopProgressIndicator(\n `${allCotData.length} circle(s) of trust exported to ${fileName}.`\n );\n } catch (error) {\n printMessage(`getCirclesOfTrust ERROR: ${error}`, 'error');\n printMessage(error, 'data');\n }\n}\n\n/**\n * Export all circles of trust to individual files\n */\nexport async function exportCirclesOfTrustToFiles() {\n let allCotData = [];\n try {\n allCotData = _.cloneDeep((await getCirclesOfTrust()).result);\n createProgressIndicator(allCotData.length, 'Exporting circles of trust');\n for (const cotData of allCotData) {\n delete cotData._rev;\n updateProgressIndicator(`Exporting circle of trust ${cotData._id}`);\n const fileName = getTypedFilename(cotData._id, 'cot.saml');\n const fileData = getFileDataTemplate();\n // eslint-disable-next-line no-await-in-loop\n await exportDependencies(cotData, fileData);\n fileData.saml.cot[cotData._id] = cotData;\n saveJsonToFile(fileData, fileName);\n }\n stopProgressIndicator(`${allCotData.length} providers exported.`);\n } catch (error) {\n printMessage(`getCirclesOfTrust ERROR: ${error}`, 'error');\n printMessage(error, 'data');\n }\n}\n\n/**\n * Include dependencies from the import file\n * @param {Object} cotData Object representing a SAML circle of trust\n * @param {Object} fileData File data object to read dependencies from\n */\nasync function importDependencies(cotData, fileData) {\n // TODO: Import dependencies\n return [cotData, fileData];\n}\n\n/**\n * Import a SAML circle of trust by id/name from file\n * @param {String} cotId Circle of trust id/name\n * @param {String} file Import file name\n */\nexport async function importCircleOfTrust(cotId, file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(1, 'Importing circle of trust...');\n const cotData = _.get(fileData, ['saml', 'cot', cotId]);\n if (cotData) {\n updateProgressIndicator(`Importing ${cotId}`);\n await importDependencies(cotData, fileData);\n try {\n await createCircleOfTrust(cotData);\n stopProgressIndicator(`Successfully imported ${cotId}.`);\n } catch (createProviderErr) {\n stopProgressIndicator(`Error importing ${cotId}.`);\n printMessage(`Error importing ${cotId}`, 'error');\n printMessage(createProviderErr.response.data, 'error');\n }\n } else {\n stopProgressIndicator(\n `Circle of trust ${cotId.brightCyan} not found in ${file.brightCyan}!`\n );\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import first SAML circle of trust from file\n * @param {String} file Import file name\n */\nexport async function importFirstCircleOfTrust(file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(1, 'Importing circle of trust...');\n for (const cotId in fileData.saml.cot) {\n if ({}.hasOwnProperty.call(fileData.saml.cot, cotId)) {\n const cotData = _.cloneDeep(fileData.saml.cot[cotId]);\n updateProgressIndicator(`Importing ${cotId}`);\n // eslint-disable-next-line no-await-in-loop\n await importDependencies(cotData, fileData);\n try {\n await createCircleOfTrust(cotData);\n stopProgressIndicator(`Successfully imported ${cotId}.`);\n } catch (createCircleOfTrustErr) {\n stopProgressIndicator(`Error importing ${cotId}.`);\n printMessage(`Error importing ${cotId}`, 'error');\n printMessage(createCircleOfTrustErr.response.data, 'error');\n }\n break;\n }\n }\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML circles of trust from file\n * @param {String} file Import file name\n */\nexport async function importCirclesOfTrustFromFile(file) {\n fs.readFile(file, 'utf8', async (err, data) => {\n if (err) throw err;\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n createProgressIndicator(\n Object.keys(fileData.saml.cot).length,\n 'Importing circles of trust...'\n );\n for (const cotId in fileData.saml.cot) {\n if ({}.hasOwnProperty.call(fileData.saml.cot, cotId)) {\n const cotData = _.cloneDeep(fileData.saml.cot[cotId]);\n // eslint-disable-next-line no-await-in-loop\n await importDependencies(cotData, fileData);\n try {\n // eslint-disable-next-line no-await-in-loop\n await createCircleOfTrust(cotData);\n updateProgressIndicator(`Imported ${cotId}`);\n } catch (createCircleOfTrustErr) {\n printMessage(`\\nError importing ${cotId}`, 'error');\n printMessage(createCircleOfTrustErr.response.data, 'error');\n }\n }\n }\n stopProgressIndicator(`Circles of trust imported.`);\n } else {\n printMessage('Import validation failed...', 'error');\n }\n });\n}\n\n/**\n * Import all SAML circles of trust from all *.cot.saml.json files in the current directory\n */\nexport async function importCirclesOfTrustFromFiles() {\n const names = fs.readdirSync('.');\n const jsonFiles = names.filter((name) =>\n name.toLowerCase().endsWith('.cot.saml.json')\n );\n createProgressIndicator(jsonFiles.length, 'Importing circles or trust...');\n let total = 0;\n let totalErrors = 0;\n for (const file of jsonFiles) {\n const data = fs.readFileSync(file, 'utf8');\n const fileData = JSON.parse(data);\n if (validateImport(fileData.meta)) {\n total += _.keys(fileData.saml.cot).length;\n let errors = 0;\n for (const cotId in fileData.saml.cot) {\n if ({}.hasOwnProperty.call(fileData.saml.cot, cotId)) {\n const cotData = _.cloneDeep(fileData.saml.cot[cotId]);\n // eslint-disable-next-line no-await-in-loop\n await importDependencies(cotData, fileData);\n try {\n // eslint-disable-next-line no-await-in-loop\n await createCircleOfTrust(cotData);\n // updateProgressIndicator(`Imported ${cotId}`);\n } catch (createCircleOfTrustErr) {\n errors += 1;\n printMessage(`\\nError importing ${cotId}`, 'error');\n printMessage(createCircleOfTrustErr.response.data, 'error');\n }\n }\n }\n totalErrors += errors;\n updateProgressIndicator(\n `Imported ${\n _.keys(fileData.saml.cot).length - errors\n } circle(s) of trust from ${file}`\n );\n } else {\n printMessage(`Validation of ${file} failed!`, 'error');\n }\n }\n stopProgressIndicator(\n `Imported ${total - totalErrors} of ${total} circle(s) of trust from ${\n jsonFiles.length\n } file(s).`\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AAOA;AAKA;AAKmC;AAAA;AAAA;AAEnC;AACA,SAASA,mBAAmB,GAAG;EAC7B,OAAO;IACLC,IAAI,EAAE,CAAC,CAAC;IACRC,MAAM,EAAE,CAAC,CAAC;IACVC,IAAI,EAAE;MACJC,MAAM,EAAE,CAAC,CAAC;MACVC,MAAM,EAAE,CAAC,CAAC;MACVC,QAAQ,EAAE,CAAC,CAAC;MACZC,GAAG,EAAE,CAAC;IACR;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AAHA,SAIsBC,kBAAkB;EAAA;AAAA;AAkCxC;AACA;AACA;AACA;AACA;AAJA;EAAA,wCAlCO,aAAgD;IAAA,IAAdC,IAAI,uEAAG,KAAK;IACnD,IAAIC,OAAO,GAAG,EAAE;IAChB,IAAI;MACFA,OAAO,GAAG,OAAO,IAAAC,oCAAiB,GAAE,EAAEC,MAAM;IAC9C,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,IAAAC,qBAAY,qCAA6BD,KAAK,GAAI,OAAO,CAAC;MAC1D,IAAAC,qBAAY,EAACD,KAAK,EAAE,MAAM,C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,IAAI,CAACI,GAAG,CAAC,CAAC6C,MAAM,GAAGiC,MAAM,sCACfhD,IAAI,EACjC;MACH,CAAC,MAAM;QACL,IAAAvB,qBAAY,0BAAkBuB,IAAI,eAAY,OAAO,CAAC;MACxD;IACF;IACA,IAAAS,8BAAqB,qBACPoC,KAAK,GAAGC,WAAW,iBAAOD,KAAK,sCACzCL,SAAS,CAACzB,MAAM,eAEnB;EACH,CAAC;EAAA;AAAA"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.addNewServiceAccount = addNewServiceAccount;
|
|
6
7
|
exports.deleteConnectionProfile = deleteConnectionProfile;
|
|
7
8
|
exports.describeConnectionProfile = describeConnectionProfile;
|
|
8
9
|
exports.getConnectionProfile = getConnectionProfile;
|
|
@@ -11,75 +12,68 @@ exports.getConnectionProfilesPath = getConnectionProfilesPath;
|
|
|
11
12
|
exports.initConnectionProfiles = initConnectionProfiles;
|
|
12
13
|
exports.listConnectionProfiles = listConnectionProfiles;
|
|
13
14
|
exports.saveConnectionProfile = saveConnectionProfile;
|
|
14
|
-
|
|
15
15
|
var _fs = _interopRequireDefault(require("fs"));
|
|
16
|
-
|
|
17
16
|
var _os = _interopRequireDefault(require("os"));
|
|
18
|
-
|
|
19
17
|
var _path = _interopRequireDefault(require("path"));
|
|
20
|
-
|
|
21
|
-
var _SessionStorage = _interopRequireDefault(require("../storage/SessionStorage"));
|
|
22
|
-
|
|
18
|
+
var state = _interopRequireWildcard(require("../shared/State"));
|
|
23
19
|
var _DataProtection = _interopRequireDefault(require("./utils/DataProtection"));
|
|
24
|
-
|
|
25
20
|
var _Console = require("./utils/Console");
|
|
26
|
-
|
|
27
21
|
var _StaticStorage = require("../storage/StaticStorage");
|
|
28
|
-
|
|
22
|
+
var _JoseOps = require("./JoseOps");
|
|
23
|
+
var _ServiceAccountOps = require("./ServiceAccountOps");
|
|
24
|
+
var _ExportImportUtils = require("./utils/ExportImportUtils");
|
|
25
|
+
var _OpsUtils = require("./utils/OpsUtils");
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
-
|
|
31
29
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
32
|
-
|
|
33
30
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
34
|
-
|
|
35
|
-
var
|
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
34
|
+
var crypto = new _DataProtection.default();
|
|
36
35
|
var fileOptions = {
|
|
37
36
|
indentation: 4
|
|
38
37
|
};
|
|
38
|
+
var legacyProfileFilename = '.frodorc';
|
|
39
|
+
var newProfileFilename = 'Connections.json';
|
|
40
|
+
|
|
39
41
|
/**
|
|
40
42
|
* Get connection profiles file name
|
|
41
43
|
* @returns {String} connection profiles file name
|
|
42
44
|
*/
|
|
43
|
-
|
|
44
45
|
function getConnectionProfilesPath() {
|
|
45
|
-
return
|
|
46
|
+
return state.getConnectionProfilesPath() || process.env[_StaticStorage.FRODO_CONNECTION_PROFILES_PATH_KEY] || "".concat(_os.default.homedir(), "/.frodo/").concat(newProfileFilename);
|
|
46
47
|
}
|
|
48
|
+
|
|
47
49
|
/**
|
|
48
|
-
* Find connection
|
|
49
|
-
* @param {
|
|
50
|
-
* @param {
|
|
51
|
-
* @returns {
|
|
50
|
+
* Find connection profiles
|
|
51
|
+
* @param {ConnectionsFileInterface} connectionProfiles connection profile object
|
|
52
|
+
* @param {string} host host url or unique substring
|
|
53
|
+
* @returns {SecureConnectionProfileInterface[]} Array of connection profiles
|
|
52
54
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
function findConnectionProfile(connectionProfiles, host) {
|
|
55
|
+
function findConnectionProfiles(connectionProfiles, host) {
|
|
56
56
|
var profiles = [];
|
|
57
|
-
|
|
58
57
|
for (var tenant in connectionProfiles) {
|
|
59
58
|
if (tenant.includes(host)) {
|
|
60
|
-
var foundProfile = connectionProfiles[tenant];
|
|
59
|
+
var foundProfile = _objectSpread({}, connectionProfiles[tenant]);
|
|
61
60
|
foundProfile.tenant = tenant;
|
|
62
61
|
profiles.push(foundProfile);
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
|
-
|
|
66
64
|
return profiles;
|
|
67
65
|
}
|
|
66
|
+
|
|
68
67
|
/**
|
|
69
68
|
* List connection profiles
|
|
70
69
|
* @param {boolean} long Long list format with details
|
|
71
70
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
71
|
function listConnectionProfiles() {
|
|
75
72
|
var long = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
76
73
|
var filename = getConnectionProfilesPath();
|
|
77
|
-
|
|
78
74
|
try {
|
|
79
75
|
var data = _fs.default.readFileSync(filename, 'utf8');
|
|
80
|
-
|
|
81
76
|
var connectionsData = JSON.parse(data);
|
|
82
|
-
|
|
83
77
|
if (long) {
|
|
84
78
|
var table = (0, _Console.createTable)(['Host', 'Username', 'Log API Key']);
|
|
85
79
|
Object.keys(connectionsData).forEach(c => {
|
|
@@ -91,85 +85,99 @@ function listConnectionProfiles() {
|
|
|
91
85
|
(0, _Console.printMessage)("".concat(c), 'data');
|
|
92
86
|
});
|
|
93
87
|
}
|
|
94
|
-
|
|
95
88
|
(0, _Console.printMessage)('Any unique substring of a saved host can be used as the value for host parameter in all commands', 'info');
|
|
96
89
|
} catch (e) {
|
|
97
90
|
(0, _Console.printMessage)("No connections found in ".concat(filename, " (").concat(e.message, ")"), 'error');
|
|
98
91
|
}
|
|
99
92
|
}
|
|
93
|
+
|
|
100
94
|
/**
|
|
101
|
-
*
|
|
95
|
+
* Migrate from .frodorc to Connections.json
|
|
102
96
|
*/
|
|
97
|
+
function migrateFromLegacyProfile() {
|
|
98
|
+
var legacyPath = "".concat(_os.default.homedir(), "/.frodo/").concat(legacyProfileFilename);
|
|
99
|
+
if (_fs.default.existsSync(legacyPath)) {
|
|
100
|
+
_fs.default.copyFileSync(legacyPath, "".concat(_os.default.homedir(), "/.frodo/").concat(newProfileFilename));
|
|
101
|
+
// for now, just add a "deprecated" suffix. May delete the old file
|
|
102
|
+
// in a future release
|
|
103
|
+
_fs.default.renameSync(legacyPath, "".concat(legacyPath, ".deprecated"));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Initialize connection profiles
|
|
109
|
+
*
|
|
110
|
+
* This method is called from app.ts and runs before any of the message handlers are registered.
|
|
111
|
+
* Therefore none of the Console message functions will produce any output.
|
|
112
|
+
*/
|
|
105
113
|
function initConnectionProfiles() {
|
|
106
|
-
|
|
107
|
-
var filename = getConnectionProfilesPath();
|
|
108
|
-
|
|
109
|
-
var folderName = _path.default.dirname(filename);
|
|
110
|
-
|
|
111
|
-
if (!_fs.default.existsSync(folderName)) {
|
|
112
|
-
_fs.default.mkdirSync(folderName, {
|
|
113
|
-
recursive: true
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
if (!_fs.default.existsSync(filename)) {
|
|
117
|
-
_fs.default.writeFileSync(filename, JSON.stringify({}, null, fileOptions.indentation));
|
|
118
|
-
}
|
|
119
|
-
} // encrypt the password from clear text to aes-256-GCM
|
|
120
|
-
else {
|
|
121
|
-
var data = _fs.default.readFileSync(filename, 'utf8');
|
|
122
|
-
|
|
123
|
-
var connectionsData = JSON.parse(data);
|
|
124
|
-
var convert = false;
|
|
125
|
-
Object.keys(connectionsData).forEach( /*#__PURE__*/function () {
|
|
126
|
-
var _ref = _asyncToGenerator(function* (conn) {
|
|
127
|
-
if (connectionsData[conn].password) {
|
|
128
|
-
convert = true;
|
|
129
|
-
connectionsData[conn].encodedPassword = yield dataProtection.encrypt(connectionsData[conn].password); // Buffer.from(connectionsData[conn].password).toString('base64');
|
|
130
|
-
|
|
131
|
-
delete connectionsData[conn].password;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
return function (_x) {
|
|
136
|
-
return _ref.apply(this, arguments);
|
|
137
|
-
};
|
|
138
|
-
}());
|
|
139
|
-
|
|
140
|
-
if (convert) {
|
|
141
|
-
_fs.default.writeFileSync(filename, JSON.stringify(connectionsData, null, fileOptions.indentation));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
114
|
+
return _initConnectionProfiles.apply(this, arguments);
|
|
144
115
|
}
|
|
145
116
|
/**
|
|
146
117
|
* Get connection profile by host
|
|
147
118
|
* @param {String} host host tenant host url or unique substring
|
|
148
119
|
* @returns {Object} connection profile or null
|
|
149
120
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
121
|
+
function _initConnectionProfiles() {
|
|
122
|
+
_initConnectionProfiles = _asyncToGenerator(function* () {
|
|
123
|
+
// create connections.json file if it doesn't exist
|
|
124
|
+
var filename = getConnectionProfilesPath();
|
|
125
|
+
var folderName = _path.default.dirname(filename);
|
|
126
|
+
if (!_fs.default.existsSync(folderName)) {
|
|
127
|
+
_fs.default.mkdirSync(folderName, {
|
|
128
|
+
recursive: true
|
|
129
|
+
});
|
|
130
|
+
if (!_fs.default.existsSync(filename)) {
|
|
131
|
+
_fs.default.writeFileSync(filename, JSON.stringify({}, null, fileOptions.indentation));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// encrypt the password and logApiSecret from clear text to aes-256-GCM
|
|
135
|
+
else {
|
|
136
|
+
migrateFromLegacyProfile();
|
|
137
|
+
var data = _fs.default.readFileSync(filename, 'utf8');
|
|
138
|
+
var connectionsData = JSON.parse(data);
|
|
139
|
+
var convert = false;
|
|
140
|
+
for (var conn of Object.keys(connectionsData)) {
|
|
141
|
+
if (connectionsData[conn]['password']) {
|
|
142
|
+
convert = true;
|
|
143
|
+
connectionsData[conn].encodedPassword = yield crypto.encrypt(connectionsData[conn]['password']);
|
|
144
|
+
delete connectionsData[conn]['password'];
|
|
145
|
+
}
|
|
146
|
+
if (connectionsData[conn]['logApiSecret']) {
|
|
147
|
+
convert = true;
|
|
148
|
+
connectionsData[conn].encodedLogApiSecret = yield crypto.encrypt(connectionsData[conn]['logApiSecret']);
|
|
149
|
+
delete connectionsData[conn]['logApiSecret'];
|
|
150
|
+
}
|
|
151
|
+
if (connectionsData[conn]['svcacctJwk']) {
|
|
152
|
+
convert = true;
|
|
153
|
+
connectionsData[conn].encodedSvcacctJwk = yield crypto.encrypt(connectionsData[conn]['svcacctJwk']);
|
|
154
|
+
delete connectionsData[conn]['svcacctJwk'];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (convert) {
|
|
158
|
+
_fs.default.writeFileSync(filename, JSON.stringify(connectionsData, null, fileOptions.indentation));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return _initConnectionProfiles.apply(this, arguments);
|
|
163
|
+
}
|
|
164
|
+
function getConnectionProfileByHost(_x) {
|
|
153
165
|
return _getConnectionProfileByHost.apply(this, arguments);
|
|
154
166
|
}
|
|
155
167
|
/**
|
|
156
168
|
* Get connection profile
|
|
157
169
|
* @returns {Object} connection profile or null
|
|
158
170
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
171
|
function _getConnectionProfileByHost() {
|
|
162
172
|
_getConnectionProfileByHost = _asyncToGenerator(function* (host) {
|
|
163
173
|
try {
|
|
164
174
|
var filename = getConnectionProfilesPath();
|
|
165
175
|
var connectionsData = JSON.parse(_fs.default.readFileSync(filename, 'utf8'));
|
|
166
|
-
var profiles =
|
|
167
|
-
|
|
176
|
+
var profiles = findConnectionProfiles(connectionsData, host);
|
|
168
177
|
if (profiles.length == 0) {
|
|
169
178
|
(0, _Console.printMessage)("Profile for ".concat(host, " not found. Please specify credentials on command line"), 'error');
|
|
170
179
|
return null;
|
|
171
180
|
}
|
|
172
|
-
|
|
173
181
|
if (profiles.length > 1) {
|
|
174
182
|
(0, _Console.printMessage)("Multiple matching profiles found.", 'error');
|
|
175
183
|
profiles.forEach(p => {
|
|
@@ -178,15 +186,16 @@ function _getConnectionProfileByHost() {
|
|
|
178
186
|
(0, _Console.printMessage)("Please specify a unique sub-string", 'error');
|
|
179
187
|
return null;
|
|
180
188
|
}
|
|
181
|
-
|
|
182
189
|
return {
|
|
183
190
|
tenant: profiles[0].tenant,
|
|
184
191
|
username: profiles[0].username ? profiles[0].username : null,
|
|
185
|
-
password: profiles[0].encodedPassword ? yield
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
password: profiles[0].encodedPassword ? yield crypto.decrypt(profiles[0].encodedPassword) : null,
|
|
193
|
+
logApiKey: profiles[0].logApiKey ? profiles[0].logApiKey : null,
|
|
194
|
+
logApiSecret: profiles[0].encodedLogApiSecret ? yield crypto.decrypt(profiles[0].encodedLogApiSecret) : null,
|
|
188
195
|
authenticationService: profiles[0].authenticationService ? profiles[0].authenticationService : null,
|
|
189
|
-
authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides ? profiles[0].authenticationHeaderOverrides : {}
|
|
196
|
+
authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides ? profiles[0].authenticationHeaderOverrides : {},
|
|
197
|
+
svcacctId: profiles[0].svcacctId ? profiles[0].svcacctId : null,
|
|
198
|
+
svcacctJwk: profiles[0].encodedSvcacctJwk ? yield crypto.decrypt(profiles[0].encodedSvcacctJwk) : null
|
|
190
199
|
};
|
|
191
200
|
} catch (e) {
|
|
192
201
|
(0, _Console.printMessage)("Can not read saved connection info, please specify credentials on command line: ".concat(e), 'error');
|
|
@@ -195,92 +204,118 @@ function _getConnectionProfileByHost() {
|
|
|
195
204
|
});
|
|
196
205
|
return _getConnectionProfileByHost.apply(this, arguments);
|
|
197
206
|
}
|
|
198
|
-
|
|
199
207
|
function getConnectionProfile() {
|
|
200
208
|
return _getConnectionProfile.apply(this, arguments);
|
|
201
209
|
}
|
|
202
210
|
/**
|
|
203
211
|
* Save connection profile
|
|
212
|
+
* @param {string} host host url for new profiles or unique substring for existing profiles
|
|
213
|
+
* @returns {Promise<boolean>} true if the operation succeeded, false otherwise
|
|
204
214
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
215
|
function _getConnectionProfile() {
|
|
208
216
|
_getConnectionProfile = _asyncToGenerator(function* () {
|
|
209
|
-
return getConnectionProfileByHost(
|
|
217
|
+
return getConnectionProfileByHost(state.getHost());
|
|
210
218
|
});
|
|
211
219
|
return _getConnectionProfile.apply(this, arguments);
|
|
212
220
|
}
|
|
213
|
-
|
|
214
|
-
function saveConnectionProfile() {
|
|
221
|
+
function saveConnectionProfile(_x2) {
|
|
215
222
|
return _saveConnectionProfile.apply(this, arguments);
|
|
216
223
|
}
|
|
217
224
|
/**
|
|
218
225
|
* Delete connection profile
|
|
219
226
|
* @param {String} host host tenant host url or unique substring
|
|
220
227
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
228
|
function _saveConnectionProfile() {
|
|
224
|
-
_saveConnectionProfile = _asyncToGenerator(function* () {
|
|
229
|
+
_saveConnectionProfile = _asyncToGenerator(function* (host) {
|
|
225
230
|
var filename = getConnectionProfilesPath();
|
|
226
|
-
(0, _Console.
|
|
227
|
-
var
|
|
228
|
-
var
|
|
229
|
-
|
|
231
|
+
(0, _Console.verboseMessage)("Saving connection profile in ".concat(filename));
|
|
232
|
+
var profiles = {};
|
|
233
|
+
var profile = {
|
|
234
|
+
tenant: ''
|
|
235
|
+
};
|
|
230
236
|
try {
|
|
231
237
|
_fs.default.statSync(filename);
|
|
232
|
-
|
|
233
238
|
var data = _fs.default.readFileSync(filename, 'utf8');
|
|
239
|
+
profiles = JSON.parse(data);
|
|
234
240
|
|
|
235
|
-
|
|
241
|
+
// find tenant
|
|
242
|
+
var found = findConnectionProfiles(profiles, host);
|
|
236
243
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
244
|
+
// replace tenant in session with real tenant url if necessary
|
|
245
|
+
if (found.length === 1) {
|
|
246
|
+
profile = found[0];
|
|
247
|
+
state.setHost(profile.tenant);
|
|
248
|
+
(0, _Console.verboseMessage)("Existing profile: ".concat(profile.tenant));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// connection profile not found, validate host is a real URL
|
|
252
|
+
if (found.length === 0) {
|
|
253
|
+
if ((0, _OpsUtils.isValidUrl)(host)) {
|
|
254
|
+
state.setHost(host);
|
|
255
|
+
(0, _Console.verboseMessage)("New profile: ".concat(host));
|
|
256
|
+
} else {
|
|
257
|
+
(0, _Console.printMessage)("No existing profile found matching '".concat(host, "'. Provide a valid URL as the host argument to create a new profile."), 'error');
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
} catch (error) {
|
|
262
|
+
(0, _Console.verboseMessage)("New profiles file ".concat(filename, " with new profile ").concat(host));
|
|
243
263
|
}
|
|
244
264
|
|
|
245
|
-
|
|
246
|
-
if (
|
|
247
|
-
if (
|
|
248
|
-
if (_SessionStorage.default.session.getLogApiSecret()) existingData['logApiSecret'] = _SessionStorage.default.session.getLogApiSecret(); // advanced settings
|
|
265
|
+
// user account
|
|
266
|
+
if (state.getUsername()) profile.username = state.getUsername();
|
|
267
|
+
if (state.getPassword()) profile.encodedPassword = yield crypto.encrypt(state.getPassword());
|
|
249
268
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
269
|
+
// log API
|
|
270
|
+
if (state.getLogApiKey()) profile.logApiKey = state.getLogApiKey();
|
|
271
|
+
if (state.getLogApiSecret()) profile.encodedLogApiSecret = yield crypto.encrypt(state.getLogApiSecret());
|
|
272
|
+
|
|
273
|
+
// service account
|
|
274
|
+
if (state.getServiceAccountId()) profile.svcacctId = state.getServiceAccountId();
|
|
275
|
+
if (state.getServiceAccountJwk()) profile.encodedSvcacctJwk = yield crypto.encrypt(state.getServiceAccountJwk());
|
|
254
276
|
|
|
255
|
-
|
|
256
|
-
|
|
277
|
+
// advanced settings
|
|
278
|
+
if (state.getAuthenticationService()) {
|
|
279
|
+
profile.authenticationService = state.getAuthenticationService();
|
|
280
|
+
(0, _Console.printMessage)('Advanced setting: Authentication Service: ' + state.getAuthenticationService(), 'info');
|
|
281
|
+
}
|
|
282
|
+
if (state.getAuthenticationHeaderOverrides() && Object.entries(state.getAuthenticationHeaderOverrides()).length) {
|
|
283
|
+
profile.authenticationHeaderOverrides = state.getAuthenticationHeaderOverrides();
|
|
257
284
|
(0, _Console.printMessage)('Advanced setting: Authentication Header Overrides: ', 'info');
|
|
258
|
-
(0, _Console.printMessage)(
|
|
285
|
+
(0, _Console.printMessage)(state.getAuthenticationHeaderOverrides(), 'info');
|
|
259
286
|
}
|
|
260
287
|
|
|
261
|
-
|
|
288
|
+
// remove the helper key 'tenant'
|
|
289
|
+
delete profile.tenant;
|
|
290
|
+
|
|
291
|
+
// update profiles
|
|
292
|
+
profiles[state.getHost()] = profile;
|
|
293
|
+
|
|
294
|
+
// sort profiles
|
|
295
|
+
var orderedProfiles = Object.keys(profiles).sort().reduce((obj, key) => {
|
|
296
|
+
obj[key] = profiles[key];
|
|
297
|
+
return obj;
|
|
298
|
+
}, {});
|
|
262
299
|
|
|
263
|
-
|
|
300
|
+
// save profiles
|
|
301
|
+
(0, _ExportImportUtils.saveJsonToFile)(orderedProfiles, filename, false);
|
|
302
|
+
(0, _Console.verboseMessage)("Saved connection profile ".concat(state.getHost(), " in ").concat(filename));
|
|
303
|
+
return true;
|
|
264
304
|
});
|
|
265
305
|
return _saveConnectionProfile.apply(this, arguments);
|
|
266
306
|
}
|
|
267
|
-
|
|
268
307
|
function deleteConnectionProfile(host) {
|
|
269
308
|
var filename = getConnectionProfilesPath();
|
|
270
309
|
var connectionsData = {};
|
|
271
|
-
|
|
272
310
|
_fs.default.stat(filename, err => {
|
|
273
311
|
if (err == null) {
|
|
274
312
|
var data = _fs.default.readFileSync(filename, 'utf8');
|
|
275
|
-
|
|
276
313
|
connectionsData = JSON.parse(data);
|
|
277
|
-
var profiles =
|
|
278
|
-
|
|
314
|
+
var profiles = findConnectionProfiles(connectionsData, host);
|
|
279
315
|
if (profiles.length == 1) {
|
|
280
|
-
(0, _Console.printMessage)("Deleting connection profile ".concat(profiles[0].tenant));
|
|
281
316
|
delete connectionsData[profiles[0].tenant];
|
|
282
|
-
|
|
283
317
|
_fs.default.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));
|
|
318
|
+
(0, _Console.printMessage)("Deleted connection profile ".concat(profiles[0].tenant));
|
|
284
319
|
} else {
|
|
285
320
|
if (profiles.length > 1) {
|
|
286
321
|
(0, _Console.printMessage)("Multiple matching profiles found.", 'error');
|
|
@@ -301,40 +336,89 @@ function deleteConnectionProfile(host) {
|
|
|
301
336
|
});
|
|
302
337
|
}
|
|
303
338
|
|
|
339
|
+
/**
|
|
340
|
+
* Describe connection profile
|
|
341
|
+
* @param {string} host Host URL or unique substring
|
|
342
|
+
* @param {boolean} showSecrets Whether secrets should be shown in clear text or not
|
|
343
|
+
*/
|
|
304
344
|
function describeConnectionProfile(_x3, _x4) {
|
|
305
345
|
return _describeConnectionProfile.apply(this, arguments);
|
|
306
346
|
}
|
|
307
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Create a new service account using auto-generated parameters
|
|
349
|
+
* @returns {Promise<ObjectSkeletonInterface>} A promise resolving to a service account object
|
|
350
|
+
*/
|
|
308
351
|
function _describeConnectionProfile() {
|
|
309
352
|
_describeConnectionProfile = _asyncToGenerator(function* (host, showSecrets) {
|
|
310
353
|
var profile = yield getConnectionProfileByHost(host);
|
|
311
|
-
|
|
312
354
|
if (profile) {
|
|
355
|
+
var present = '[present]';
|
|
356
|
+
var jwk = profile.svcacctJwk;
|
|
313
357
|
if (!showSecrets) {
|
|
358
|
+
if (profile.password) profile.password = present;
|
|
359
|
+
if (profile.logApiSecret) profile.logApiSecret = present;
|
|
360
|
+
if (profile.svcacctJwk) profile['svcacctJwk'] = present;
|
|
361
|
+
}
|
|
362
|
+
if (!profile.username) {
|
|
363
|
+
delete profile.username;
|
|
314
364
|
delete profile.password;
|
|
315
|
-
delete profile.secret;
|
|
316
365
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
delete profile.
|
|
320
|
-
|
|
366
|
+
if (!profile.logApiKey) {
|
|
367
|
+
delete profile.logApiKey;
|
|
368
|
+
delete profile.logApiSecret;
|
|
369
|
+
}
|
|
370
|
+
if (!profile.svcacctId) {
|
|
371
|
+
delete profile.svcacctId;
|
|
372
|
+
delete profile.svcacctJwk;
|
|
373
|
+
}
|
|
374
|
+
if (showSecrets && jwk) {
|
|
375
|
+
profile['svcacctJwk'] = 'see below';
|
|
376
|
+
}
|
|
377
|
+
if (!profile.authenticationService) {
|
|
378
|
+
delete profile.authenticationService;
|
|
321
379
|
}
|
|
322
|
-
|
|
323
380
|
var keyMap = {
|
|
324
381
|
tenant: 'Host',
|
|
325
382
|
username: 'Username',
|
|
326
383
|
password: 'Password',
|
|
327
|
-
|
|
328
|
-
|
|
384
|
+
logApiKey: 'Log API Key',
|
|
385
|
+
logApiSecret: 'Log API Secret',
|
|
329
386
|
authenticationService: 'Authentication Service',
|
|
330
|
-
authenticationHeaderOverrides: 'Authentication Header Overrides'
|
|
387
|
+
authenticationHeaderOverrides: 'Authentication Header Overrides',
|
|
388
|
+
svcacctId: 'Service Account Id',
|
|
389
|
+
svcacctJwk: 'Service Account JWK'
|
|
331
390
|
};
|
|
332
391
|
var table = (0, _Console.createObjectTable)(profile, keyMap);
|
|
333
392
|
(0, _Console.printMessage)(table.toString(), 'data');
|
|
393
|
+
if (showSecrets && jwk) {
|
|
394
|
+
(0, _Console.printMessage)(jwk, 'data');
|
|
395
|
+
}
|
|
334
396
|
} else {
|
|
335
397
|
(0, _Console.printMessage)("No connection profile ".concat(host, " found"));
|
|
336
398
|
}
|
|
337
399
|
});
|
|
338
400
|
return _describeConnectionProfile.apply(this, arguments);
|
|
339
401
|
}
|
|
402
|
+
function addNewServiceAccount() {
|
|
403
|
+
return _addNewServiceAccount.apply(this, arguments);
|
|
404
|
+
}
|
|
405
|
+
function _addNewServiceAccount() {
|
|
406
|
+
_addNewServiceAccount = _asyncToGenerator(function* () {
|
|
407
|
+
(0, _Console.debugMessage)("ConnectionProfileOps.addNewServiceAccount: start");
|
|
408
|
+
var name = "Frodo-SA-".concat(new Date().getTime());
|
|
409
|
+
(0, _Console.debugMessage)("ConnectionProfileOps.addNewServiceAccount: name=".concat(name, "..."));
|
|
410
|
+
var description = "".concat(state.getUsername(), "'s Frodo Service Account");
|
|
411
|
+
var scope = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];
|
|
412
|
+
var jwkPrivate = yield (0, _JoseOps.createJwkRsa)();
|
|
413
|
+
var jwkPublic = yield (0, _JoseOps.getJwkRsaPublic)(jwkPrivate);
|
|
414
|
+
var jwks = (0, _JoseOps.createJwks)(jwkPublic);
|
|
415
|
+
var sa = yield (0, _ServiceAccountOps.createServiceAccount)(name, description, 'Active', scope, jwks);
|
|
416
|
+
(0, _Console.debugMessage)("ConnectionProfileOps.addNewServiceAccount: id=".concat(sa._id));
|
|
417
|
+
state.setServiceAccountId(sa._id);
|
|
418
|
+
state.setServiceAccountJwk(jwkPrivate);
|
|
419
|
+
(0, _Console.debugMessage)("ConnectionProfileOps.addNewServiceAccount: end");
|
|
420
|
+
return sa;
|
|
421
|
+
});
|
|
422
|
+
return _addNewServiceAccount.apply(this, arguments);
|
|
423
|
+
}
|
|
340
424
|
//# sourceMappingURL=ConnectionProfileOps.js.map
|