Fix broken references to auth adapters

This was broken in D9999 but somehow didn't fail linting or unit tests.

Auditors: epriestley
This commit is contained in:
Joshua Spence
2014-07-22 21:18:15 +10:00
parent 701bb2ac6e
commit f4b05312cd
23 changed files with 48 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
<?php <?php
$config_map = array( $config_map = array(
'PhabricatorAuthProviderLDAP' => array( 'PhabricatorLDAPAuthProvider' => array(
'enabled' => 'ldap.auth-enabled', 'enabled' => 'ldap.auth-enabled',
'registration' => true, 'registration' => true,
'type' => 'ldap', 'type' => 'ldap',
@@ -16,7 +16,7 @@ $config_map = array(
'type' => 'disqus', 'type' => 'disqus',
'domain' => 'disqus.com', 'domain' => 'disqus.com',
), ),
'PhabricatorAuthProviderOAuthFacebook' => array( 'PhabricatorFacebookAuthProvider' => array(
'enabled' => 'facebook.auth-enabled', 'enabled' => 'facebook.auth-enabled',
'registration' => 'facebook.registration-enabled', 'registration' => 'facebook.registration-enabled',
'permanent' => 'facebook.auth-permanent', 'permanent' => 'facebook.auth-permanent',
@@ -43,7 +43,7 @@ $config_map = array(
'type' => 'google', 'type' => 'google',
'domain' => 'google.com', 'domain' => 'google.com',
), ),
'PhabricatorAuthProviderPassword' => array( 'PhabricatorPasswordAuthProvider' => array(
'enabled' => 'auth.password-auth-enabled', 'enabled' => 'auth.password-auth-enabled',
'enabled-default' => false, 'enabled-default' => false,
'registration' => false, 'registration' => false,
@@ -105,42 +105,42 @@ foreach ($config_map as $provider_class => $spec) {
} }
switch ($provider_class) { switch ($provider_class) {
case 'PhabricatorAuthProviderOAuthFacebook': case 'PhabricatorFacebookAuthProvider':
$config->setProperty( $config->setProperty(
PhabricatorAuthProviderOAuthFacebook::KEY_REQUIRE_SECURE, PhabricatorFacebookAuthProvider::KEY_REQUIRE_SECURE,
(int)PhabricatorEnv::getEnvConfigIfExists( (int)PhabricatorEnv::getEnvConfigIfExists(
'facebook.require-https-auth')); 'facebook.require-https-auth'));
break; break;
case 'PhabricatorAuthProviderLDAP': case 'PhabricatorLDAPAuthProvider':
$ldap_map = array( $ldap_map = array(
PhabricatorAuthProviderLDAP::KEY_HOSTNAME PhabricatorLDAPAuthProvider::KEY_HOSTNAME
=> 'ldap.hostname', => 'ldap.hostname',
PhabricatorAuthProviderLDAP::KEY_PORT PhabricatorLDAPAuthProvider::KEY_PORT
=> 'ldap.port', => 'ldap.port',
PhabricatorAuthProviderLDAP::KEY_DISTINGUISHED_NAME PhabricatorLDAPAuthProvider::KEY_DISTINGUISHED_NAME
=> 'ldap.base_dn', => 'ldap.base_dn',
PhabricatorAuthProviderLDAP::KEY_SEARCH_ATTRIBUTES PhabricatorLDAPAuthProvider::KEY_SEARCH_ATTRIBUTES
=> 'ldap.search_attribute', => 'ldap.search_attribute',
PhabricatorAuthProviderLDAP::KEY_USERNAME_ATTRIBUTE PhabricatorLDAPAuthProvider::KEY_USERNAME_ATTRIBUTE
=> 'ldap.username-attribute', => 'ldap.username-attribute',
PhabricatorAuthProviderLDAP::KEY_REALNAME_ATTRIBUTES PhabricatorLDAPAuthProvider::KEY_REALNAME_ATTRIBUTES
=> 'ldap.real_name_attributes', => 'ldap.real_name_attributes',
PhabricatorAuthProviderLDAP::KEY_VERSION PhabricatorLDAPAuthProvider::KEY_VERSION
=> 'ldap.version', => 'ldap.version',
PhabricatorAuthProviderLDAP::KEY_REFERRALS PhabricatorLDAPAuthProvider::KEY_REFERRALS
=> 'ldap.referrals', => 'ldap.referrals',
PhabricatorAuthProviderLDAP::KEY_START_TLS PhabricatorLDAPAuthProvider::KEY_START_TLS
=> 'ldap.start-tls', => 'ldap.start-tls',
PhabricatorAuthProviderLDAP::KEY_ANONYMOUS_USERNAME PhabricatorLDAPAuthProvider::KEY_ANONYMOUS_USERNAME
=> 'ldap.anonymous-user-name', => 'ldap.anonymous-user-name',
PhabricatorAuthProviderLDAP::KEY_ANONYMOUS_PASSWORD PhabricatorLDAPAuthProvider::KEY_ANONYMOUS_PASSWORD
=> 'ldap.anonymous-user-password', => 'ldap.anonymous-user-password',
// Update the old "search first" setting to the newer but similar // Update the old "search first" setting to the newer but similar
// "always search" setting. // "always search" setting.
PhabricatorAuthProviderLDAP::KEY_ALWAYS_SEARCH PhabricatorLDAPAuthProvider::KEY_ALWAYS_SEARCH
=> 'ldap.search-first', => 'ldap.search-first',
PhabricatorAuthProviderLDAP::KEY_ACTIVEDIRECTORY_DOMAIN PhabricatorLDAPAuthProvider::KEY_ACTIVEDIRECTORY_DOMAIN
=> 'ldap.activedirectory_domain', => 'ldap.activedirectory_domain',
); );

View File

@@ -109,7 +109,7 @@ final class PhabricatorAuthOneTimeLoginController
unset($unguarded); unset($unguarded);
$next = '/'; $next = '/';
if (!PhabricatorAuthProviderPassword::getPasswordProvider()) { if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) {
$next = '/settings/panel/external/'; $next = '/settings/panel/external/';
} else if (PhabricatorEnv::getEnvConfig('account.editable')) { } else if (PhabricatorEnv::getEnvConfig('account.editable')) {

View File

@@ -494,7 +494,7 @@ final class PhabricatorAuthRegisterController
} }
private function loadSetupAccount() { private function loadSetupAccount() {
$provider = new PhabricatorAuthProviderPassword(); $provider = new PhabricatorPasswordAuthProvider();
$provider->attachProviderConfig( $provider->attachProviderConfig(
id(new PhabricatorAuthProviderConfig()) id(new PhabricatorAuthProviderConfig())
->setShouldAllowRegistration(1) ->setShouldAllowRegistration(1)

View File

@@ -10,7 +10,7 @@ final class PhabricatorEmailLoginController
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();
if (!PhabricatorAuthProviderPassword::getPasswordProvider()) { if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) {
return new Aphront400Response(); return new Aphront400Response();
} }

View File

@@ -15,7 +15,7 @@ final class PhabricatorAuthManagementLDAPWorkflow
$console = PhutilConsole::getConsole(); $console = PhutilConsole::getConsole();
$console->getServer()->setEnableLog(true); $console->getServer()->setEnableLog(true);
$provider = PhabricatorAuthProviderLDAP::getLDAPProvider(); $provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
if (!$provider) { if (!$provider) {
$console->writeOut( $console->writeOut(
"%s\n", "%s\n",

View File

@@ -101,7 +101,7 @@ final class PhabricatorAuthManagementRefreshWorkflow
} }
$provider = $providers[$key]; $provider = $providers[$key];
if (!($provider instanceof PhabricatorAuthProviderOAuth2)) { if (!($provider instanceof PhabricatorOAuth2AuthProvider)) {
$console->writeOut( $console->writeOut(
"> %s\n", "> %s\n",
pht('Skipping, provider is not an OAuth2 provider.')); pht('Skipping, provider is not an OAuth2 provider.'));

View File

@@ -149,7 +149,7 @@ abstract class PhabricatorAuthProvider {
/** /**
* Should we allow the adapter to be marked as "trusted" * 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 * This is true for all adapters except those that allow the user to type in
* emails (@see PhabricatorAuthProviderPassword) * emails (@see PhabricatorPasswordAuthProvider)
*/ */
public function shouldAllowEmailTrustConfiguration() { public function shouldAllowEmailTrustConfiguration() {
return true; return true;

View File

@@ -265,7 +265,7 @@ final class PhabricatorJIRAAuthProvider extends PhabricatorOAuth1AuthProvider {
$providers = self::getAllEnabledProviders(); $providers = self::getAllEnabledProviders();
foreach ($providers as $provider) { foreach ($providers as $provider) {
if ($provider instanceof PhabricatorAuthProviderOAuth1JIRA) { if ($provider instanceof PhabricatorJIRAAuthProvider) {
return $provider; return $provider;
} }
} }

View File

@@ -465,7 +465,7 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider {
$providers = self::getAllEnabledProviders(); $providers = self::getAllEnabledProviders();
foreach ($providers as $provider) { foreach ($providers as $provider) {
if ($provider instanceof PhabricatorAuthProviderLDAP) { if ($provider instanceof PhabricatorLDAPAuthProvider) {
return $provider; return $provider;
} }
} }

View File

@@ -104,7 +104,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider {
public function getAdapter() { public function getAdapter() {
if (!$this->adapter) { if (!$this->adapter) {
$adapter = new PhutilAuthAdapterEmpty(); $adapter = new PhutilEmptyAuthAdapter();
$adapter->setAdapterType('password'); $adapter->setAdapterType('password');
$adapter->setAdapterDomain('self'); $adapter->setAdapterDomain('self');
$this->adapter = $adapter; $this->adapter = $adapter;
@@ -330,7 +330,7 @@ final class PhabricatorPasswordAuthProvider extends PhabricatorAuthProvider {
$providers = self::getAllEnabledProviders(); $providers = self::getAllEnabledProviders();
foreach ($providers as $provider) { foreach ($providers as $provider) {
if ($provider instanceof PhabricatorAuthProviderPassword) { if ($provider instanceof PhabricatorPasswordAuthProvider) {
return $provider; return $provider;
} }
} }

View File

@@ -14,7 +14,7 @@ final class DifferentialJIRAIssuesField
} }
public function isFieldEnabled() { public function isFieldEnabled() {
return (bool)PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); return (bool)PhabricatorJIRAAuthProvider::getJIRAProvider();
} }
public function canDisableField() { public function canDisableField() {
@@ -66,7 +66,7 @@ final class DifferentialJIRAIssuesField
} }
private function buildDoorkeeperRefs($value) { private function buildDoorkeeperRefs($value) {
$provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); $provider = PhabricatorJIRAAuthProvider::getJIRAProvider();
$refs = array(); $refs = array();
if ($value) { if ($value) {
@@ -97,11 +97,11 @@ final class DifferentialJIRAIssuesField
} }
public function shouldAppearInEditView() { public function shouldAppearInEditView() {
return PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); return PhabricatorJIRAAuthProvider::getJIRAProvider();
} }
public function shouldAppearInApplicationTransactions() { public function shouldAppearInApplicationTransactions() {
return PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); return PhabricatorJIRAAuthProvider::getJIRAProvider();
} }
public function readValueFromRequest(AphrontRequest $request) { public function readValueFromRequest(AphrontRequest $request) {

View File

@@ -27,7 +27,7 @@ final class DoorkeeperBridgeAsana extends DoorkeeperBridge {
$id_map = mpull($refs, 'getObjectID', 'getObjectKey'); $id_map = mpull($refs, 'getObjectID', 'getObjectKey');
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); $provider = PhabricatorAsanaAuthProvider::getAsanaProvider();
if (!$provider) { if (!$provider) {
return; return;
} }

View File

@@ -22,7 +22,7 @@ final class DoorkeeperBridgeJIRA extends DoorkeeperBridge {
$id_map = mpull($refs, 'getObjectID', 'getObjectKey'); $id_map = mpull($refs, 'getObjectID', 'getObjectKey');
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); $provider = PhabricatorJIRAAuthProvider::getJIRAProvider();
if (!$provider) { if (!$provider) {
return; return;
} }

View File

@@ -49,7 +49,7 @@ final class PhabricatorAsanaConfigOptions
$viewer = $request->getUser(); $viewer = $request->getUser();
$provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); $provider = PhabricatorAsanaAuthProvider::getAsanaProvider();
if (!$provider) { if (!$provider) {
return null; return null;
} }

View File

@@ -15,7 +15,7 @@ final class DoorkeeperRemarkupRuleJIRA
$match_issue = $matches[2]; $match_issue = $matches[2];
// TODO: When we support multiple instances, deal with them here. // TODO: When we support multiple instances, deal with them here.
$provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); $provider = PhabricatorJIRAAuthProvider::getJIRAProvider();
if (!$provider) { if (!$provider) {
return $matches[0]; return $matches[0];
} }

View File

@@ -445,7 +445,7 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker {
private function getProvider() { private function getProvider() {
if (!$this->provider) { if (!$this->provider) {
$provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); $provider = PhabricatorAsanaAuthProvider::getAsanaProvider();
if (!$provider) { if (!$provider) {
throw new PhabricatorWorkerPermanentFailureException( throw new PhabricatorWorkerPermanentFailureException(
'No Asana provider configured.'); 'No Asana provider configured.');
@@ -515,7 +515,7 @@ final class DoorkeeperFeedWorkerAsana extends DoorkeeperFeedWorker {
return $phid_map; return $phid_map;
} }
$provider = PhabricatorAuthProviderOAuthAsana::getAsanaProvider(); $provider = PhabricatorAsanaAuthProvider::getAsanaProvider();
$accounts = id(new PhabricatorExternalAccountQuery()) $accounts = id(new PhabricatorExternalAccountQuery())
->setViewer(PhabricatorUser::getOmnipotentUser()) ->setViewer(PhabricatorUser::getOmnipotentUser())

View File

@@ -16,7 +16,7 @@ final class DoorkeeperFeedWorkerJIRA extends DoorkeeperFeedWorker {
* This worker is enabled when a JIRA authentication provider is active. * This worker is enabled when a JIRA authentication provider is active.
*/ */
public function isEnabled() { 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. * Get the active JIRA provider.
* *
* @return PhabricatorAuthProviderOAuth1JIRA Active JIRA auth provider. * @return PhabricatorJIRAAuthProvider Active JIRA auth provider.
* @task internal * @task internal
*/ */
private function getProvider() { private function getProvider() {
if (!$this->provider) { if (!$this->provider) {
$provider = PhabricatorAuthProviderOAuth1JIRA::getJIRAProvider(); $provider = PhabricatorJIRAAuthProvider::getJIRAProvider();
if (!$provider) { if (!$provider) {
throw new PhabricatorWorkerPermanentFailureException( throw new PhabricatorWorkerPermanentFailureException(
'No JIRA provider configured.'); 'No JIRA provider configured.');

View File

@@ -18,7 +18,7 @@ abstract class PhabricatorPeopleController extends PhabricatorController {
if ($viewer->getIsAdmin()) { if ($viewer->getIsAdmin()) {
$nav->addLabel(pht('User Administration')); $nav->addLabel(pht('User Administration'));
if (PhabricatorAuthProviderLDAP::getLDAPProvider()) { if (PhabricatorLDAPAuthProvider::getLDAPProvider()) {
$nav->addFilter('ldap', pht('Import from LDAP')); $nav->addFilter('ldap', pht('Import from LDAP'));
} }

View File

@@ -130,7 +130,7 @@ final class PhabricatorPeopleLdapController
$search = $request->getStr('query'); $search = $request->getStr('query');
$ldap_provider = PhabricatorAuthProviderLDAP::getLDAPProvider(); $ldap_provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
if (!$ldap_provider) { if (!$ldap_provider) {
throw new Exception('No LDAP provider enabled!'); throw new Exception('No LDAP provider enabled!');
} }

View File

@@ -550,7 +550,7 @@ EOBODY;
$new_username = $this->getUserName(); $new_username = $this->getUserName();
$password_instructions = null; $password_instructions = null;
if (PhabricatorAuthProviderPassword::getPasswordProvider()) { if (PhabricatorPasswordAuthProvider::getPasswordProvider()) {
$engine = new PhabricatorAuthSessionEngine(); $engine = new PhabricatorAuthSessionEngine();
$uri = $engine->getOneTimeLoginURI( $uri = $engine->getOneTimeLoginURI(
$this, $this,

View File

@@ -124,7 +124,7 @@ final class PhamePost extends PhameDAO
$options = array(); $options = array();
if ($current == 'facebook' || if ($current == 'facebook' ||
PhabricatorAuthProviderOAuthFacebook::getFacebookApplicationID()) { PhabricatorFacebookAuthProvider::getFacebookApplicationID()) {
$options['facebook'] = 'Facebook'; $options['facebook'] = 'Facebook';
} }
if ($current == 'disqus' || if ($current == 'disqus' ||

View File

@@ -147,7 +147,7 @@ final class PhamePostView extends AphrontView {
} }
private function renderFacebookComments() { private function renderFacebookComments() {
$fb_id = PhabricatorAuthProviderOAuthFacebook::getFacebookApplicationID(); $fb_id = PhabricatorFacebookAuthProvider::getFacebookApplicationID();
if (!$fb_id) { if (!$fb_id) {
return null; return null;
} }

View File

@@ -25,7 +25,7 @@ final class PhabricatorSettingsPanelPassword
// ...or this install doesn't support password authentication at all. // ...or this install doesn't support password authentication at all.
if (!PhabricatorAuthProviderPassword::getPasswordProvider()) { if (!PhabricatorPasswordAuthProvider::getPasswordProvider()) {
return false; return false;
} }