You are here

public function EdgeKeyTypeBase::getAccountKey in Apigee Edge 8

Return the JSON account key decoded as an array.

Parameters

\Drupal\key\KeyInterface $key: The key entity.

Return value

array The account key as an array.

Overrides EdgeKeyTypeInterface::getAccountKey

1 call to EdgeKeyTypeBase::getAccountKey()
ApigeeAuthKeyType::getAuthenticationMethod in src/Plugin/KeyType/ApigeeAuthKeyType.php
Gets the authentication method object.

File

src/Plugin/EdgeKeyTypeBase.php, line 164

Class

EdgeKeyTypeBase
Defines a base class for Apigee Edge Key Type plugins.

Namespace

Drupal\apigee_edge\Plugin

Code

public function getAccountKey(KeyInterface $key) : array {
  $value = $key
    ->getKeyValues()['account_json_key'] ?? '';
  $json = json_decode($value, TRUE);
  if (empty($json['private_key']) || empty($json['client_email'])) {
    throw new AuthenticationKeyValueMalformedException('account_json_key');
  }
  return $json;
}