You are here

class AuthenticationPluginManager in RESTful 7.2

Authentication plugin manager.

Hierarchy

Expanded class hierarchy of AuthenticationPluginManager

3 files declare their use of AuthenticationPluginManager
AuthenticationManager.php in src/Authentication/AuthenticationManager.php
Contains \Drupal\restful\Authentication\AuthenticationManager
AuthenticationManagerInterface.php in src/Authentication/AuthenticationManagerInterface.php
Contains \Drupal\restful\Authentication\AuthenticationManagerInterface
RestfulAuthenticationTestCase.test in tests/RestfulAuthenticationTestCase.test
Contains RestfulAuthenticationTestCase.

File

src/Plugin/AuthenticationPluginManager.php, line 18
Contains \Drupal\restful\Plugin\AuthenticationPluginManager.

Namespace

Drupal\restful\Plugin
View source
class AuthenticationPluginManager extends DefaultPluginManager {
  use SemiSingletonTrait;

  /**
   * {@inheritdoc}
   */
  protected $defaults = array(
    // Human readable label for the authentication.
    'label' => '',
    // A description of the plugin.
    'description' => '',
    'settings' => array(),
    'id' => '',
  );

  /**
   * Constructs AuthenticationPluginManager.
   *
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \DrupalCacheInterface $cache_backend
   *   Cache backend instance to use.
   */
  public function __construct(\Traversable $namespaces, \DrupalCacheInterface $cache_backend) {
    parent::__construct('Plugin/authentication', $namespaces, 'Drupal\\restful\\Plugin\\authentication\\AuthenticationInterface', '\\Drupal\\restful\\Annotation\\Authentication');
    $this
      ->setCacheBackend($cache_backend, 'authentication_plugins');
    $this
      ->alterInfo('authentication_plugin');
  }

  /**
   * AuthenticationPluginManager factory method.
   *
   * @param string $bin
   *   The cache bin for the plugin manager.
   * @param bool $avoid_singleton
   *   Do not use the stored singleton.
   *
   * @return AuthenticationPluginManager
   *   The created manager.
   */
  public static function create($bin = 'cache', $avoid_singleton = FALSE) {
    $factory = function ($bin) {
      return new static(Module::getNamespaces(), _cache_get_object($bin));
    };
    if ($avoid_singleton) {
      $factory($bin);
    }
    return static::semiSingletonInstance($factory, array(
      $bin,
    ));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AuthenticationPluginManager::$defaults protected property
AuthenticationPluginManager::create public static function AuthenticationPluginManager factory method.
AuthenticationPluginManager::__construct public function Constructs AuthenticationPluginManager.
SemiSingletonTrait::$singleton protected static property The already created manager.
SemiSingletonTrait::semiSingletonInstance protected static function Gets the singleton based on the factory callable.