diff --git a/addons/api/mirage/factories/credential.js b/addons/api/mirage/factories/credential.js index e257205b3..eac680c96 100644 --- a/addons/api/mirage/factories/credential.js +++ b/addons/api/mirage/factories/credential.js @@ -3,9 +3,18 @@ import { faker } from '@faker-js/faker'; import permissions from '../helpers/permissions'; import generatedId from '../helpers/id'; +const types = ['username_password', 'ssh_private_key']; + export default factory.extend({ - id: () => generatedId('cred_'), - type: 'username_password', + type: (i) => types[i % types.length], + id() { + switch (this.type) { + case 'ssh_private_key': + return generatedId('credspk_'); + case 'username_password': + return generatedId('credup_'); + } + }, authorized_actions: () => permissions.authorizedActionsFor('credential') || [ 'no-op', diff --git a/addons/api/mirage/serializers/credential.js b/addons/api/mirage/serializers/credential.js index f028e0a86..243255d4d 100644 --- a/addons/api/mirage/serializers/credential.js +++ b/addons/api/mirage/serializers/credential.js @@ -10,9 +10,11 @@ export default ApplicationSerializer.extend({ ); json.credential_store_id = model.credentialStoreId; - // in a real API, the password field is not returned - // so we delete it from the response + // in a real API, the password, private_key, and passphrase + // field is not returned so we delete it from the response delete json.attributes?.password; + delete json.attributes?.private_key; + delete json.attributes?.passphrase; return json; }, diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 8836135ae..b3bb2c7be 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -392,6 +392,7 @@ credential: description: No Credentials available in this credential store. types: username_password: Username & Password + ssh_private_key: Username & Key Pair help: username_password: This host requires a username and password to connect. scope: