feat: 🎸 Add SSH Private Key mirage support (#1261)
* feat: 🎸 Add SSH Private Key mirage support Update mirage to mock SSH Private key credential types ✅ Closes: ICU-5647 * refactor: 💡 remove default case in credential mirage mock
This commit is contained in:
1 parent
50038cdf85
commit
53eef5caeb
3 files changed
+16
-4
No files matched your search
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user