abstract class Oauth2ClientPluginBase in OAuth2 Client 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Oauth2Client/Oauth2ClientPluginBase.php \Drupal\oauth2_client\Plugin\Oauth2Client\Oauth2ClientPluginBase
Base class for Oauth2Client plugins.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\oauth2_client\Plugin\Oauth2Client\Oauth2ClientPluginBase implements Oauth2ClientPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of Oauth2ClientPluginBase
File
- src/
Plugin/ Oauth2Client/ Oauth2ClientPluginBase.php, line 13
Namespace
Drupal\oauth2_client\Plugin\Oauth2ClientView source
abstract class Oauth2ClientPluginBase extends PluginBase implements Oauth2ClientPluginInterface {
/**
* The configuration factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a Oauth2ClientPluginBase object.
*
* @param array $configuration
* The plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definitions.
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The configuration factory service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $configFactory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configFactory = $configFactory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function getName() {
$this
->checkKeyDefined('name');
return $this->pluginDefinition['name'];
}
/**
* {@inheritdoc}
*/
public function getId() {
$this
->checkKeyDefined('id');
return $this->pluginDefinition['id'];
}
/**
* {@inheritdoc}
*/
public function getClientId() {
$this
->checkKeyDefined('client_id');
return $this->pluginDefinition['client_id'];
}
/**
* {@inheritdoc}
*/
public function getClientSecret() {
$this
->checkKeyDefined('client_secret');
return $this->pluginDefinition['client_secret'];
}
/**
* {@inheritdoc}
*/
public function getGrantType() {
$this
->checkKeyDefined('grant_type');
return $this->pluginDefinition['grant_type'];
}
/**
* {@inheritdoc}
*/
public function getRedirectUri() {
$this
->checkKeyDefined('redirect_uri');
return $this->pluginDefinition['redirect_uri'];
}
/**
* {@inheritdoc}
*/
public function getAuthorizationUri() {
$this
->checkKeyDefined('authorization_uri');
return $this->pluginDefinition['authorization_uri'];
}
/**
* {@inheritdoc}
*/
public function getTokenUri() {
$this
->checkKeyDefined('token_uri');
return $this->pluginDefinition['token_uri'];
}
/**
* {@inheritdoc}
*/
public function getResourceUri() {
$this
->checkKeyDefined('resource_owner_uri');
return $this->pluginDefinition['resource_owner_uri'];
}
/**
* {@inheritdoc}
*/
public function getScopes() {
if (!isset($this->pluginDefinition['scopes'])) {
return [];
}
return $this->pluginDefinition['scopes'] ?: [];
}
/**
* {@inheritdoc}
*/
public function getScopeSeparator() {
if (!isset($this->pluginDefinition['scope_separator'])) {
return ',';
}
return $this->pluginDefinition['scope_separator'];
}
/**
* {@inheritdoc}
*/
public function getUsername() {
$this
->checkKeyDefined('username');
return $this->pluginDefinition['username'];
}
/**
* {@inheritdoc}
*/
public function getPassword() {
$this
->checkKeyDefined('password');
return $this->pluginDefinition['password'];
}
/**
* Check that a key is defined when requested. Throw an exception if not.
*
* @param string $key
* The key to check.
*
* @throws \Drupal\oauth2_client\Exception\Oauth2ClientPluginMissingKeyException
* Thrown if the key being checked is not defined.
*/
private function checkKeyDefined($key) {
if (!isset($this->pluginDefinition[$key])) {
throw new Oauth2ClientPluginMissingKeyException($key);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
Oauth2ClientPluginBase:: |
protected | property | The configuration factory. | |
Oauth2ClientPluginBase:: |
private | function | Check that a key is defined when requested. Throw an exception if not. | |
Oauth2ClientPluginBase:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the authorization_uri of the OAuth2 server. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the client_id of the OAuth2 server. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the client_secret of the OAuth2 server. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the grant type of the plugin. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the id of the OAuth2 Client plugin. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the human-readable name of the Oauth2 Client plugin. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the password for the account to authenticate with. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the redirect_uri of the OAuth2 server. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the resource_uri of the OAuth2 server. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Get the set of scopes for the provider to use by default. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Get the separator used to join the scopes in the OAuth2 query string. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the token_uri of the OAuth2 server. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Retrieves the username for the account to authenticate with. Overrides Oauth2ClientPluginInterface:: |
|
Oauth2ClientPluginBase:: |
public | function |
Constructs a Oauth2ClientPluginBase object. Overrides PluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |