You are here

public static function SalesforceAuthProviderPluginManager::getAuthConfig in Salesforce Suite 8.3

Backwards-compatibility for legacy singleton auth.

Deprecated

BC legacy auth scheme only, do not use, will be removed.

2 calls to SalesforceAuthProviderPluginManager::getAuthConfig()
SalesforceAuthProviderPluginManager::updateAuthConfig in src/SalesforceAuthProviderPluginManager.php
Backwards-compatibility for legacy singleton auth.
SalesforceAuthTokenStorage::service in src/Storage/SalesforceAuthTokenStorage.php
Backwards-compatibility for legacy singleton auth.

File

src/SalesforceAuthProviderPluginManager.php, line 84

Class

SalesforceAuthProviderPluginManager
Auth provider plugin manager.

Namespace

Drupal\salesforce

Code

public static function getAuthConfig() {
  $config = \Drupal::configFactory()
    ->getEditable('salesforce.settings');
  $auth_provider = $config
    ->get('salesforce_auth_provider');
  if (!$auth_provider || !($oauth = SalesforceAuthConfig::load($auth_provider))) {

    // Config to new plugin config system.
    $values = [
      'id' => 'oauth_default',
      'label' => 'OAuth Default',
      'provider' => 'oauth',
    ];
    $oauth = SalesforceAuthConfig::create($values);
    $config
      ->set('salesforce_auth_provider', 'oauth_default')
      ->save();
  }
  return $oauth;
}