Rename PassphraseCredentialType subclasses for consistency
Summary: Ref T5655. Test Plan: `arc unit` + `grep` Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D13266
This commit is contained in:
		| @@ -26,7 +26,7 @@ foreach (new LiskMigrationIterator($table) as $repository) { | ||||
|   if ($proto == 'http' || $proto == 'https' || $proto == 'svn') { | ||||
|     $username = $repository->getDetail('http-login'); | ||||
|     $secret = $repository->getDetail('http-pass'); | ||||
|     $type = PassphraseCredentialTypePassword::CREDENTIAL_TYPE; | ||||
|     $type = PassphrasePasswordCredentialType::CREDENTIAL_TYPE; | ||||
|   } else { | ||||
|     $username = $repository->getDetail('ssh-login'); | ||||
|     if (!$username) { | ||||
| @@ -42,10 +42,10 @@ foreach (new LiskMigrationIterator($table) as $repository) { | ||||
|     $file = $repository->getDetail('ssh-keyfile'); | ||||
|     if ($file) { | ||||
|       $secret = $file; | ||||
|       $type = PassphraseCredentialTypeSSHPrivateKeyFile::CREDENTIAL_TYPE; | ||||
|       $type = PassphraseSSHPrivateKeyFileCredentialType::CREDENTIAL_TYPE; | ||||
|     } else { | ||||
|       $secret = $repository->getDetail('ssh-key'); | ||||
|       $type = PassphraseCredentialTypeSSHPrivateKeyText::CREDENTIAL_TYPE; | ||||
|       $type = PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE; | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -1260,17 +1260,17 @@ phutil_register_library_map(array( | ||||
|     'PassphraseCredentialTransactionEditor' => 'applications/passphrase/editor/PassphraseCredentialTransactionEditor.php', | ||||
|     'PassphraseCredentialTransactionQuery' => 'applications/passphrase/query/PassphraseCredentialTransactionQuery.php', | ||||
|     'PassphraseCredentialType' => 'applications/passphrase/credentialtype/PassphraseCredentialType.php', | ||||
|     'PassphraseCredentialTypePassword' => 'applications/passphrase/credentialtype/PassphraseCredentialTypePassword.php', | ||||
|     'PassphraseCredentialTypeSSHGeneratedKey' => 'applications/passphrase/credentialtype/PassphraseCredentialTypeSSHGeneratedKey.php', | ||||
|     'PassphraseCredentialTypeSSHPrivateKey' => 'applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKey.php', | ||||
|     'PassphraseCredentialTypeSSHPrivateKeyFile' => 'applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKeyFile.php', | ||||
|     'PassphraseCredentialTypeSSHPrivateKeyText' => 'applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKeyText.php', | ||||
|     'PassphraseCredentialViewController' => 'applications/passphrase/controller/PassphraseCredentialViewController.php', | ||||
|     'PassphraseDAO' => 'applications/passphrase/storage/PassphraseDAO.php', | ||||
|     'PassphrasePasswordCredentialType' => 'applications/passphrase/credentialtype/PassphrasePasswordCredentialType.php', | ||||
|     'PassphrasePasswordKey' => 'applications/passphrase/keys/PassphrasePasswordKey.php', | ||||
|     'PassphraseQueryConduitAPIMethod' => 'applications/passphrase/conduit/PassphraseQueryConduitAPIMethod.php', | ||||
|     'PassphraseRemarkupRule' => 'applications/passphrase/remarkup/PassphraseRemarkupRule.php', | ||||
|     'PassphraseSSHGeneratedKeyCredentialType' => 'applications/passphrase/credentialtype/PassphraseSSHGeneratedKeyCredentialType.php', | ||||
|     'PassphraseSSHKey' => 'applications/passphrase/keys/PassphraseSSHKey.php', | ||||
|     'PassphraseSSHPrivateKeyCredentialType' => 'applications/passphrase/credentialtype/PassphraseSSHPrivateKeyCredentialType.php', | ||||
|     'PassphraseSSHPrivateKeyFileCredentialType' => 'applications/passphrase/credentialtype/PassphraseSSHPrivateKeyFileCredentialType.php', | ||||
|     'PassphraseSSHPrivateKeyTextCredentialType' => 'applications/passphrase/credentialtype/PassphraseSSHPrivateKeyTextCredentialType.php', | ||||
|     'PassphraseSchemaSpec' => 'applications/passphrase/storage/PassphraseSchemaSpec.php', | ||||
|     'PassphraseSearchIndexer' => 'applications/passphrase/search/PassphraseSearchIndexer.php', | ||||
|     'PassphraseSecret' => 'applications/passphrase/storage/PassphraseSecret.php', | ||||
| @@ -3933,6 +3933,7 @@ phutil_register_library_map(array( | ||||
|       'DivinerDAO', | ||||
|       'PhabricatorPolicyInterface', | ||||
|       'PhabricatorDestructibleInterface', | ||||
|       'PhabricatorApplicationTransactionInterface', | ||||
|     ), | ||||
|     'DivinerLivePublisher' => 'DivinerPublisher', | ||||
|     'DivinerLiveSymbol' => array( | ||||
| @@ -4641,17 +4642,17 @@ phutil_register_library_map(array( | ||||
|     'PassphraseCredentialTransactionEditor' => 'PhabricatorApplicationTransactionEditor', | ||||
|     'PassphraseCredentialTransactionQuery' => 'PhabricatorApplicationTransactionQuery', | ||||
|     'PassphraseCredentialType' => 'Phobject', | ||||
|     'PassphraseCredentialTypePassword' => 'PassphraseCredentialType', | ||||
|     'PassphraseCredentialTypeSSHGeneratedKey' => 'PassphraseCredentialTypeSSHPrivateKey', | ||||
|     'PassphraseCredentialTypeSSHPrivateKey' => 'PassphraseCredentialType', | ||||
|     'PassphraseCredentialTypeSSHPrivateKeyFile' => 'PassphraseCredentialTypeSSHPrivateKey', | ||||
|     'PassphraseCredentialTypeSSHPrivateKeyText' => 'PassphraseCredentialTypeSSHPrivateKey', | ||||
|     'PassphraseCredentialViewController' => 'PassphraseController', | ||||
|     'PassphraseDAO' => 'PhabricatorLiskDAO', | ||||
|     'PassphrasePasswordCredentialType' => 'PassphraseCredentialType', | ||||
|     'PassphrasePasswordKey' => 'PassphraseAbstractKey', | ||||
|     'PassphraseQueryConduitAPIMethod' => 'PassphraseConduitAPIMethod', | ||||
|     'PassphraseRemarkupRule' => 'PhabricatorObjectRemarkupRule', | ||||
|     'PassphraseSSHGeneratedKeyCredentialType' => 'PassphraseSSHPrivateKeyCredentialType', | ||||
|     'PassphraseSSHKey' => 'PassphraseAbstractKey', | ||||
|     'PassphraseSSHPrivateKeyCredentialType' => 'PassphraseCredentialType', | ||||
|     'PassphraseSSHPrivateKeyFileCredentialType' => 'PassphraseSSHPrivateKeyCredentialType', | ||||
|     'PassphraseSSHPrivateKeyTextCredentialType' => 'PassphraseSSHPrivateKeyCredentialType', | ||||
|     'PassphraseSchemaSpec' => 'PhabricatorConfigSchemaSpec', | ||||
|     'PassphraseSearchIndexer' => 'PhabricatorSearchDocumentIndexer', | ||||
|     'PassphraseSecret' => 'PassphraseDAO', | ||||
|   | ||||
| @@ -591,8 +591,8 @@ final class DiffusionRepositoryCreateController | ||||
|     if ($this->isSSHProtocol($proto)) { | ||||
|       $c_credential->setLabel(pht('SSH Key')); | ||||
|       $c_credential->setCredentialType( | ||||
|         PassphraseCredentialTypeSSHPrivateKeyText::CREDENTIAL_TYPE); | ||||
|       $provides_type = PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE; | ||||
|         PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE); | ||||
|       $provides_type = PassphraseSSHPrivateKeyCredentialType::PROVIDES_TYPE; | ||||
|  | ||||
|       $page->addRemarkupInstructions( | ||||
|         pht( | ||||
| @@ -607,8 +607,8 @@ final class DiffusionRepositoryCreateController | ||||
|       $c_credential->setLabel(pht('Password')); | ||||
|       $c_credential->setAllowNull(true); | ||||
|       $c_credential->setCredentialType( | ||||
|         PassphraseCredentialTypePassword::CREDENTIAL_TYPE); | ||||
|       $provides_type = PassphraseCredentialTypePassword::PROVIDES_TYPE; | ||||
|         PassphrasePasswordCredentialType::CREDENTIAL_TYPE); | ||||
|       $provides_type = PassphrasePasswordCredentialType::PROVIDES_TYPE; | ||||
|  | ||||
|       $page->addRemarkupInstructions( | ||||
|         pht( | ||||
| @@ -663,7 +663,7 @@ final class DiffusionRepositoryCreateController | ||||
|           pht('You must choose an SSH credential to connect over SSH.')); | ||||
|       } | ||||
|  | ||||
|       $ssh_type = PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE; | ||||
|       $ssh_type = PassphraseSSHPrivateKeyCredentialType::PROVIDES_TYPE; | ||||
|       if ($credential->getProvidesType() !== $ssh_type) { | ||||
|         $c_credential->setError(pht('Invalid')); | ||||
|         $page->addPageError( | ||||
| @@ -674,7 +674,7 @@ final class DiffusionRepositoryCreateController | ||||
|  | ||||
|     } else if ($this->isUsernamePasswordProtocol($proto)) { | ||||
|       if ($credential) { | ||||
|         $password_type = PassphraseCredentialTypePassword::PROVIDES_TYPE; | ||||
|         $password_type = PassphrasePasswordCredentialType::PROVIDES_TYPE; | ||||
|         if ($credential->getProvidesType() !== $password_type) { | ||||
|         $c_credential->setError(pht('Invalid')); | ||||
|         $page->addPageError( | ||||
|   | ||||
| @@ -24,7 +24,7 @@ final class DrydockSSHCommandInterface extends DrydockCommandInterface { | ||||
|     } | ||||
|  | ||||
|     if ($credential->getProvidesType() !== | ||||
|       PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) { | ||||
|       PassphraseSSHPrivateKeyCredentialType::PROVIDES_TYPE) { | ||||
|       throw new Exception(pht('Only private key credentials are supported.')); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -16,7 +16,7 @@ final class DrydockSFTPFilesystemInterface extends DrydockFilesystemInterface { | ||||
|       ->executeOne(); | ||||
|  | ||||
|     if ($credential->getProvidesType() !== | ||||
|       PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) { | ||||
|       PassphraseSSHPrivateKeyCredentialType::PROVIDES_TYPE) { | ||||
|       throw new Exception(pht('Only private key credentials are supported.')); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -95,9 +95,9 @@ final class HarbormasterHTTPRequestBuildStepImplementation | ||||
|         'name' => pht('Credentials'), | ||||
|         'type' => 'credential', | ||||
|         'credential.type' | ||||
|           => PassphraseCredentialTypePassword::CREDENTIAL_TYPE, | ||||
|           => PassphrasePasswordCredentialType::CREDENTIAL_TYPE, | ||||
|         'credential.provides' | ||||
|           => PassphraseCredentialTypePassword::PROVIDES_TYPE, | ||||
|           => PassphrasePasswordCredentialType::PROVIDES_TYPE, | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
|   | ||||
| @@ -78,7 +78,7 @@ final class PassphraseQueryConduitAPIMethod | ||||
|       } | ||||
|  | ||||
|       switch ($credential->getCredentialType()) { | ||||
|         case PassphraseCredentialTypeSSHPrivateKeyFile::CREDENTIAL_TYPE: | ||||
|         case PassphraseSSHPrivateKeyFileCredentialType::CREDENTIAL_TYPE: | ||||
|           if ($secret) { | ||||
|             $material['file'] = $secret; | ||||
|           } | ||||
| @@ -86,8 +86,8 @@ final class PassphraseQueryConduitAPIMethod | ||||
|             $material['publicKey'] = $public_key; | ||||
|           } | ||||
|           break; | ||||
|         case PassphraseCredentialTypeSSHGeneratedKey::CREDENTIAL_TYPE: | ||||
|         case PassphraseCredentialTypeSSHPrivateKeyText::CREDENTIAL_TYPE: | ||||
|         case PassphraseSSHGeneratedKeyCredentialType::CREDENTIAL_TYPE: | ||||
|         case PassphraseSSHPrivateKeyTextCredentialType::CREDENTIAL_TYPE: | ||||
|           if ($secret) { | ||||
|             $material['privateKey'] = $secret; | ||||
|           } | ||||
| @@ -95,7 +95,7 @@ final class PassphraseQueryConduitAPIMethod | ||||
|             $material['publicKey'] = $public_key; | ||||
|           } | ||||
|           break; | ||||
|         case PassphraseCredentialTypePassword::CREDENTIAL_TYPE: | ||||
|         case PassphrasePasswordCredentialType::CREDENTIAL_TYPE: | ||||
|           if ($secret) { | ||||
|             $material['password'] = $secret; | ||||
|           } | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| final class PassphraseCredentialTypePassword | ||||
| final class PassphrasePasswordCredentialType | ||||
|   extends PassphraseCredentialType { | ||||
| 
 | ||||
|   const CREDENTIAL_TYPE = 'password'; | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| final class PassphraseCredentialTypeSSHGeneratedKey | ||||
|   extends PassphraseCredentialTypeSSHPrivateKey { | ||||
| final class PassphraseSSHGeneratedKeyCredentialType | ||||
|   extends PassphraseSSHPrivateKeyCredentialType { | ||||
| 
 | ||||
|   const CREDENTIAL_TYPE = 'ssh-generated-key'; | ||||
| 
 | ||||
| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| 
 | ||||
| abstract class PassphraseCredentialTypeSSHPrivateKey | ||||
| abstract class PassphraseSSHPrivateKeyCredentialType | ||||
|   extends PassphraseCredentialType { | ||||
| 
 | ||||
|   const PROVIDES_TYPE = 'provides/ssh-key-file'; | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| final class PassphraseCredentialTypeSSHPrivateKeyFile | ||||
|   extends PassphraseCredentialTypeSSHPrivateKey { | ||||
| final class PassphraseSSHPrivateKeyFileCredentialType | ||||
|   extends PassphraseSSHPrivateKeyCredentialType { | ||||
| 
 | ||||
|   const CREDENTIAL_TYPE = 'ssh-key-file'; | ||||
| 
 | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?php | ||||
| 
 | ||||
| final class PassphraseCredentialTypeSSHPrivateKeyText | ||||
|   extends PassphraseCredentialTypeSSHPrivateKey { | ||||
| final class PassphraseSSHPrivateKeyTextCredentialType | ||||
|   extends PassphraseSSHPrivateKeyCredentialType { | ||||
| 
 | ||||
|   const CREDENTIAL_TYPE = 'ssh-key-text'; | ||||
| 
 | ||||
| @@ -7,7 +7,7 @@ final class PassphrasePasswordKey extends PassphraseAbstractKey { | ||||
|     return $key->loadAndValidateFromPHID( | ||||
|       $phid, | ||||
|       $viewer, | ||||
|       PassphraseCredentialTypePassword::PROVIDES_TYPE); | ||||
|       PassphrasePasswordCredentialType::PROVIDES_TYPE); | ||||
|   } | ||||
|  | ||||
|   public function getPasswordEnvelope() { | ||||
|   | ||||
| @@ -9,13 +9,13 @@ final class PassphraseSSHKey extends PassphraseAbstractKey { | ||||
|     return $key->loadAndValidateFromPHID( | ||||
|       $phid, | ||||
|       $viewer, | ||||
|       PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE); | ||||
|       PassphraseSSHPrivateKeyCredentialType::PROVIDES_TYPE); | ||||
|   } | ||||
|  | ||||
|   public function getKeyfileEnvelope() { | ||||
|     $credential = $this->requireCredential(); | ||||
|  | ||||
|     $file_type = PassphraseCredentialTypeSSHPrivateKeyFile::CREDENTIAL_TYPE; | ||||
|     $file_type = PassphraseSSHPrivateKeyFileCredentialType::CREDENTIAL_TYPE; | ||||
|     if ($credential->getCredentialType() != $file_type) { | ||||
|       // If the credential does not store a file, write the key text out to a | ||||
|       // temporary file so we can pass it to `ssh`. | ||||
|   | ||||
| @@ -19,8 +19,8 @@ final class PhabricatorRepositoryURITestCase | ||||
|     $http_secret = id(new PassphraseSecret())->setSecretData('quack')->save(); | ||||
|  | ||||
|     $http_credential = PassphraseCredential::initializeNewCredential($user) | ||||
|       ->setCredentialType(PassphraseCredentialTypePassword::CREDENTIAL_TYPE) | ||||
|       ->setProvidesType(PassphraseCredentialTypePassword::PROVIDES_TYPE) | ||||
|       ->setCredentialType(PassphrasePasswordCredentialType::CREDENTIAL_TYPE) | ||||
|       ->setProvidesType(PassphrasePasswordCredentialType::PROVIDES_TYPE) | ||||
|       ->setUsername('duck') | ||||
|       ->setSecretID($http_secret->getID()) | ||||
|       ->save(); | ||||
|   | ||||
| @@ -24,7 +24,7 @@ final class PhabricatorStandardCustomFieldCredential | ||||
|  | ||||
|     $all_types = PassphraseCredentialType::getAllProvidesTypes(); | ||||
|     if (!in_array($provides_type, $all_types)) { | ||||
|       $provides_type = PassphraseCredentialTypePassword::PROVIDES_TYPE; | ||||
|       $provides_type = PassphrasePasswordCredentialType::PROVIDES_TYPE; | ||||
|     } | ||||
|  | ||||
|     $credentials = id(new PassphraseCredentialQuery()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Joshua Spence
					Joshua Spence