@rockcarver/frodo-lib 2.0.0-29 → 2.0.0-30
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/build.zip
CHANGED
|
Binary file
|
|
@@ -142,7 +142,16 @@ function getConnectionProfilesPath(_ref) {
|
|
|
142
142
|
var {
|
|
143
143
|
state
|
|
144
144
|
} = _ref;
|
|
145
|
-
|
|
145
|
+
(0, _Console.debugMessage)({
|
|
146
|
+
message: "ConnectionProfileOps.getConnectionProfilesPath: start",
|
|
147
|
+
state
|
|
148
|
+
});
|
|
149
|
+
var profilesPath = state.getConnectionProfilesPath() || process.env[_Constants.default.FRODO_CONNECTION_PROFILES_PATH_KEY] || "".concat(_os.default.homedir(), "/.frodo/").concat(newProfileFilename);
|
|
150
|
+
(0, _Console.debugMessage)({
|
|
151
|
+
message: "ConnectionProfileOps.getConnectionProfilesPath: end [profilesPath=".concat(profilesPath, "]"),
|
|
152
|
+
state
|
|
153
|
+
});
|
|
154
|
+
return profilesPath;
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
/**
|
|
@@ -218,6 +227,10 @@ function _initConnectionProfiles() {
|
|
|
218
227
|
var {
|
|
219
228
|
state
|
|
220
229
|
} = _ref3;
|
|
230
|
+
(0, _Console.debugMessage)({
|
|
231
|
+
message: "ConnectionProfileOps.initConnectionProfiles: start",
|
|
232
|
+
state
|
|
233
|
+
});
|
|
221
234
|
var dataProtection = new _DataProtection.default({
|
|
222
235
|
pathToMasterKey: state.getMasterKeyPath(),
|
|
223
236
|
state
|
|
@@ -227,11 +240,21 @@ function _initConnectionProfiles() {
|
|
|
227
240
|
state
|
|
228
241
|
});
|
|
229
242
|
var folderName = _path.default.dirname(filename);
|
|
230
|
-
if (!_fs.default.existsSync(
|
|
231
|
-
_fs.default.
|
|
232
|
-
|
|
233
|
-
|
|
243
|
+
if (!_fs.default.existsSync(filename)) {
|
|
244
|
+
if (!_fs.default.existsSync(folderName)) {
|
|
245
|
+
(0, _Console.debugMessage)({
|
|
246
|
+
message: "ConnectionProfileOps.initConnectionProfiles: folder does not exist: ".concat(folderName, ", creating..."),
|
|
247
|
+
state
|
|
248
|
+
});
|
|
249
|
+
_fs.default.mkdirSync(folderName, {
|
|
250
|
+
recursive: true
|
|
251
|
+
});
|
|
252
|
+
}
|
|
234
253
|
if (!_fs.default.existsSync(filename)) {
|
|
254
|
+
(0, _Console.debugMessage)({
|
|
255
|
+
message: "ConnectionProfileOps.initConnectionProfiles: file does not exist: ".concat(filename, ", creating..."),
|
|
256
|
+
state
|
|
257
|
+
});
|
|
235
258
|
_fs.default.writeFileSync(filename, JSON.stringify({}, null, fileOptions.indentation));
|
|
236
259
|
}
|
|
237
260
|
}
|
|
@@ -262,6 +285,10 @@ function _initConnectionProfiles() {
|
|
|
262
285
|
_fs.default.writeFileSync(filename, JSON.stringify(connectionsData, null, fileOptions.indentation));
|
|
263
286
|
}
|
|
264
287
|
}
|
|
288
|
+
(0, _Console.debugMessage)({
|
|
289
|
+
message: "ConnectionProfileOps.initConnectionProfiles: end",
|
|
290
|
+
state
|
|
291
|
+
});
|
|
265
292
|
});
|
|
266
293
|
return _initConnectionProfiles.apply(this, arguments);
|
|
267
294
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionProfileOps.js","names":["_fs","_interopRequireDefault","require","_os","_path","_Constants","_Console","_DataProtection","_ExportImportUtils","_MiscUtils","_ServiceAccountOps","_JoseOps","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","done","Promise","then","_asyncToGenerator","fn","self","args","err","_default","state","getConnectionProfilesPath","findConnectionProfiles","connectionProfiles","host","initConnectionProfiles","getConnectionProfileByHost","getConnectionProfile","saveConnectionProfile","deleteConnectionProfile","addNewServiceAccount","exports","fileOptions","indentation","legacyProfileFilename","newProfileFilename","_ref","process","env","Constants","FRODO_CONNECTION_PROFILES_PATH_KEY","concat","os","homedir","_ref2","profiles","tenant","debugMessage","message","includes","foundProfile","migrateFromLegacyProfile","legacyPath","newPath","fs","existsSync","writeFileSync","JSON","stringify","copyFileSync","renameSync","_x","_initConnectionProfiles","_ref3","dataProtection","DataProtection","pathToMasterKey","getMasterKeyPath","filename","folderName","path","dirname","mkdirSync","recursive","data","readFileSync","connectionsData","parse","convert","conn","encodedPassword","encrypt","encodedLogApiSecret","encodedSvcacctJwk","_x2","_getConnectionProfileByHost","_ref4","printMessage","type","p","username","password","decrypt","logApiKey","logApiSecret","authenticationService","authenticationHeaderOverrides","svcacctName","svcacctId","svcacctJwk","_x3","_getConnectionProfile","_ref5","getHost","_x4","_saveConnectionProfile","_ref6","profile","statSync","found","setHost","verboseMessage","isValidUrl","getUsername","getPassword","getLogApiKey","getLogApiSecret","getServiceAccountId","getBearerToken","getServiceAccount","serviceAccountId","name","getServiceAccountJwk","getAuthenticationService","getAuthenticationHeaderOverrides","entries","orderedProfiles","sort","reduce","saveJsonToFile","includeMeta","_ref7","stat","code","_x5","_addNewServiceAccount","_ref8","Date","getTime","description","scope","jwkPrivate","createJwkRsa","jwkPublic","getJwkRsaPublic","jwks","createJwks","sa","createServiceAccount","accountStatus","scopes","_id","setServiceAccountId","setServiceAccountJwk"],"sources":["../../src/ops/ConnectionProfileOps.ts"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\nimport { IdObjectSkeletonInterface } from '../api/ApiTypes';\nimport Constants from '../shared/Constants';\nimport { State } from '../shared/State';\nimport { debugMessage, printMessage, verboseMessage } from '../utils/Console';\nimport DataProtection from '../utils/DataProtection';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport { isValidUrl } from '../utils/MiscUtils';\nimport {\n createServiceAccount,\n getServiceAccount,\n} from './cloud/ServiceAccountOps';\nimport { createJwkRsa, createJwks, getJwkRsaPublic, JwkRsa } from './JoseOps';\n\nexport type ConnectionProfile = {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string;\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[];\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n initConnectionProfiles(): Promise<void>;\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n getConnectionProfileByHost(host: string): Promise<ConnectionProfileInterface>;\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n getConnectionProfile(): Promise<ConnectionProfileInterface>;\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n saveConnectionProfile(host: string): Promise<boolean>;\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void;\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n addNewServiceAccount(): Promise<IdObjectSkeletonInterface>;\n};\n\nexport default (state: State): ConnectionProfile => {\n return {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string {\n return getConnectionProfilesPath({ state });\n },\n\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[] {\n return findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n });\n },\n\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n async initConnectionProfiles() {\n initConnectionProfiles({ state });\n },\n\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n async getConnectionProfileByHost(\n host: string\n ): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host, state });\n },\n\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n async getConnectionProfile(): Promise<ConnectionProfileInterface> {\n return getConnectionProfile({ state });\n },\n\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n async saveConnectionProfile(host: string): Promise<boolean> {\n return saveConnectionProfile({ host, state });\n },\n\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void {\n deleteConnectionProfile({ host, state });\n },\n\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n async addNewServiceAccount(): Promise<IdObjectSkeletonInterface> {\n return addNewServiceAccount({ state });\n },\n };\n};\n\nconst fileOptions = {\n indentation: 4,\n};\n\nexport interface SecureConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n encodedPassword?: string | null;\n logApiKey?: string | null;\n encodedLogApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n encodedSvcacctJwk?: string | null;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n password?: string | null;\n logApiKey?: string | null;\n logApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n svcacctJwk?: JwkRsa;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionsFileInterface {\n [key: string]: SecureConnectionProfileInterface;\n}\n\nconst legacyProfileFilename = '.frodorc';\nconst newProfileFilename = 'Connections.json';\n\n/**\n * Get connection profiles file name\n * @param {State} state library state\n * @returns {String} connection profiles file name\n */\nexport function getConnectionProfilesPath({ state }: { state: State }): string {\n return (\n state.getConnectionProfilesPath() ||\n process.env[Constants.FRODO_CONNECTION_PROFILES_PATH_KEY] ||\n `${os.homedir()}/.frodo/${newProfileFilename}`\n );\n}\n\n/**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @param {State} state library state\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\nfunction findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n}: {\n connectionProfiles: ConnectionsFileInterface;\n host: string;\n state: State;\n}): SecureConnectionProfileInterface[] {\n const profiles: SecureConnectionProfileInterface[] = [];\n for (const tenant in connectionProfiles) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: tenant=${tenant}`,\n state,\n });\n if (tenant.includes(host)) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: '${host}' identifies '${tenant}', including in result set`,\n state,\n });\n const foundProfile = { ...connectionProfiles[tenant] };\n foundProfile.tenant = tenant;\n profiles.push(foundProfile);\n }\n }\n return profiles;\n}\n\n/**\n * Migrate from .frodorc to Connections.json\n */\nfunction migrateFromLegacyProfile() {\n const legacyPath = `${os.homedir()}/.frodo/${legacyProfileFilename}`;\n const newPath = `${os.homedir()}/.frodo/${newProfileFilename}`;\n if (!fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // no connections file (old or new), create empty new one\n fs.writeFileSync(\n newPath,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n } else if (fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // old exists, new one does not - so copy old to new one\n fs.copyFileSync(legacyPath, newPath);\n // for now, just add a \"deprecated\" suffix. May delete the old file\n // in a future release\n fs.renameSync(legacyPath, `${legacyPath}.deprecated`);\n }\n // in other cases, where\n // (both old and new exist) OR (only new one exists) don't do anything\n}\n\n/**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n * @param {State} state library state\n */\nexport async function initConnectionProfiles({ state }: { state: State }) {\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n // create connections.json file if it doesn't exist\n const filename = getConnectionProfilesPath({ state });\n const folderName = path.dirname(filename);\n if (!fs.existsSync(folderName)) {\n fs.mkdirSync(folderName, { recursive: true });\n if (!fs.existsSync(filename)) {\n fs.writeFileSync(\n filename,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n }\n }\n // encrypt the password and logApiSecret from clear text to aes-256-GCM\n else {\n migrateFromLegacyProfile();\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData: ConnectionsFileInterface = JSON.parse(data);\n let convert = false;\n for (const conn of Object.keys(connectionsData)) {\n if (connectionsData[conn]['password']) {\n convert = true;\n connectionsData[conn].encodedPassword = await dataProtection.encrypt(\n connectionsData[conn]['password']\n );\n delete connectionsData[conn]['password'];\n }\n if (connectionsData[conn]['logApiSecret']) {\n convert = true;\n connectionsData[conn].encodedLogApiSecret =\n await dataProtection.encrypt(connectionsData[conn]['logApiSecret']);\n delete connectionsData[conn]['logApiSecret'];\n }\n if (connectionsData[conn]['svcacctJwk']) {\n convert = true;\n connectionsData[conn].encodedSvcacctJwk = await dataProtection.encrypt(\n connectionsData[conn]['svcacctJwk']\n );\n delete connectionsData[conn]['svcacctJwk'];\n }\n }\n if (convert) {\n fs.writeFileSync(\n filename,\n JSON.stringify(connectionsData, null, fileOptions.indentation)\n );\n }\n }\n}\n\n/**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @param {State} state library state\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfileByHost({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<ConnectionProfileInterface> {\n try {\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 0) {\n printMessage({\n message: `Profile for ${host} not found. Please specify credentials on command line`,\n type: 'error',\n state,\n });\n return null;\n }\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n }\n return {\n tenant: profiles[0].tenant,\n username: profiles[0].username ? profiles[0].username : null,\n password: profiles[0].encodedPassword\n ? await dataProtection.decrypt(profiles[0].encodedPassword)\n : null,\n logApiKey: profiles[0].logApiKey ? profiles[0].logApiKey : null,\n logApiSecret: profiles[0].encodedLogApiSecret\n ? await dataProtection.decrypt(profiles[0].encodedLogApiSecret)\n : null,\n authenticationService: profiles[0].authenticationService\n ? profiles[0].authenticationService\n : null,\n authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides\n ? profiles[0].authenticationHeaderOverrides\n : {},\n svcacctName: profiles[0].svcacctName ? profiles[0].svcacctName : null,\n svcacctId: profiles[0].svcacctId ? profiles[0].svcacctId : null,\n svcacctJwk: profiles[0].encodedSvcacctJwk\n ? await dataProtection.decrypt(profiles[0].encodedSvcacctJwk)\n : null,\n };\n } catch (e) {\n printMessage({\n message: `Can not read saved connection info, please specify credentials on command line: ${e}`,\n type: 'error',\n state,\n });\n return null;\n }\n}\n\n/**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfile({\n state,\n}: {\n state: State;\n}): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host: state.getHost(), state });\n}\n\n/**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\nexport async function saveConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<boolean> {\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: start`,\n state,\n });\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n debugMessage({ message: `Saving connection profile in ${filename}`, state });\n let profiles: ConnectionsFileInterface = {};\n let profile: SecureConnectionProfileInterface = { tenant: '' };\n try {\n fs.statSync(filename);\n const data = fs.readFileSync(filename, 'utf8');\n profiles = JSON.parse(data);\n\n // find tenant\n const found = findConnectionProfiles({\n connectionProfiles: profiles,\n host,\n state,\n });\n\n // replace tenant in session with real tenant url if necessary\n if (found.length === 1) {\n profile = found[0];\n state.setHost(profile.tenant);\n verboseMessage({ message: `Existing profile: ${profile.tenant}`, state });\n debugMessage({ message: profile, state });\n }\n\n // connection profile not found, validate host is a real URL\n if (found.length === 0) {\n if (isValidUrl(host)) {\n state.setHost(host);\n debugMessage({ message: `New profile: ${host}`, state });\n } else {\n printMessage({\n message: `No existing profile found matching '${host}'. Provide a valid URL as the host argument to create a new profile.`,\n type: 'error',\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [false]`,\n state,\n });\n return false;\n }\n }\n } catch (error) {\n debugMessage({\n message: `New profiles file ${filename} with new profile ${host}`,\n state,\n });\n }\n\n // user account\n if (state.getUsername()) profile.username = state.getUsername();\n if (state.getPassword())\n profile.encodedPassword = await dataProtection.encrypt(state.getPassword());\n\n // log API\n if (state.getLogApiKey()) profile.logApiKey = state.getLogApiKey();\n if (state.getLogApiSecret())\n profile.encodedLogApiSecret = await dataProtection.encrypt(\n state.getLogApiSecret()\n );\n\n // service account\n if (state.getServiceAccountId()) {\n profile.svcacctId = state.getServiceAccountId();\n if (state.getBearerToken()) {\n profile.svcacctName = (\n await getServiceAccount({\n serviceAccountId: state.getServiceAccountId(),\n state,\n })\n ).name;\n }\n }\n if (state.getServiceAccountJwk())\n profile.encodedSvcacctJwk = await dataProtection.encrypt(\n state.getServiceAccountJwk()\n );\n // update existing service account profile\n if (state.getBearerToken() && profile.svcacctId && !profile.svcacctName) {\n profile.svcacctName = (\n await getServiceAccount({ serviceAccountId: profile.svcacctId, state })\n ).name;\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: added missing service account name`,\n state,\n });\n }\n\n // advanced settings\n if (state.getAuthenticationService()) {\n profile.authenticationService = state.getAuthenticationService();\n printMessage({\n message:\n 'Advanced setting: Authentication Service: ' +\n state.getAuthenticationService(),\n type: 'info',\n state,\n });\n }\n if (\n state.getAuthenticationHeaderOverrides() &&\n Object.entries(state.getAuthenticationHeaderOverrides()).length\n ) {\n profile.authenticationHeaderOverrides =\n state.getAuthenticationHeaderOverrides();\n printMessage({\n message: 'Advanced setting: Authentication Header Overrides: ',\n type: 'info',\n state,\n });\n printMessage({\n message: state.getAuthenticationHeaderOverrides(),\n type: 'info',\n state,\n });\n }\n\n // remove the helper key 'tenant'\n delete profile.tenant;\n\n // update profiles\n profiles[state.getHost()] = profile;\n\n // sort profiles\n const orderedProfiles = Object.keys(profiles)\n .sort()\n .reduce((obj, key) => {\n obj[key] = profiles[key];\n return obj;\n }, {});\n\n // save profiles\n saveJsonToFile({\n data: orderedProfiles,\n filename,\n includeMeta: false,\n state,\n });\n verboseMessage({\n message: `Saved connection profile ${state.getHost()} in ${filename}`,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [true]`,\n state,\n });\n return true;\n}\n\n/**\n * Delete connection profile\n * @param {String} host host tenant host url or unique substring\n */\nexport function deleteConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}) {\n const filename = getConnectionProfilesPath({ state });\n let connectionsData: ConnectionsFileInterface = {};\n fs.stat(filename, (err) => {\n if (err == null) {\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 1) {\n delete connectionsData[profiles[0].tenant];\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n printMessage({\n message: `Deleted connection profile ${profiles[0].tenant}`,\n state,\n });\n } else {\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n } else {\n printMessage({\n message: `No connection profile ${host} found`,\n state,\n });\n }\n }\n } else if (err.code === 'ENOENT') {\n printMessage({\n message: `Connection profile file ${filename} not found`,\n state,\n });\n } else {\n printMessage({\n message: `Error in deleting connection profile: ${err.code}`,\n type: 'error',\n state,\n });\n }\n });\n}\n\n/**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\nexport async function addNewServiceAccount({\n state,\n}: {\n state: State;\n}): Promise<IdObjectSkeletonInterface> {\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: start`,\n state,\n });\n const name = `Frodo-SA-${new Date().getTime()}`;\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: name=${name}...`,\n state,\n });\n const description = `${state.getUsername()}'s Frodo Service Account`;\n const scope = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];\n const jwkPrivate = await createJwkRsa();\n const jwkPublic = await getJwkRsaPublic(jwkPrivate);\n const jwks = createJwks(jwkPublic);\n const sa = await createServiceAccount({\n name,\n description,\n accountStatus: 'Active',\n scopes: scope,\n jwks,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: id=${sa._id}`,\n state,\n });\n state.setServiceAccountId(sa._id);\n state.setServiceAccount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AC,qBAAY,EAAC,CAAC;IACvC,IAAMC,SAAS,SAAS,IAAAC,wBAAe,EAACH,UAAU,CAAC;IACnD,IAAMI,IAAI,GAAG,IAAAC,mBAAU,EAACH,SAAS,CAAC;IAClC,IAAMI,EAAE,SAAS,IAAAC,uCAAoB,EAAC;MACpC3B,IAAI;MACJkB,WAAW;MACXU,aAAa,EAAE,QAAQ;MACvBC,MAAM,EAAEV,KAAK;MACbK,IAAI;MACJ7H;IACF,CAAC,CAAC;IACF,IAAA2B,qBAAY,EAAC;MACXC,OAAO,mDAAAP,MAAA,CAAmD0G,EAAE,CAACI,GAAG,CAAE;MAClEnI;IACF,CAAC,CAAC;IACFA,KAAK,CAACoI,mBAAmB,CAACL,EAAE,CAACI,GAAG,CAAC;IACjCnI,KAAK,CAACqI,oBAAoB,CAACZ,UAAU,CAAC;IACtC,IAAA9F,qBAAY,EAAC;MACXC,OAAO,kDAAkD;MACzD5B;IACF,CAAC,CAAC;IACF,OAAO+H,EAAE;EACX,CAAC;EAAA,OAAAZ,qBAAA,CAAA/J,KAAA,OAAAE,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"ConnectionProfileOps.js","names":["_fs","_interopRequireDefault","require","_os","_path","_Constants","_Console","_DataProtection","_ExportImportUtils","_MiscUtils","_ServiceAccountOps","_JoseOps","obj","__esModule","default","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","key","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","done","Promise","then","_asyncToGenerator","fn","self","args","err","_default","state","getConnectionProfilesPath","findConnectionProfiles","connectionProfiles","host","initConnectionProfiles","getConnectionProfileByHost","getConnectionProfile","saveConnectionProfile","deleteConnectionProfile","addNewServiceAccount","exports","fileOptions","indentation","legacyProfileFilename","newProfileFilename","_ref","debugMessage","message","profilesPath","process","env","Constants","FRODO_CONNECTION_PROFILES_PATH_KEY","concat","os","homedir","_ref2","profiles","tenant","includes","foundProfile","migrateFromLegacyProfile","legacyPath","newPath","fs","existsSync","writeFileSync","JSON","stringify","copyFileSync","renameSync","_x","_initConnectionProfiles","_ref3","dataProtection","DataProtection","pathToMasterKey","getMasterKeyPath","filename","folderName","path","dirname","mkdirSync","recursive","data","readFileSync","connectionsData","parse","convert","conn","encodedPassword","encrypt","encodedLogApiSecret","encodedSvcacctJwk","_x2","_getConnectionProfileByHost","_ref4","printMessage","type","p","username","password","decrypt","logApiKey","logApiSecret","authenticationService","authenticationHeaderOverrides","svcacctName","svcacctId","svcacctJwk","_x3","_getConnectionProfile","_ref5","getHost","_x4","_saveConnectionProfile","_ref6","profile","statSync","found","setHost","verboseMessage","isValidUrl","getUsername","getPassword","getLogApiKey","getLogApiSecret","getServiceAccountId","getBearerToken","getServiceAccount","serviceAccountId","name","getServiceAccountJwk","getAuthenticationService","getAuthenticationHeaderOverrides","entries","orderedProfiles","sort","reduce","saveJsonToFile","includeMeta","_ref7","stat","code","_x5","_addNewServiceAccount","_ref8","Date","getTime","description","scope","jwkPrivate","createJwkRsa","jwkPublic","getJwkRsaPublic","jwks","createJwks","sa","createServiceAccount","accountStatus","scopes","_id","setServiceAccountId","setServiceAccountJwk"],"sources":["../../src/ops/ConnectionProfileOps.ts"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\nimport { IdObjectSkeletonInterface } from '../api/ApiTypes';\nimport Constants from '../shared/Constants';\nimport { State } from '../shared/State';\nimport { debugMessage, printMessage, verboseMessage } from '../utils/Console';\nimport DataProtection from '../utils/DataProtection';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport { isValidUrl } from '../utils/MiscUtils';\nimport {\n createServiceAccount,\n getServiceAccount,\n} from './cloud/ServiceAccountOps';\nimport { createJwkRsa, createJwks, getJwkRsaPublic, JwkRsa } from './JoseOps';\n\nexport type ConnectionProfile = {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string;\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[];\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n initConnectionProfiles(): Promise<void>;\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n getConnectionProfileByHost(host: string): Promise<ConnectionProfileInterface>;\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n getConnectionProfile(): Promise<ConnectionProfileInterface>;\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n saveConnectionProfile(host: string): Promise<boolean>;\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void;\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n addNewServiceAccount(): Promise<IdObjectSkeletonInterface>;\n};\n\nexport default (state: State): ConnectionProfile => {\n return {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string {\n return getConnectionProfilesPath({ state });\n },\n\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[] {\n return findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n });\n },\n\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n async initConnectionProfiles() {\n initConnectionProfiles({ state });\n },\n\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n async getConnectionProfileByHost(\n host: string\n ): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host, state });\n },\n\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n async getConnectionProfile(): Promise<ConnectionProfileInterface> {\n return getConnectionProfile({ state });\n },\n\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n async saveConnectionProfile(host: string): Promise<boolean> {\n return saveConnectionProfile({ host, state });\n },\n\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void {\n deleteConnectionProfile({ host, state });\n },\n\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n async addNewServiceAccount(): Promise<IdObjectSkeletonInterface> {\n return addNewServiceAccount({ state });\n },\n };\n};\n\nconst fileOptions = {\n indentation: 4,\n};\n\nexport interface SecureConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n encodedPassword?: string | null;\n logApiKey?: string | null;\n encodedLogApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n encodedSvcacctJwk?: string | null;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n password?: string | null;\n logApiKey?: string | null;\n logApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n svcacctJwk?: JwkRsa;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionsFileInterface {\n [key: string]: SecureConnectionProfileInterface;\n}\n\nconst legacyProfileFilename = '.frodorc';\nconst newProfileFilename = 'Connections.json';\n\n/**\n * Get connection profiles file name\n * @param {State} state library state\n * @returns {String} connection profiles file name\n */\nexport function getConnectionProfilesPath({ state }: { state: State }): string {\n debugMessage({\n message: `ConnectionProfileOps.getConnectionProfilesPath: start`,\n state,\n });\n const profilesPath =\n state.getConnectionProfilesPath() ||\n process.env[Constants.FRODO_CONNECTION_PROFILES_PATH_KEY] ||\n `${os.homedir()}/.frodo/${newProfileFilename}`;\n debugMessage({\n message: `ConnectionProfileOps.getConnectionProfilesPath: end [profilesPath=${profilesPath}]`,\n state,\n });\n return profilesPath;\n}\n\n/**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @param {State} state library state\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\nfunction findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n}: {\n connectionProfiles: ConnectionsFileInterface;\n host: string;\n state: State;\n}): SecureConnectionProfileInterface[] {\n const profiles: SecureConnectionProfileInterface[] = [];\n for (const tenant in connectionProfiles) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: tenant=${tenant}`,\n state,\n });\n if (tenant.includes(host)) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: '${host}' identifies '${tenant}', including in result set`,\n state,\n });\n const foundProfile = { ...connectionProfiles[tenant] };\n foundProfile.tenant = tenant;\n profiles.push(foundProfile);\n }\n }\n return profiles;\n}\n\n/**\n * Migrate from .frodorc to Connections.json\n */\nfunction migrateFromLegacyProfile() {\n const legacyPath = `${os.homedir()}/.frodo/${legacyProfileFilename}`;\n const newPath = `${os.homedir()}/.frodo/${newProfileFilename}`;\n if (!fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // no connections file (old or new), create empty new one\n fs.writeFileSync(\n newPath,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n } else if (fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // old exists, new one does not - so copy old to new one\n fs.copyFileSync(legacyPath, newPath);\n // for now, just add a \"deprecated\" suffix. May delete the old file\n // in a future release\n fs.renameSync(legacyPath, `${legacyPath}.deprecated`);\n }\n // in other cases, where\n // (both old and new exist) OR (only new one exists) don't do anything\n}\n\n/**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n * @param {State} state library state\n */\nexport async function initConnectionProfiles({ state }: { state: State }) {\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: start`,\n state,\n });\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n // create connections.json file if it doesn't exist\n const filename = getConnectionProfilesPath({ state });\n const folderName = path.dirname(filename);\n if (!fs.existsSync(filename)) {\n if (!fs.existsSync(folderName)) {\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: folder does not exist: ${folderName}, creating...`,\n state,\n });\n fs.mkdirSync(folderName, { recursive: true });\n }\n if (!fs.existsSync(filename)) {\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: file does not exist: ${filename}, creating...`,\n state,\n });\n fs.writeFileSync(\n filename,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n }\n }\n // encrypt the password and logApiSecret from clear text to aes-256-GCM\n else {\n migrateFromLegacyProfile();\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData: ConnectionsFileInterface = JSON.parse(data);\n let convert = false;\n for (const conn of Object.keys(connectionsData)) {\n if (connectionsData[conn]['password']) {\n convert = true;\n connectionsData[conn].encodedPassword = await dataProtection.encrypt(\n connectionsData[conn]['password']\n );\n delete connectionsData[conn]['password'];\n }\n if (connectionsData[conn]['logApiSecret']) {\n convert = true;\n connectionsData[conn].encodedLogApiSecret =\n await dataProtection.encrypt(connectionsData[conn]['logApiSecret']);\n delete connectionsData[conn]['logApiSecret'];\n }\n if (connectionsData[conn]['svcacctJwk']) {\n convert = true;\n connectionsData[conn].encodedSvcacctJwk = await dataProtection.encrypt(\n connectionsData[conn]['svcacctJwk']\n );\n delete connectionsData[conn]['svcacctJwk'];\n }\n }\n if (convert) {\n fs.writeFileSync(\n filename,\n JSON.stringify(connectionsData, null, fileOptions.indentation)\n );\n }\n }\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: end`,\n state,\n });\n}\n\n/**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @param {State} state library state\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfileByHost({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<ConnectionProfileInterface> {\n try {\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 0) {\n printMessage({\n message: `Profile for ${host} not found. Please specify credentials on command line`,\n type: 'error',\n state,\n });\n return null;\n }\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n }\n return {\n tenant: profiles[0].tenant,\n username: profiles[0].username ? profiles[0].username : null,\n password: profiles[0].encodedPassword\n ? await dataProtection.decrypt(profiles[0].encodedPassword)\n : null,\n logApiKey: profiles[0].logApiKey ? profiles[0].logApiKey : null,\n logApiSecret: profiles[0].encodedLogApiSecret\n ? await dataProtection.decrypt(profiles[0].encodedLogApiSecret)\n : null,\n authenticationService: profiles[0].authenticationService\n ? profiles[0].authenticationService\n : null,\n authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides\n ? profiles[0].authenticationHeaderOverrides\n : {},\n svcacctName: profiles[0].svcacctName ? profiles[0].svcacctName : null,\n svcacctId: profiles[0].svcacctId ? profiles[0].svcacctId : null,\n svcacctJwk: profiles[0].encodedSvcacctJwk\n ? await dataProtection.decrypt(profiles[0].encodedSvcacctJwk)\n : null,\n };\n } catch (e) {\n printMessage({\n message: `Can not read saved connection info, please specify credentials on command line: ${e}`,\n type: 'error',\n state,\n });\n return null;\n }\n}\n\n/**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfile({\n state,\n}: {\n state: State;\n}): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host: state.getHost(), state });\n}\n\n/**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\nexport async function saveConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<boolean> {\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: start`,\n state,\n });\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n debugMessage({ message: `Saving connection profile in ${filename}`, state });\n let profiles: ConnectionsFileInterface = {};\n let profile: SecureConnectionProfileInterface = { tenant: '' };\n try {\n fs.statSync(filename);\n const data = fs.readFileSync(filename, 'utf8');\n profiles = JSON.parse(data);\n\n // find tenant\n const found = findConnectionProfiles({\n connectionProfiles: profiles,\n host,\n state,\n });\n\n // replace tenant in session with real tenant url if necessary\n if (found.length === 1) {\n profile = found[0];\n state.setHost(profile.tenant);\n verboseMessage({ message: `Existing profile: ${profile.tenant}`, state });\n debugMessage({ message: profile, state });\n }\n\n // connection profile not found, validate host is a real URL\n if (found.length === 0) {\n if (isValidUrl(host)) {\n state.setHost(host);\n debugMessage({ message: `New profile: ${host}`, state });\n } else {\n printMessage({\n message: `No existing profile found matching '${host}'. Provide a valid URL as the host argument to create a new profile.`,\n type: 'error',\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [false]`,\n state,\n });\n return false;\n }\n }\n } catch (error) {\n debugMessage({\n message: `New profiles file ${filename} with new profile ${host}`,\n state,\n });\n }\n\n // user account\n if (state.getUsername()) profile.username = state.getUsername();\n if (state.getPassword())\n profile.encodedPassword = await dataProtection.encrypt(state.getPassword());\n\n // log API\n if (state.getLogApiKey()) profile.logApiKey = state.getLogApiKey();\n if (state.getLogApiSecret())\n profile.encodedLogApiSecret = await dataProtection.encrypt(\n state.getLogApiSecret()\n );\n\n // service account\n if (state.getServiceAccountId()) {\n profile.svcacctId = state.getServiceAccountId();\n if (state.getBearerToken()) {\n profile.svcacctName = (\n await getServiceAccount({\n serviceAccountId: state.getServiceAccountId(),\n state,\n })\n ).name;\n }\n }\n if (state.getServiceAccountJwk())\n profile.encodedSvcacctJwk = await dataProtection.encrypt(\n state.getServiceAccountJwk()\n );\n // update existing service account profile\n if (state.getBearerToken() && profile.svcacctId && !profile.svcacctName) {\n profile.svcacctName = (\n await getServiceAccount({ serviceAccountId: profile.svcacctId, state })\n ).name;\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: added missing service account name`,\n state,\n });\n }\n\n // advanced settings\n if (state.getAuthenticationService()) {\n profile.authenticationService = state.getAuthenticationService();\n printMessage({\n message:\n 'Advanced setting: Authentication Service: ' +\n state.getAuthenticationService(),\n type: 'info',\n state,\n });\n }\n if (\n state.getAuthenticationHeaderOverrides() &&\n Object.entries(state.getAuthenticationHeaderOverrides()).length\n ) {\n profile.authenticationHeaderOverrides =\n state.getAuthenticationHeaderOverrides();\n printMessage({\n message: 'Advanced setting: Authentication Header Overrides: ',\n type: 'info',\n state,\n });\n printMessage({\n message: state.getAuthenticationHeaderOverrides(),\n type: 'info',\n state,\n });\n }\n\n // remove the helper key 'tenant'\n delete profile.tenant;\n\n // update profiles\n profiles[state.getHost()] = profile;\n\n // sort profiles\n const orderedProfiles = Object.keys(profiles)\n .sort()\n .reduce((obj, key) => {\n obj[key] = profiles[key];\n return obj;\n }, {});\n\n // save profiles\n saveJsonToFile({\n data: orderedProfiles,\n filename,\n includeMeta: false,\n state,\n });\n verboseMessage({\n message: `Saved connection profile ${state.getHost()} in ${filename}`,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [true]`,\n state,\n });\n return true;\n}\n\n/**\n * Delete connection profile\n * @param {String} host host tenant host url or unique substring\n */\nexport function deleteConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}) {\n const filename = getConnectionProfilesPath({ state });\n let connectionsData: ConnectionsFileInterface = {};\n fs.stat(filename, (err) => {\n if (err == null) {\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 1) {\n delete connectionsData[profiles[0].tenant];\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n printMessage({\n message: `Deleted connection profile ${profiles[0].tenant}`,\n state,\n });\n } else {\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n } else {\n printMessage({\n message: `No connection profile ${host} found`,\n state,\n });\n }\n }\n } else if (err.code === 'ENOENT') {\n printMessage({\n message: `Connection profile file ${filename} not found`,\n state,\n });\n } else {\n printMessage({\n message: `Error in deleting connection profile: ${err.code}`,\n type: 'error',\n state,\n });\n }\n });\n}\n\n/**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\nexport async function addNewServiceAccount({\n state,\n}: {\n state: State;\n}): Promise<IdObjectSkeletonInterface> {\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: start`,\n state,\n });\n const name = `Frodo-SA-${new Date().getTime()}`;\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: name=${name}...`,\n state,\n });\n const description = `${state.getUsername()}'s Frodo Service Account`;\n const scope = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];\n const jwkPrivate = await createJwkRsa();\n const jwkPublic = await getJwkRsaPublic(jwkPrivate);\n const jwks = createJwks(jwkPublic);\n const sa = await createServiceAccount({\n name,\n description,\n accountStatus: 'Active',\n scopes: scope,\n jwks,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: id=${sa._id}`,\n state,\n });\n state.setServiceAccountId(sa._id);\n state.setServiceAccountJwk(jwkPrivate);\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: end`,\n state,\n });\n return sa;\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAwB,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAA,IAAAI,QAAA,GAAAJ,OAAA;AAAA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAAA,IAAAM,kBAAA,GAAAN,OAAA;AAAA,IAAAO,UAAA,GAAAP,OAAA;AAAA,IAAAQ,kBAAA,GAAAR,OAAA;AAAA,IAAAS,QAAA,GAAAT,OAAA;AAAA,SAAAD,uBAAAW,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA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AAAiB,qBAAY,EAAC;MACXC,OAAO,mDAAAM,MAAA,CAAmDwG,EAAE,CAACI,GAAG,CAAE;MAClEpI;IACF,CAAC,CAAC;IACFA,KAAK,CAACqI,mBAAmB,CAACL,EAAE,CAACI,GAAG,CAAC;IACjCpI,KAAK,CAACsI,oBAAoB,CAACZ,UAAU,CAAC;IACtC,IAAAzG,qBAAY,EAAC;MACXC,OAAO,kDAAkD;MACzDlB;IACF,CAAC,CAAC;IACF,OAAOgI,EAAE;EACX,CAAC;EAAA,OAAAZ,qBAAA,CAAAhK,KAAA,OAAAE,SAAA;AAAA"}
|
|
@@ -109,7 +109,16 @@ const newProfileFilename = 'Connections.json';
|
|
|
109
109
|
export function getConnectionProfilesPath({
|
|
110
110
|
state
|
|
111
111
|
}) {
|
|
112
|
-
|
|
112
|
+
debugMessage({
|
|
113
|
+
message: `ConnectionProfileOps.getConnectionProfilesPath: start`,
|
|
114
|
+
state
|
|
115
|
+
});
|
|
116
|
+
const profilesPath = state.getConnectionProfilesPath() || process.env[Constants.FRODO_CONNECTION_PROFILES_PATH_KEY] || `${os.homedir()}/.frodo/${newProfileFilename}`;
|
|
117
|
+
debugMessage({
|
|
118
|
+
message: `ConnectionProfileOps.getConnectionProfilesPath: end [profilesPath=${profilesPath}]`,
|
|
119
|
+
state
|
|
120
|
+
});
|
|
121
|
+
return profilesPath;
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
/**
|
|
@@ -175,6 +184,10 @@ function migrateFromLegacyProfile() {
|
|
|
175
184
|
export async function initConnectionProfiles({
|
|
176
185
|
state
|
|
177
186
|
}) {
|
|
187
|
+
debugMessage({
|
|
188
|
+
message: `ConnectionProfileOps.initConnectionProfiles: start`,
|
|
189
|
+
state
|
|
190
|
+
});
|
|
178
191
|
const dataProtection = new DataProtection({
|
|
179
192
|
pathToMasterKey: state.getMasterKeyPath(),
|
|
180
193
|
state
|
|
@@ -184,11 +197,21 @@ export async function initConnectionProfiles({
|
|
|
184
197
|
state
|
|
185
198
|
});
|
|
186
199
|
const folderName = path.dirname(filename);
|
|
187
|
-
if (!fs.existsSync(
|
|
188
|
-
fs.
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
if (!fs.existsSync(filename)) {
|
|
201
|
+
if (!fs.existsSync(folderName)) {
|
|
202
|
+
debugMessage({
|
|
203
|
+
message: `ConnectionProfileOps.initConnectionProfiles: folder does not exist: ${folderName}, creating...`,
|
|
204
|
+
state
|
|
205
|
+
});
|
|
206
|
+
fs.mkdirSync(folderName, {
|
|
207
|
+
recursive: true
|
|
208
|
+
});
|
|
209
|
+
}
|
|
191
210
|
if (!fs.existsSync(filename)) {
|
|
211
|
+
debugMessage({
|
|
212
|
+
message: `ConnectionProfileOps.initConnectionProfiles: file does not exist: ${filename}, creating...`,
|
|
213
|
+
state
|
|
214
|
+
});
|
|
192
215
|
fs.writeFileSync(filename, JSON.stringify({}, null, fileOptions.indentation));
|
|
193
216
|
}
|
|
194
217
|
}
|
|
@@ -219,6 +242,10 @@ export async function initConnectionProfiles({
|
|
|
219
242
|
fs.writeFileSync(filename, JSON.stringify(connectionsData, null, fileOptions.indentation));
|
|
220
243
|
}
|
|
221
244
|
}
|
|
245
|
+
debugMessage({
|
|
246
|
+
message: `ConnectionProfileOps.initConnectionProfiles: end`,
|
|
247
|
+
state
|
|
248
|
+
});
|
|
222
249
|
}
|
|
223
250
|
|
|
224
251
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionProfileOps.js","names":["fs","os","path","Constants","debugMessage","printMessage","verboseMessage","DataProtection","saveJsonToFile","isValidUrl","createServiceAccount","getServiceAccount","createJwkRsa","createJwks","getJwkRsaPublic","state","getConnectionProfilesPath","findConnectionProfiles","connectionProfiles","host","initConnectionProfiles","getConnectionProfileByHost","getConnectionProfile","saveConnectionProfile","deleteConnectionProfile","addNewServiceAccount","fileOptions","indentation","legacyProfileFilename","newProfileFilename","process","env","FRODO_CONNECTION_PROFILES_PATH_KEY","homedir","profiles","tenant","message","includes","foundProfile","push","migrateFromLegacyProfile","legacyPath","newPath","existsSync","writeFileSync","JSON","stringify","copyFileSync","renameSync","dataProtection","pathToMasterKey","getMasterKeyPath","filename","folderName","dirname","mkdirSync","recursive","data","readFileSync","connectionsData","parse","convert","conn","Object","keys","encodedPassword","encrypt","encodedLogApiSecret","encodedSvcacctJwk","length","type","forEach","p","username","password","decrypt","logApiKey","logApiSecret","authenticationService","authenticationHeaderOverrides","svcacctName","svcacctId","svcacctJwk","e","getHost","profile","statSync","found","setHost","error","getUsername","getPassword","getLogApiKey","getLogApiSecret","getServiceAccountId","getBearerToken","serviceAccountId","name","getServiceAccountJwk","getAuthenticationService","getAuthenticationHeaderOverrides","entries","orderedProfiles","sort","reduce","obj","key","includeMeta","stat","err","code","Date","getTime","description","scope","jwkPrivate","jwkPublic","jwks","sa","accountStatus","scopes","_id","setServiceAccountId","setServiceAccountJwk"],"sources":["../../src/ops/ConnectionProfileOps.ts"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\nimport { IdObjectSkeletonInterface } from '../api/ApiTypes';\nimport Constants from '../shared/Constants';\nimport { State } from '../shared/State';\nimport { debugMessage, printMessage, verboseMessage } from '../utils/Console';\nimport DataProtection from '../utils/DataProtection';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport { isValidUrl } from '../utils/MiscUtils';\nimport {\n createServiceAccount,\n getServiceAccount,\n} from './cloud/ServiceAccountOps';\nimport { createJwkRsa, createJwks, getJwkRsaPublic, JwkRsa } from './JoseOps';\n\nexport type ConnectionProfile = {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string;\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[];\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n initConnectionProfiles(): Promise<void>;\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n getConnectionProfileByHost(host: string): Promise<ConnectionProfileInterface>;\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n getConnectionProfile(): Promise<ConnectionProfileInterface>;\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n saveConnectionProfile(host: string): Promise<boolean>;\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void;\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n addNewServiceAccount(): Promise<IdObjectSkeletonInterface>;\n};\n\nexport default (state: State): ConnectionProfile => {\n return {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string {\n return getConnectionProfilesPath({ state });\n },\n\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[] {\n return findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n });\n },\n\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n async initConnectionProfiles() {\n initConnectionProfiles({ state });\n },\n\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n async getConnectionProfileByHost(\n host: string\n ): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host, state });\n },\n\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n async getConnectionProfile(): Promise<ConnectionProfileInterface> {\n return getConnectionProfile({ state });\n },\n\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n async saveConnectionProfile(host: string): Promise<boolean> {\n return saveConnectionProfile({ host, state });\n },\n\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void {\n deleteConnectionProfile({ host, state });\n },\n\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n async addNewServiceAccount(): Promise<IdObjectSkeletonInterface> {\n return addNewServiceAccount({ state });\n },\n };\n};\n\nconst fileOptions = {\n indentation: 4,\n};\n\nexport interface SecureConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n encodedPassword?: string | null;\n logApiKey?: string | null;\n encodedLogApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n encodedSvcacctJwk?: string | null;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n password?: string | null;\n logApiKey?: string | null;\n logApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n svcacctJwk?: JwkRsa;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionsFileInterface {\n [key: string]: SecureConnectionProfileInterface;\n}\n\nconst legacyProfileFilename = '.frodorc';\nconst newProfileFilename = 'Connections.json';\n\n/**\n * Get connection profiles file name\n * @param {State} state library state\n * @returns {String} connection profiles file name\n */\nexport function getConnectionProfilesPath({ state }: { state: State }): string {\n return (\n state.getConnectionProfilesPath() ||\n process.env[Constants.FRODO_CONNECTION_PROFILES_PATH_KEY] ||\n `${os.homedir()}/.frodo/${newProfileFilename}`\n );\n}\n\n/**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @param {State} state library state\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\nfunction findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n}: {\n connectionProfiles: ConnectionsFileInterface;\n host: string;\n state: State;\n}): SecureConnectionProfileInterface[] {\n const profiles: SecureConnectionProfileInterface[] = [];\n for (const tenant in connectionProfiles) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: tenant=${tenant}`,\n state,\n });\n if (tenant.includes(host)) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: '${host}' identifies '${tenant}', including in result set`,\n state,\n });\n const foundProfile = { ...connectionProfiles[tenant] };\n foundProfile.tenant = tenant;\n profiles.push(foundProfile);\n }\n }\n return profiles;\n}\n\n/**\n * Migrate from .frodorc to Connections.json\n */\nfunction migrateFromLegacyProfile() {\n const legacyPath = `${os.homedir()}/.frodo/${legacyProfileFilename}`;\n const newPath = `${os.homedir()}/.frodo/${newProfileFilename}`;\n if (!fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // no connections file (old or new), create empty new one\n fs.writeFileSync(\n newPath,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n } else if (fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // old exists, new one does not - so copy old to new one\n fs.copyFileSync(legacyPath, newPath);\n // for now, just add a \"deprecated\" suffix. May delete the old file\n // in a future release\n fs.renameSync(legacyPath, `${legacyPath}.deprecated`);\n }\n // in other cases, where\n // (both old and new exist) OR (only new one exists) don't do anything\n}\n\n/**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n * @param {State} state library state\n */\nexport async function initConnectionProfiles({ state }: { state: State }) {\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n // create connections.json file if it doesn't exist\n const filename = getConnectionProfilesPath({ state });\n const folderName = path.dirname(filename);\n if (!fs.existsSync(folderName)) {\n fs.mkdirSync(folderName, { recursive: true });\n if (!fs.existsSync(filename)) {\n fs.writeFileSync(\n filename,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n }\n }\n // encrypt the password and logApiSecret from clear text to aes-256-GCM\n else {\n migrateFromLegacyProfile();\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData: ConnectionsFileInterface = JSON.parse(data);\n let convert = false;\n for (const conn of Object.keys(connectionsData)) {\n if (connectionsData[conn]['password']) {\n convert = true;\n connectionsData[conn].encodedPassword = await dataProtection.encrypt(\n connectionsData[conn]['password']\n );\n delete connectionsData[conn]['password'];\n }\n if (connectionsData[conn]['logApiSecret']) {\n convert = true;\n connectionsData[conn].encodedLogApiSecret =\n await dataProtection.encrypt(connectionsData[conn]['logApiSecret']);\n delete connectionsData[conn]['logApiSecret'];\n }\n if (connectionsData[conn]['svcacctJwk']) {\n convert = true;\n connectionsData[conn].encodedSvcacctJwk = await dataProtection.encrypt(\n connectionsData[conn]['svcacctJwk']\n );\n delete connectionsData[conn]['svcacctJwk'];\n }\n }\n if (convert) {\n fs.writeFileSync(\n filename,\n JSON.stringify(connectionsData, null, fileOptions.indentation)\n );\n }\n }\n}\n\n/**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @param {State} state library state\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfileByHost({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<ConnectionProfileInterface> {\n try {\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 0) {\n printMessage({\n message: `Profile for ${host} not found. Please specify credentials on command line`,\n type: 'error',\n state,\n });\n return null;\n }\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n }\n return {\n tenant: profiles[0].tenant,\n username: profiles[0].username ? profiles[0].username : null,\n password: profiles[0].encodedPassword\n ? await dataProtection.decrypt(profiles[0].encodedPassword)\n : null,\n logApiKey: profiles[0].logApiKey ? profiles[0].logApiKey : null,\n logApiSecret: profiles[0].encodedLogApiSecret\n ? await dataProtection.decrypt(profiles[0].encodedLogApiSecret)\n : null,\n authenticationService: profiles[0].authenticationService\n ? profiles[0].authenticationService\n : null,\n authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides\n ? profiles[0].authenticationHeaderOverrides\n : {},\n svcacctName: profiles[0].svcacctName ? profiles[0].svcacctName : null,\n svcacctId: profiles[0].svcacctId ? profiles[0].svcacctId : null,\n svcacctJwk: profiles[0].encodedSvcacctJwk\n ? await dataProtection.decrypt(profiles[0].encodedSvcacctJwk)\n : null,\n };\n } catch (e) {\n printMessage({\n message: `Can not read saved connection info, please specify credentials on command line: ${e}`,\n type: 'error',\n state,\n });\n return null;\n }\n}\n\n/**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfile({\n state,\n}: {\n state: State;\n}): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host: state.getHost(), state });\n}\n\n/**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\nexport async function saveConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<boolean> {\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: start`,\n state,\n });\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n debugMessage({ message: `Saving connection profile in ${filename}`, state });\n let profiles: ConnectionsFileInterface = {};\n let profile: SecureConnectionProfileInterface = { tenant: '' };\n try {\n fs.statSync(filename);\n const data = fs.readFileSync(filename, 'utf8');\n profiles = JSON.parse(data);\n\n // find tenant\n const found = findConnectionProfiles({\n connectionProfiles: profiles,\n host,\n state,\n });\n\n // replace tenant in session with real tenant url if necessary\n if (found.length === 1) {\n profile = found[0];\n state.setHost(profile.tenant);\n verboseMessage({ message: `Existing profile: ${profile.tenant}`, state });\n debugMessage({ message: profile, state });\n }\n\n // connection profile not found, validate host is a real URL\n if (found.length === 0) {\n if (isValidUrl(host)) {\n state.setHost(host);\n debugMessage({ message: `New profile: ${host}`, state });\n } else {\n printMessage({\n message: `No existing profile found matching '${host}'. Provide a valid URL as the host argument to create a new profile.`,\n type: 'error',\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [false]`,\n state,\n });\n return false;\n }\n }\n } catch (error) {\n debugMessage({\n message: `New profiles file ${filename} with new profile ${host}`,\n state,\n });\n }\n\n // user account\n if (state.getUsername()) profile.username = state.getUsername();\n if (state.getPassword())\n profile.encodedPassword = await dataProtection.encrypt(state.getPassword());\n\n // log API\n if (state.getLogApiKey()) profile.logApiKey = state.getLogApiKey();\n if (state.getLogApiSecret())\n profile.encodedLogApiSecret = await dataProtection.encrypt(\n state.getLogApiSecret()\n );\n\n // service account\n if (state.getServiceAccountId()) {\n profile.svcacctId = state.getServiceAccountId();\n if (state.getBearerToken()) {\n profile.svcacctName = (\n await getServiceAccount({\n serviceAccountId: state.getServiceAccountId(),\n state,\n })\n ).name;\n }\n }\n if (state.getServiceAccountJwk())\n profile.encodedSvcacctJwk = await dataProtection.encrypt(\n state.getServiceAccountJwk()\n );\n // update existing service account profile\n if (state.getBearerToken() && profile.svcacctId && !profile.svcacctName) {\n profile.svcacctName = (\n await getServiceAccount({ serviceAccountId: profile.svcacctId, state })\n ).name;\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: added missing service account name`,\n state,\n });\n }\n\n // advanced settings\n if (state.getAuthenticationService()) {\n profile.authenticationService = state.getAuthenticationService();\n printMessage({\n message:\n 'Advanced setting: Authentication Service: ' +\n state.getAuthenticationService(),\n type: 'info',\n state,\n });\n }\n if (\n state.getAuthenticationHeaderOverrides() &&\n Object.entries(state.getAuthenticationHeaderOverrides()).length\n ) {\n profile.authenticationHeaderOverrides =\n state.getAuthenticationHeaderOverrides();\n printMessage({\n message: 'Advanced setting: Authentication Header Overrides: ',\n type: 'info',\n state,\n });\n printMessage({\n message: state.getAuthenticationHeaderOverrides(),\n type: 'info',\n state,\n });\n }\n\n // remove the helper key 'tenant'\n delete profile.tenant;\n\n // update profiles\n profiles[state.getHost()] = profile;\n\n // sort profiles\n const orderedProfiles = Object.keys(profiles)\n .sort()\n .reduce((obj, key) => {\n obj[key] = profiles[key];\n return obj;\n }, {});\n\n // save profiles\n saveJsonToFile({\n data: orderedProfiles,\n filename,\n includeMeta: false,\n state,\n });\n verboseMessage({\n message: `Saved connection profile ${state.getHost()} in ${filename}`,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [true]`,\n state,\n });\n return true;\n}\n\n/**\n * Delete connection profile\n * @param {String} host host tenant host url or unique substring\n */\nexport function deleteConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}) {\n const filename = getConnectionProfilesPath({ state });\n let connectionsData: ConnectionsFileInterface = {};\n fs.stat(filename, (err) => {\n if (err == null) {\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 1) {\n delete connectionsData[profiles[0].tenant];\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n printMessage({\n message: `Deleted connection profile ${profiles[0].tenant}`,\n state,\n });\n } else {\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n } else {\n printMessage({\n message: `No connection profile ${host} found`,\n state,\n });\n }\n }\n } else if (err.code === 'ENOENT') {\n printMessage({\n message: `Connection profile file ${filename} not found`,\n state,\n });\n } else {\n printMessage({\n message: `Error in deleting connection profile: ${err.code}`,\n type: 'error',\n state,\n });\n }\n });\n}\n\n/**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\nexport async function addNewServiceAccount({\n state,\n}: {\n state: State;\n}): Promise<IdObjectSkeletonInterface> {\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: start`,\n state,\n });\n const name = `Frodo-SA-${new Date().getTime()}`;\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: name=${name}...`,\n state,\n });\n const description = `${state.getUsername()}'s Frodo Service Account`;\n const scope = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];\n const jwkPrivate = await createJwkRsa();\n const jwkPublic = await getJwkRsaPublic(jwkPrivate);\n const jwks = createJwks(jwkPublic);\n const sa = await createServiceAccount({\n name,\n description,\n accountStatus: 'Active',\n scopes: scope,\n jwks,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: id=${sa._id}`,\n state,\n });\n state.setServiceAccountId(sa._id);\n state.setServiceAccountJwk(jwkPrivate);\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: end`,\n state,\n });\n return sa;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAAC,OAGjBC,SAAS;AAAA,SAEPC,YAAY,EAAEC,YAAY,EAAEC,cAAc;AAAA,OAC5CC,cAAc;AAAA,SACZC,cAAc;AAAA,SACdC,UAAU;AAAA,SAEjBC,oBAAoB,EACpBC,iBAAiB;AAAA,SAEVC,YAAY,EAAEC,UAAU,EAAEC,eAAe;AAsDlD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SAAS,EAAE,UAAU,EAAE,cAAc,CAAC;EACrD,MAAMC,UAAU,GAAG,MAAMvG,YAAY,CAAC,CAAC;EACvC,MAAMwG,SAAS,GAAG,MAAMtG,eAAe,CAACqG,UAAU,CAAC;EACnD,MAAME,IAAI,GAAGxG,UAAU,CAACuG,SAAS,CAAC;EAClC,MAAME,EAAE,GAAG,MAAM5G,oBAAoB,CAAC;IACpCuF,IAAI;IACJgB,WAAW;IACXM,aAAa,EAAE,QAAQ;IACvBC,MAAM,EAAEN,KAAK;IACbG,IAAI;IACJtG;EACF,CAAC,CAAC;EACFX,YAAY,CAAC;IACXgC,OAAO,EAAG,iDAAgDkF,EAAE,CAACG,GAAI,EAAC;IAClE1G;EACF,CAAC,CAAC;EACFA,KAAK,CAAC2G,mBAAmB,CAACJ,EAAE,CAACG,GAAG,CAAC;EACjC1G,KAAK,CAAC4G,oBAAoB,CAACR,UAAU,CAAC;EACtC/G,YAAY,CAAC;IACXgC,OAAO,EAAG,gDAA+C;IACzDrB;EACF,CAAC,CAAC;EACF,OAAOuG,EAAE;AACX"}
|
|
1
|
+
{"version":3,"file":"ConnectionProfileOps.js","names":["fs","os","path","Constants","debugMessage","printMessage","verboseMessage","DataProtection","saveJsonToFile","isValidUrl","createServiceAccount","getServiceAccount","createJwkRsa","createJwks","getJwkRsaPublic","state","getConnectionProfilesPath","findConnectionProfiles","connectionProfiles","host","initConnectionProfiles","getConnectionProfileByHost","getConnectionProfile","saveConnectionProfile","deleteConnectionProfile","addNewServiceAccount","fileOptions","indentation","legacyProfileFilename","newProfileFilename","message","profilesPath","process","env","FRODO_CONNECTION_PROFILES_PATH_KEY","homedir","profiles","tenant","includes","foundProfile","push","migrateFromLegacyProfile","legacyPath","newPath","existsSync","writeFileSync","JSON","stringify","copyFileSync","renameSync","dataProtection","pathToMasterKey","getMasterKeyPath","filename","folderName","dirname","mkdirSync","recursive","data","readFileSync","connectionsData","parse","convert","conn","Object","keys","encodedPassword","encrypt","encodedLogApiSecret","encodedSvcacctJwk","length","type","forEach","p","username","password","decrypt","logApiKey","logApiSecret","authenticationService","authenticationHeaderOverrides","svcacctName","svcacctId","svcacctJwk","e","getHost","profile","statSync","found","setHost","error","getUsername","getPassword","getLogApiKey","getLogApiSecret","getServiceAccountId","getBearerToken","serviceAccountId","name","getServiceAccountJwk","getAuthenticationService","getAuthenticationHeaderOverrides","entries","orderedProfiles","sort","reduce","obj","key","includeMeta","stat","err","code","Date","getTime","description","scope","jwkPrivate","jwkPublic","jwks","sa","accountStatus","scopes","_id","setServiceAccountId","setServiceAccountJwk"],"sources":["../../src/ops/ConnectionProfileOps.ts"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\n\nimport { IdObjectSkeletonInterface } from '../api/ApiTypes';\nimport Constants from '../shared/Constants';\nimport { State } from '../shared/State';\nimport { debugMessage, printMessage, verboseMessage } from '../utils/Console';\nimport DataProtection from '../utils/DataProtection';\nimport { saveJsonToFile } from '../utils/ExportImportUtils';\nimport { isValidUrl } from '../utils/MiscUtils';\nimport {\n createServiceAccount,\n getServiceAccount,\n} from './cloud/ServiceAccountOps';\nimport { createJwkRsa, createJwks, getJwkRsaPublic, JwkRsa } from './JoseOps';\n\nexport type ConnectionProfile = {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string;\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[];\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n initConnectionProfiles(): Promise<void>;\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n getConnectionProfileByHost(host: string): Promise<ConnectionProfileInterface>;\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n getConnectionProfile(): Promise<ConnectionProfileInterface>;\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n saveConnectionProfile(host: string): Promise<boolean>;\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void;\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n addNewServiceAccount(): Promise<IdObjectSkeletonInterface>;\n};\n\nexport default (state: State): ConnectionProfile => {\n return {\n /**\n * Get connection profiles file name\n * @returns {string} connection profiles file name\n */\n getConnectionProfilesPath(): string {\n return getConnectionProfilesPath({ state });\n },\n\n /**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\n findConnectionProfiles(\n connectionProfiles: ConnectionsFileInterface,\n host: string\n ): SecureConnectionProfileInterface[] {\n return findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n });\n },\n\n /**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n */\n async initConnectionProfiles() {\n initConnectionProfiles({ state });\n },\n\n /**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @returns {Object} connection profile or null\n */\n async getConnectionProfileByHost(\n host: string\n ): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host, state });\n },\n\n /**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\n async getConnectionProfile(): Promise<ConnectionProfileInterface> {\n return getConnectionProfile({ state });\n },\n\n /**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\n async saveConnectionProfile(host: string): Promise<boolean> {\n return saveConnectionProfile({ host, state });\n },\n\n /**\n * Delete connection profile\n * @param {string} host host tenant host url or unique substring\n */\n deleteConnectionProfile(host: string): void {\n deleteConnectionProfile({ host, state });\n },\n\n /**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\n async addNewServiceAccount(): Promise<IdObjectSkeletonInterface> {\n return addNewServiceAccount({ state });\n },\n };\n};\n\nconst fileOptions = {\n indentation: 4,\n};\n\nexport interface SecureConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n encodedPassword?: string | null;\n logApiKey?: string | null;\n encodedLogApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n encodedSvcacctJwk?: string | null;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionProfileInterface {\n tenant: string;\n username?: string | null;\n password?: string | null;\n logApiKey?: string | null;\n logApiSecret?: string | null;\n authenticationService?: string | null;\n authenticationHeaderOverrides?: Record<string, string>;\n svcacctId?: string | null;\n svcacctJwk?: JwkRsa;\n svcacctName?: string | null;\n}\n\nexport interface ConnectionsFileInterface {\n [key: string]: SecureConnectionProfileInterface;\n}\n\nconst legacyProfileFilename = '.frodorc';\nconst newProfileFilename = 'Connections.json';\n\n/**\n * Get connection profiles file name\n * @param {State} state library state\n * @returns {String} connection profiles file name\n */\nexport function getConnectionProfilesPath({ state }: { state: State }): string {\n debugMessage({\n message: `ConnectionProfileOps.getConnectionProfilesPath: start`,\n state,\n });\n const profilesPath =\n state.getConnectionProfilesPath() ||\n process.env[Constants.FRODO_CONNECTION_PROFILES_PATH_KEY] ||\n `${os.homedir()}/.frodo/${newProfileFilename}`;\n debugMessage({\n message: `ConnectionProfileOps.getConnectionProfilesPath: end [profilesPath=${profilesPath}]`,\n state,\n });\n return profilesPath;\n}\n\n/**\n * Find connection profiles\n * @param {ConnectionsFileInterface} connectionProfiles connection profile object\n * @param {string} host host url or unique substring\n * @param {State} state library state\n * @returns {SecureConnectionProfileInterface[]} Array of connection profiles\n */\nfunction findConnectionProfiles({\n connectionProfiles,\n host,\n state,\n}: {\n connectionProfiles: ConnectionsFileInterface;\n host: string;\n state: State;\n}): SecureConnectionProfileInterface[] {\n const profiles: SecureConnectionProfileInterface[] = [];\n for (const tenant in connectionProfiles) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: tenant=${tenant}`,\n state,\n });\n if (tenant.includes(host)) {\n debugMessage({\n message: `ConnectionProfileOps.findConnectionProfiles: '${host}' identifies '${tenant}', including in result set`,\n state,\n });\n const foundProfile = { ...connectionProfiles[tenant] };\n foundProfile.tenant = tenant;\n profiles.push(foundProfile);\n }\n }\n return profiles;\n}\n\n/**\n * Migrate from .frodorc to Connections.json\n */\nfunction migrateFromLegacyProfile() {\n const legacyPath = `${os.homedir()}/.frodo/${legacyProfileFilename}`;\n const newPath = `${os.homedir()}/.frodo/${newProfileFilename}`;\n if (!fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // no connections file (old or new), create empty new one\n fs.writeFileSync(\n newPath,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n } else if (fs.existsSync(legacyPath) && !fs.existsSync(newPath)) {\n // old exists, new one does not - so copy old to new one\n fs.copyFileSync(legacyPath, newPath);\n // for now, just add a \"deprecated\" suffix. May delete the old file\n // in a future release\n fs.renameSync(legacyPath, `${legacyPath}.deprecated`);\n }\n // in other cases, where\n // (both old and new exist) OR (only new one exists) don't do anything\n}\n\n/**\n * Initialize connection profiles\n *\n * This method is called from app.ts and runs before any of the message handlers are registered.\n * Therefore none of the Console message functions will produce any output.\n * @param {State} state library state\n */\nexport async function initConnectionProfiles({ state }: { state: State }) {\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: start`,\n state,\n });\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n // create connections.json file if it doesn't exist\n const filename = getConnectionProfilesPath({ state });\n const folderName = path.dirname(filename);\n if (!fs.existsSync(filename)) {\n if (!fs.existsSync(folderName)) {\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: folder does not exist: ${folderName}, creating...`,\n state,\n });\n fs.mkdirSync(folderName, { recursive: true });\n }\n if (!fs.existsSync(filename)) {\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: file does not exist: ${filename}, creating...`,\n state,\n });\n fs.writeFileSync(\n filename,\n JSON.stringify({}, null, fileOptions.indentation)\n );\n }\n }\n // encrypt the password and logApiSecret from clear text to aes-256-GCM\n else {\n migrateFromLegacyProfile();\n const data = fs.readFileSync(filename, 'utf8');\n const connectionsData: ConnectionsFileInterface = JSON.parse(data);\n let convert = false;\n for (const conn of Object.keys(connectionsData)) {\n if (connectionsData[conn]['password']) {\n convert = true;\n connectionsData[conn].encodedPassword = await dataProtection.encrypt(\n connectionsData[conn]['password']\n );\n delete connectionsData[conn]['password'];\n }\n if (connectionsData[conn]['logApiSecret']) {\n convert = true;\n connectionsData[conn].encodedLogApiSecret =\n await dataProtection.encrypt(connectionsData[conn]['logApiSecret']);\n delete connectionsData[conn]['logApiSecret'];\n }\n if (connectionsData[conn]['svcacctJwk']) {\n convert = true;\n connectionsData[conn].encodedSvcacctJwk = await dataProtection.encrypt(\n connectionsData[conn]['svcacctJwk']\n );\n delete connectionsData[conn]['svcacctJwk'];\n }\n }\n if (convert) {\n fs.writeFileSync(\n filename,\n JSON.stringify(connectionsData, null, fileOptions.indentation)\n );\n }\n }\n debugMessage({\n message: `ConnectionProfileOps.initConnectionProfiles: end`,\n state,\n });\n}\n\n/**\n * Get connection profile by host\n * @param {String} host host tenant host url or unique substring\n * @param {State} state library state\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfileByHost({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<ConnectionProfileInterface> {\n try {\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n const connectionsData = JSON.parse(fs.readFileSync(filename, 'utf8'));\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 0) {\n printMessage({\n message: `Profile for ${host} not found. Please specify credentials on command line`,\n type: 'error',\n state,\n });\n return null;\n }\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n }\n return {\n tenant: profiles[0].tenant,\n username: profiles[0].username ? profiles[0].username : null,\n password: profiles[0].encodedPassword\n ? await dataProtection.decrypt(profiles[0].encodedPassword)\n : null,\n logApiKey: profiles[0].logApiKey ? profiles[0].logApiKey : null,\n logApiSecret: profiles[0].encodedLogApiSecret\n ? await dataProtection.decrypt(profiles[0].encodedLogApiSecret)\n : null,\n authenticationService: profiles[0].authenticationService\n ? profiles[0].authenticationService\n : null,\n authenticationHeaderOverrides: profiles[0].authenticationHeaderOverrides\n ? profiles[0].authenticationHeaderOverrides\n : {},\n svcacctName: profiles[0].svcacctName ? profiles[0].svcacctName : null,\n svcacctId: profiles[0].svcacctId ? profiles[0].svcacctId : null,\n svcacctJwk: profiles[0].encodedSvcacctJwk\n ? await dataProtection.decrypt(profiles[0].encodedSvcacctJwk)\n : null,\n };\n } catch (e) {\n printMessage({\n message: `Can not read saved connection info, please specify credentials on command line: ${e}`,\n type: 'error',\n state,\n });\n return null;\n }\n}\n\n/**\n * Get connection profile\n * @returns {Object} connection profile or null\n */\nexport async function getConnectionProfile({\n state,\n}: {\n state: State;\n}): Promise<ConnectionProfileInterface> {\n return getConnectionProfileByHost({ host: state.getHost(), state });\n}\n\n/**\n * Save connection profile\n * @param {string} host host url for new profiles or unique substring for existing profiles\n * @returns {Promise<boolean>} true if the operation succeeded, false otherwise\n */\nexport async function saveConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}): Promise<boolean> {\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: start`,\n state,\n });\n const dataProtection = new DataProtection({\n pathToMasterKey: state.getMasterKeyPath(),\n state,\n });\n const filename = getConnectionProfilesPath({ state });\n debugMessage({ message: `Saving connection profile in ${filename}`, state });\n let profiles: ConnectionsFileInterface = {};\n let profile: SecureConnectionProfileInterface = { tenant: '' };\n try {\n fs.statSync(filename);\n const data = fs.readFileSync(filename, 'utf8');\n profiles = JSON.parse(data);\n\n // find tenant\n const found = findConnectionProfiles({\n connectionProfiles: profiles,\n host,\n state,\n });\n\n // replace tenant in session with real tenant url if necessary\n if (found.length === 1) {\n profile = found[0];\n state.setHost(profile.tenant);\n verboseMessage({ message: `Existing profile: ${profile.tenant}`, state });\n debugMessage({ message: profile, state });\n }\n\n // connection profile not found, validate host is a real URL\n if (found.length === 0) {\n if (isValidUrl(host)) {\n state.setHost(host);\n debugMessage({ message: `New profile: ${host}`, state });\n } else {\n printMessage({\n message: `No existing profile found matching '${host}'. Provide a valid URL as the host argument to create a new profile.`,\n type: 'error',\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [false]`,\n state,\n });\n return false;\n }\n }\n } catch (error) {\n debugMessage({\n message: `New profiles file ${filename} with new profile ${host}`,\n state,\n });\n }\n\n // user account\n if (state.getUsername()) profile.username = state.getUsername();\n if (state.getPassword())\n profile.encodedPassword = await dataProtection.encrypt(state.getPassword());\n\n // log API\n if (state.getLogApiKey()) profile.logApiKey = state.getLogApiKey();\n if (state.getLogApiSecret())\n profile.encodedLogApiSecret = await dataProtection.encrypt(\n state.getLogApiSecret()\n );\n\n // service account\n if (state.getServiceAccountId()) {\n profile.svcacctId = state.getServiceAccountId();\n if (state.getBearerToken()) {\n profile.svcacctName = (\n await getServiceAccount({\n serviceAccountId: state.getServiceAccountId(),\n state,\n })\n ).name;\n }\n }\n if (state.getServiceAccountJwk())\n profile.encodedSvcacctJwk = await dataProtection.encrypt(\n state.getServiceAccountJwk()\n );\n // update existing service account profile\n if (state.getBearerToken() && profile.svcacctId && !profile.svcacctName) {\n profile.svcacctName = (\n await getServiceAccount({ serviceAccountId: profile.svcacctId, state })\n ).name;\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: added missing service account name`,\n state,\n });\n }\n\n // advanced settings\n if (state.getAuthenticationService()) {\n profile.authenticationService = state.getAuthenticationService();\n printMessage({\n message:\n 'Advanced setting: Authentication Service: ' +\n state.getAuthenticationService(),\n type: 'info',\n state,\n });\n }\n if (\n state.getAuthenticationHeaderOverrides() &&\n Object.entries(state.getAuthenticationHeaderOverrides()).length\n ) {\n profile.authenticationHeaderOverrides =\n state.getAuthenticationHeaderOverrides();\n printMessage({\n message: 'Advanced setting: Authentication Header Overrides: ',\n type: 'info',\n state,\n });\n printMessage({\n message: state.getAuthenticationHeaderOverrides(),\n type: 'info',\n state,\n });\n }\n\n // remove the helper key 'tenant'\n delete profile.tenant;\n\n // update profiles\n profiles[state.getHost()] = profile;\n\n // sort profiles\n const orderedProfiles = Object.keys(profiles)\n .sort()\n .reduce((obj, key) => {\n obj[key] = profiles[key];\n return obj;\n }, {});\n\n // save profiles\n saveJsonToFile({\n data: orderedProfiles,\n filename,\n includeMeta: false,\n state,\n });\n verboseMessage({\n message: `Saved connection profile ${state.getHost()} in ${filename}`,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.saveConnectionProfile: end [true]`,\n state,\n });\n return true;\n}\n\n/**\n * Delete connection profile\n * @param {String} host host tenant host url or unique substring\n */\nexport function deleteConnectionProfile({\n host,\n state,\n}: {\n host: string;\n state: State;\n}) {\n const filename = getConnectionProfilesPath({ state });\n let connectionsData: ConnectionsFileInterface = {};\n fs.stat(filename, (err) => {\n if (err == null) {\n const data = fs.readFileSync(filename, 'utf8');\n connectionsData = JSON.parse(data);\n const profiles = findConnectionProfiles({\n connectionProfiles: connectionsData,\n host,\n state,\n });\n if (profiles.length == 1) {\n delete connectionsData[profiles[0].tenant];\n fs.writeFileSync(filename, JSON.stringify(connectionsData, null, 2));\n printMessage({\n message: `Deleted connection profile ${profiles[0].tenant}`,\n state,\n });\n } else {\n if (profiles.length > 1) {\n printMessage({\n message: `Multiple matching profiles found.`,\n type: 'error',\n state,\n });\n profiles.forEach((p) => {\n printMessage({ message: `- ${p.tenant}`, type: 'error', state });\n });\n printMessage({\n message: `Please specify a unique sub-string`,\n type: 'error',\n state,\n });\n return null;\n } else {\n printMessage({\n message: `No connection profile ${host} found`,\n state,\n });\n }\n }\n } else if (err.code === 'ENOENT') {\n printMessage({\n message: `Connection profile file ${filename} not found`,\n state,\n });\n } else {\n printMessage({\n message: `Error in deleting connection profile: ${err.code}`,\n type: 'error',\n state,\n });\n }\n });\n}\n\n/**\n * Create a new service account using auto-generated parameters\n * @returns {Promise<IdObjectSkeletonInterface>} A promise resolving to a service account object\n */\nexport async function addNewServiceAccount({\n state,\n}: {\n state: State;\n}): Promise<IdObjectSkeletonInterface> {\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: start`,\n state,\n });\n const name = `Frodo-SA-${new Date().getTime()}`;\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: name=${name}...`,\n state,\n });\n const description = `${state.getUsername()}'s Frodo Service Account`;\n const scope = ['fr:am:*', 'fr:idm:*', 'fr:idc:esv:*'];\n const jwkPrivate = await createJwkRsa();\n const jwkPublic = await getJwkRsaPublic(jwkPrivate);\n const jwks = createJwks(jwkPublic);\n const sa = await createServiceAccount({\n name,\n description,\n accountStatus: 'Active',\n scopes: scope,\n jwks,\n state,\n });\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: id=${sa._id}`,\n state,\n });\n state.setServiceAccountId(sa._id);\n state.setServiceAccountJwk(jwkPrivate);\n debugMessage({\n message: `ConnectionProfileOps.addNewServiceAccount: end`,\n state,\n });\n return sa;\n}\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AAAC,OAG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C,CAAC;EACFA,KAAK,CAAC4G,mBAAmB,CAACJ,EAAE,CAACG,GAAG,CAAC;EACjC3G,KAAK,CAAC6G,oBAAoB,CAACR,UAAU,CAAC;EACtChH,YAAY,CAAC;IACX0B,OAAO,EAAG,gDAA+C;IACzDf;EACF,CAAC,CAAC;EACF,OAAOwG,EAAE;AACX"}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionProfileOps.d.ts","sourceRoot":"","sources":["../../src/ops/ConnectionProfileOps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AASxC,OAAO,EAA6C,MAAM,EAAE,MAAM,WAAW,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,yBAAyB,IAAI,MAAM,CAAC;IACpC;;;;;OAKG;IACH,sBAAsB,CACpB,kBAAkB,EAAE,wBAAwB,EAC5C,IAAI,EAAE,MAAM,GACX,gCAAgC,EAAE,CAAC;IACtC;;;;;OAKG;IACH,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC;;;;OAIG;IACH,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC9E;;;OAGG;IACH,oBAAoB,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC5D;;;;OAIG;IACH,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtD;;;OAGG;IACH,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;OAGG;IACH,oBAAoB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC5D,CAAC;gCAEqB,KAAK,KAAG,iBAAiB;AAAhD,wBAiFE;AAMF,MAAM,WAAW,gCAAgC;I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