refactor: 💡 Update passphrase to private_key_passphrase (#1290)
✅ Closes: ICU-5916
This commit is contained in:
1 parent
cb3104a624
commit
83c7b76f48
7 files changed
+30
-30
No files matched your search
@@ -73,7 +73,7 @@ export default class GeneratedCredentialModel extends BaseModel {
|
||||
@attr('string', {
|
||||
for: 'ssh_private_key',
|
||||
isNestedAttribute: true,
|
||||
description: 'The passphrase for credential.',
|
||||
description: 'The private key passphrase for credential.',
|
||||
})
|
||||
passphrase;
|
||||
private_key_passphrase;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ export default class CredentialSerializer extends ApplicationSerializer {
|
||||
const serialized = super.serialize(...arguments);
|
||||
// Remove non-username_password type attributes
|
||||
delete serialized.attributes.private_key;
|
||||
delete serialized.attributes.passphrase;
|
||||
delete serialized.attributes.private_key_passphrase;
|
||||
// Remove password from the payload if null
|
||||
// or empty string. This allows the user to only update
|
||||
// the username without providing the password again.
|
||||
@@ -42,13 +42,13 @@ export default class CredentialSerializer extends ApplicationSerializer {
|
||||
const serialized = super.serialize(...arguments);
|
||||
// Remove non-ssh_private_key type attributes
|
||||
delete serialized.attributes.password;
|
||||
// Remove private_key and/or passphrase from the payload if null
|
||||
// or empty string. This allows the user to only update
|
||||
// Remove private_key and/or private_key_passphrase from the payload
|
||||
// if null or empty string. This allows the user to only update
|
||||
// the username without providing the private key and passphrase again.
|
||||
// Users cannot unset the private key or passphrase, they would have
|
||||
// to delete the credential entirely.
|
||||
if (!serialized?.attributes?.passphrase)
|
||||
delete serialized.attributes.passphrase;
|
||||
if (!serialized?.attributes?.private_key_passphrase)
|
||||
delete serialized.attributes.private_key_passphrase;
|
||||
if (!serialized?.attributes?.private_key)
|
||||
delete serialized.attributes.private_key;
|
||||
return serialized;
|
||||
@@ -57,10 +57,10 @@ export default class CredentialSerializer extends ApplicationSerializer {
|
||||
normalize(typeClass, hash, ...rest) {
|
||||
const normalizedHash = copy(hash, true);
|
||||
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
|
||||
// Remove passphrase as we don't track it after being created/updated
|
||||
normalized.data.attributes.passphrase = '';
|
||||
// Remove secret fields as we don't track them after being created/updated
|
||||
normalized.data.attributes.password = '';
|
||||
normalized.data.attributes.private_key = '';
|
||||
normalized.data.attributes.private_key_passphrase = '';
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user