From f4b05312cdf5aed45ef38deee17e44f464aafef9 Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 22 Jul 2014 21:18:15 +1000 Subject: [PATCH] Fix broken references to auth adapters This was broken in D9999 but somehow didn't fail linting or unit tests. Auditors: epriestley --- resources/sql/patches/20130619.authconf.php | 38 +++++++++---------- .../PhabricatorAuthOneTimeLoginController.php | 2 +- .../PhabricatorAuthRegisterController.php | 2 +- .../PhabricatorEmailLoginController.php | 2 +- .../PhabricatorAuthManagementLDAPWorkflow.php | 2 +- ...abricatorAuthManagementRefreshWorkflow.php | 2 +- .../auth/provider/PhabricatorAuthProvider.php | 2 +- .../provider/PhabricatorJIRAAuthProvider.php | 2 +- .../provider/PhabricatorLDAPAuthProvider.php | 2 +- .../PhabricatorPasswordAuthProvider.php | 4 +- .../DifferentialJIRAIssuesField.php | 8 ++-- .../bridge/DoorkeeperBridgeAsana.php | 2 +- .../bridge/DoorkeeperBridgeJIRA.php | 2 +- .../option/PhabricatorAsanaConfigOptions.php | 2 +- .../remarkup/DoorkeeperRemarkupRuleJIRA.php | 2 +- .../worker/DoorkeeperFeedWorkerAsana.php | 4 +- .../worker/DoorkeeperFeedWorkerJIRA.php | 6 +-- .../PhabricatorPeopleController.php | 2 +- .../PhabricatorPeopleLdapController.php | 2 +- .../people/storage/PhabricatorUser.php | 2 +- src/applications/phame/storage/PhamePost.php | 2 +- src/applications/phame/view/PhamePostView.php | 2 +- .../PhabricatorSettingsPanelPassword.php | 2 +- 23 files changed, 48 insertions(+), 48 deletions(-) diff --git a/resources/sql/patches/20130619.authconf.php b/resources/sql/patches/20130619.authconf.php index 21213b2ecb..0b56735521 100644 --- a/resources/sql/patches/20130619.authconf.php +++ b/resources/sql/patches/20130619.authconf.php @@ -1,7 +1,7 @@ array( + 'PhabricatorLDAPAuthProvider' => array( 'enabled' => 'ldap.auth-enabled', 'registration' => true, 'type' => 'ldap', @@ -16,7 +16,7 @@ $config_map = array( 'type' => 'disqus', 'domain' => 'disqus.com', ), - 'PhabricatorAuthProviderOAuthFacebook' => array( + 'PhabricatorFacebookAuthProvider' => array( 'enabled' => 'facebook.auth-enabled', 'registration' => 'facebook.registration-enabled', 'permanent' => 'facebook.auth-permanent', @@ -43,7 +43,7 @@ $config_map = array( 'type' => 'google', 'domain' => 'google.com', ), - 'PhabricatorAuthProviderPassword' => array( + 'PhabricatorPasswordAuthProvider' => array( 'enabled' => 'auth.password-auth-enabled', 'enabled-default' => false, 'registration' => false, @@ -105,42 +105,42 @@ foreach ($config_map as $provider_class => $spec) { } switch ($provider_class) { - case 'PhabricatorAuthProviderOAuthFacebook': + case 'PhabricatorFacebookAuthProvider': $config->setProperty( - PhabricatorAuthProviderOAuthFacebook::KEY_REQUIRE_SECURE, + PhabricatorFacebookAuthProvider::KEY_REQUIRE_SECURE, (int)PhabricatorEnv::getEnvConfigIfExists( 'facebook.require-https-auth')); break; - case 'PhabricatorAuthProviderLDAP': + case 'PhabricatorLDAPAuthProvider': $ldap_map = array( - PhabricatorAuthProviderLDAP::KEY_HOSTNAME + PhabricatorLDAPAuthProvider::KEY_HOSTNAME => 'ldap.hostname', - PhabricatorAuthProviderLDAP::KEY_PORT + PhabricatorLDAPAuthProvider::KEY_PORT => 'ldap.port', - PhabricatorAuthProviderLDAP::KEY_DISTINGUISHED_NAME + PhabricatorLDAPAuthProvider::KEY_DISTINGUISHED_NAME => 'ldap.base_dn', - PhabricatorAuthProviderLDAP::KEY_SEARCH_ATTRIBUTES + PhabricatorLDAPAuthProvider::KEY_SEARCH_ATTRIBUTES => 'ldap.search_attribute', - PhabricatorAuthProviderLDAP::KEY_USERNAME_ATTRIBUTE + PhabricatorLDAPAuthProvider::KEY_USERNAME_ATTRIBUTE => 'ldap.username-attribute', - PhabricatorAuthProviderLDAP::KEY_REALNAME_ATTRIBUTES + PhabricatorLDAPAuthProvider::KEY_REALNAME_ATTRIBUTES => 'ldap.real_name_attributes', - PhabricatorAuthProviderLDAP::KEY_VERSION + PhabricatorLDAPAuthProvider::KEY_VERSION => 'ldap.version', - PhabricatorAuthProviderLDAP::KEY_REFERRALS + PhabricatorLDAPAuthProvider::KEY_REFERRALS => 'ldap.referrals', - PhabricatorAuthProviderLDAP::KEY_START_TLS + PhabricatorLDAPAuthProvider::KEY_START_TLS => 'ldap.start-tls', - PhabricatorAuthProviderLDAP::KEY_ANONYMOUS_USERNAME + PhabricatorLDAPAuthProvider::KEY_ANONYMOUS_USERNAME => 'ldap.anonymous-user-name', - PhabricatorAuthProviderLDAP::KEY_ANONYMOUS_PASSWORD + PhabricatorLDAPAuthProvider::KEY_ANONYMOUS_PASSWORD => 'ldap.anonymous-user-password', // Update the old "search first" setting to the newer but similar // "always search" setting. - PhabricatorAuthProviderLDAP::KEY_ALWAYS_SEARCH + PhabricatorLDAPAuthProvider::KEY_ALWAYS_SEARCH => 'ldap.search-first', - PhabricatorAuthProviderLDAP::KEY_ACTIVEDIRECTORY_DOMAIN + PhabricatorLDAPAuthProvider::KEY_ACTIVEDIRECTORY_DOMAIN => 'ldap.activedirectory_domain', ); diff --git a/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php b/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php index cb663344b2..12decda80d 100644 --- a/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php +++ b/src/applications/auth/controller/PhabricatorAuthOneTimeLoginController.php @@ -109,7 +109,7 @@ final class PhabricatorAuthOneTimeLoginController unset($unguarded); $next = '/'; - if (!PhabricatorAuthProviderPassword::getPasswordProvider()) { + if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) { $next = '/settings/panel/external/'; } else if (PhabricatorEnv::getEnvConfig('account.editable')) { diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php index 9085e9309a..a481a5df30 100644 --- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php +++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php @@ -494,7 +494,7 @@ final class PhabricatorAuthRegisterController } private function loadSetupAccount() { - $provider = new PhabricatorAuthProviderPassword(); + $provider = new PhabricatorPasswordAuthProvider(); $provider->attachProviderConfig( id(new PhabricatorAuthProviderConfig()) ->setShouldAllowRegistration(1) diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php index 60b006eda2..7ec9ae97b1 100644 --- a/src/applications/auth/controller/PhabricatorEmailLoginController.php +++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php @@ -10,7 +10,7 @@ final class PhabricatorEmailLoginController public function processRequest() { $request = $this->getRequest(); - if (!PhabricatorAuthProviderPassword::getPasswordProvider()) { + if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) { return new Aphront400Response(); } diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php index 85ff0b1e0a..e45d053c60 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php @@ -15,7 +15,7 @@ final class PhabricatorAuthManagementLDAPWorkflow $console = PhutilConsole::getConsole(); $console->getServer()->setEnableLog(true); - $provider = PhabricatorAuthProviderLDAP::getLDAPProvider(); + $provider = PhabricatorLDAPAuthProvider::getLDAPProvider(); if (!$provider) { $console->writeOut( "%s\n", diff --git a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php index 27382eb48b..b05b87f5e8 100644 --- a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php +++ b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php @@ -101,7 +101,7 @@ final class PhabricatorAuthManagementRefreshWorkflow } $provider = $providers[$key]; - if (!($provider instanceof PhabricatorAuthProviderOAuth2)) { + if (!($provider instanceof PhabricatorOAuth2AuthProvider)) { $console->writeOut( "> %s\n", pht('Skipping, provider is not an OAuth2 provider.')); diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php index bc381ad636..380ac89a8e 100644 --- a/src/applications/auth/provider/PhabricatorAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorAuthProvider.php @@ -149,7 +149,7 @@ abstract class PhabricatorAuthProvider { /** * Should we allow the adapter to be marked as "trusted" * This is true for all adapters except those that allow the user to type in - * emails (@see PhabricatorAuthProviderPassword) + * emails (@see PhabricatorPasswordAuthProvider) */ public function shouldAllowEmailTrustConfiguration() { return true; diff --git a/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php b/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php index e0f4a44ac0..c81cbe64aa 100644 --- a/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorJIRAAuthProvider.php @@ -265,7 +265,7 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider { $providers = self::getAllEnabledProviders(); foreach ($providers as $provider) { - if ($provider instanceof PhabricatorAuthProviderOAuth1JIRA) { + if ($provider instanceof PhabricatorJIRAAuthProvider) { return $provider; } } diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php index 5777bfcae8..f5699295a7 100644 --- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php @@ -465,7 +465,7 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider { $providers = self::getAllEnabledProviders(); foreach ($providers as $provider) { - if ($provider instanceof PhabricatorAuthProviderLDAP) { + if ($provider instanceof PhabricatorLDAPAuthProvider) { return $provider; } } diff --git a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php index 85eb451a21..84e53dd501 100644 --- a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php +++ b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php @@ -104,7 +104,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { public function getAdapter() { if (!$this->adapter) { - $adapter = new PhutilAuthAdapterEmpty(); + $adapter = new PhutilEmptyAuthAdapter(); $adapter->setAdapterType('password'); $adapter->setAdapterDomain('self'); $this->adapter = $adapter; @@ -330,7 +330,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider { $providers = self::getAllEnabledProviders(); foreach ($providers as $provider) { - if ($provider instanceof PhabricatorAuthProviderPassword) { + if ($provider instanceof PhabricatorPasswordAuthProvider) { return $provider; } } diff --git a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php index 3d0c6d61ac..8c6f66bb20 100644 --- a/src/applications/differential/customfield/DifferentialJIRAIssuesField.php +++ b/src/applications/differential/customfield/DifferentialJIRAIssuesField.php @@ -14,7 +14,7 @@ final class DifferentialJIRAIssuesField } public function isFieldEnabled() { - return (bool)PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + return (bool)PhabricatorJIRAAuthProvider::getJIRAProvider(); } public function canDisableField() { @@ -66,7 +66,7 @@ final class DifferentialJIRAIssuesField } private function buildDoorkeeperRefs($value) { - $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); $refs = array(); if ($value) { @@ -97,11 +97,11 @@ final class DifferentialJIRAIssuesField } public function shouldAppearInEditView() { - return PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + return PhabricatorJIRAAuthProvider::getJIRAProvider(); } public function shouldAppearInApplicationTransactions() { - return PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + return PhabricatorJIRAAuthProvider::getJIRAProvider(); } public function readValueFromRequest(AphrontRequest $request) { diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgeAsana.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgeAsana.php index 19191eb03c..79e711e00a 100644 --- a/src/applications/doorkeeper/bridge/DoorkeeperBridgeAsana.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgeAsana.php @@ -27,7 +27,7 @@ final class DoorkeeperBridgeAsana extends DoorkeeperBridge { $id_map = mpull($refs, 'getObjectID', 'getObjectKey'); $viewer = $this->getViewer(); - $provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); + $provider = PhabricatorAsanaAuthProvider::getAsanaProvider(); if (!$provider) { return; } diff --git a/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php b/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php index 9698237f1d..6349943770 100644 --- a/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php +++ b/src/applications/doorkeeper/bridge/DoorkeeperBridgeJIRA.php @@ -22,7 +22,7 @@ final class DoorkeeperBridgeJIRA extends DoorkeeperBridge { $id_map = mpull($refs, 'getObjectID', 'getObjectKey'); $viewer = $this->getViewer(); - $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); if (!$provider) { return; } diff --git a/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php b/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php index ca452a5ff8..800d18a287 100644 --- a/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php +++ b/src/applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php @@ -49,7 +49,7 @@ final class PhabricatorAsanaConfigOptions $viewer = $request->getUser(); - $provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); + $provider = PhabricatorAsanaAuthProvider::getAsanaProvider(); if (!$provider) { return null; } diff --git a/src/applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleJIRA.php b/src/applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleJIRA.php index 0eadc6dc45..4f0b46aa06 100644 --- a/src/applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleJIRA.php +++ b/src/applications/doorkeeper/remarkup/DoorkeeperRemarkupRuleJIRA.php @@ -15,7 +15,7 @@ final class DoorkeeperRemarkupRuleJIRA $match_issue = $matches[2]; // TODO: When we support multiple instances, deal with them here. - $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); if (!$provider) { return $matches[0]; } diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php index 804fe18a48..25a6bad994 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php @@ -445,7 +445,7 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker { private function getProvider() { if (!$this->provider) { - $provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); + $provider = PhabricatorAsanaAuthProvider::getAsanaProvider(); if (!$provider) { throw new PhabricatorWorkerPermanentFailureException( 'No Asana provider configured.'); @@ -515,7 +515,7 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker { return $phid_map; } - $provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); + $provider = PhabricatorAsanaAuthProvider::getAsanaProvider(); $accounts = id(new PhabricatorExternalAccountQuery()) ->setViewer(PhabricatorUser::getOmnipotentUser()) diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php index c7ba08dd70..ed75b55126 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerJIRA.php @@ -16,7 +16,7 @@ final class DoorkeeperFeedWorkerJIRA extends DoorkeeperFeedWorker { * This worker is enabled when a JIRA authentication provider is active. */ public function isEnabled() { - return (bool)PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + return (bool)PhabricatorJIRAAuthProvider::getJIRAProvider(); } @@ -105,12 +105,12 @@ final class DoorkeeperFeedWorkerJIRA extends DoorkeeperFeedWorker { /** * Get the active JIRA provider. * - * @return PhabricatorAuthProviderOAuth1JIRA Active JIRA auth provider. + * @return PhabricatorJIRAAuthProvider Active JIRA auth provider. * @task internal */ private function getProvider() { if (!$this->provider) { - $provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); + $provider = PhabricatorJIRAAuthProvider::getJIRAProvider(); if (!$provider) { throw new PhabricatorWorkerPermanentFailureException( 'No JIRA provider configured.'); diff --git a/src/applications/people/controller/PhabricatorPeopleController.php b/src/applications/people/controller/PhabricatorPeopleController.php index ce24c141e9..0061977bfb 100644 --- a/src/applications/people/controller/PhabricatorPeopleController.php +++ b/src/applications/people/controller/PhabricatorPeopleController.php @@ -18,7 +18,7 @@ abstract class PhabricatorPeopleController extends PhabricatorController { if ($viewer->getIsAdmin()) { $nav->addLabel(pht('User Administration')); - if (PhabricatorAuthProviderLDAP::getLDAPProvider()) { + if (PhabricatorLDAPAuthProvider::getLDAPProvider()) { $nav->addFilter('ldap', pht('Import from LDAP')); } diff --git a/src/applications/people/controller/PhabricatorPeopleLdapController.php b/src/applications/people/controller/PhabricatorPeopleLdapController.php index 2e12941788..d373399e04 100644 --- a/src/applications/people/controller/PhabricatorPeopleLdapController.php +++ b/src/applications/people/controller/PhabricatorPeopleLdapController.php @@ -130,7 +130,7 @@ final class PhabricatorPeopleLdapController $search = $request->getStr('query'); - $ldap_provider = PhabricatorAuthProviderLDAP::getLDAPProvider(); + $ldap_provider = PhabricatorLDAPAuthProvider::getLDAPProvider(); if (!$ldap_provider) { throw new Exception('No LDAP provider enabled!'); } diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php index ed9ac15fa0..bef873c09e 100644 --- a/src/applications/people/storage/PhabricatorUser.php +++ b/src/applications/people/storage/PhabricatorUser.php @@ -550,7 +550,7 @@ EOBODY; $new_username = $this->getUserName(); $password_instructions = null; - if (PhabricatorAuthProviderPassword::getPasswordProvider()) { + if (PhabricatorPasswordAuthProvider::getPasswordProvider()) { $engine = new PhabricatorAuthSessionEngine(); $uri = $engine->getOneTimeLoginURI( $this, diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php index c142b1da6c..cb497c61b4 100644 --- a/src/applications/phame/storage/PhamePost.php +++ b/src/applications/phame/storage/PhamePost.php @@ -124,7 +124,7 @@ final class PhamePost extends PhameDAO $options = array(); if ($current == 'facebook' || - PhabricatorAuthProviderOAuthFacebook::getFacebookApplicationID()) { + PhabricatorFacebookAuthProvider::getFacebookApplicationID()) { $options['facebook'] = 'Facebook'; } if ($current == 'disqus' || diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index b816f6206a..5f60b26f18 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -147,7 +147,7 @@ final class PhamePostView extends AphrontView { } private function renderFacebookComments() { - $fb_id = PhabricatorAuthProviderOAuthFacebook::getFacebookApplicationID(); + $fb_id = PhabricatorFacebookAuthProvider::getFacebookApplicationID(); if (!$fb_id) { return null; } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php b/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php index 73c9c490b4..14872a227e 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php @@ -25,7 +25,7 @@ final class PhabricatorSettingsPanelPassword // ...or this install doesn't support password authentication at all. - if (!PhabricatorAuthProviderPassword::getPasswordProvider()) { + if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) { return false; }