class HmacWrapper in Acquia Content Hub 8
Wrapper for HMAC.
@package Drupal\acquia_contenthub\Middleware
Hierarchy
- class \Drupal\acquia_contenthub\Middleware\HmacWrapper extends \Acquia\ContentHubClient\Middleware\MiddlewareHmacBase implements \Acquia\ContentHubClient\Middleware\MiddlewareHmacInterface
Expanded class hierarchy of HmacWrapper
1 string reference to 'HmacWrapper'
1 service uses HmacWrapper
File
- src/
Middleware/ HmacWrapper.php, line 14
Namespace
Drupal\acquia_contenthub\MiddlewareView source
class HmacWrapper extends MiddlewareHmacBase implements MiddlewareHmacInterface {
/**
* The Drupal Configuration.
*
* @var \Drupal\Core\Config\Config
*/
protected $config;
/**
* HmacWrapper constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$configFactory = $config_factory;
// Get the content hub config settings.
$this->config = $configFactory
->get('acquia_contenthub.admin_settings');
if (!$this->apiKey) {
$this->apiKey = $this->config
->get('api_key');
}
if (!$this->secretKey) {
$this->secretKey = $this->config
->get('secret_key');
}
}
/**
* Gets the middleware.
*
* @return mixed
* The middleware.
*/
public function getMiddleware() {
// When HMAC V2 is supported, grab the configured version below.
// $version = $config->get('hmac_version');.
$version = 'V1';
$class = "\\Acquia\\ContentHubClient\\Middleware\\MiddlewareHmac" . $version;
$middleware = new $class($this->apiKey, $this->secretKey, $version);
return $middleware
->getMiddleware();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HmacWrapper:: |
protected | property | The Drupal Configuration. | |
HmacWrapper:: |
public | function | Gets the middleware. | |
HmacWrapper:: |
public | function | HmacWrapper constructor. |