You are here

class HybridCredentials in Apigee Edge 8

The API credentials for HybridCredentials.

Hierarchy

Expanded class hierarchy of HybridCredentials

1 file declares its use of HybridCredentials
SDKConnector.php in src/SDKConnector.php

File

src/Connector/HybridCredentials.php, line 30

Namespace

Drupal\apigee_edge\Connector
View source
class HybridCredentials extends Credentials {

  /**
   * HybridCredentials constructor.
   *
   * @param \Drupal\key\KeyInterface $key
   *   The key entity which stores the API credentials.
   *
   * @throws \InvalidArgumentException
   *   An InvalidArgumentException is thrown if the key type
   *   does not implement EdgeKeyTypeInterface.
   */
  public function __construct(KeyInterface $key) {
    if ($key
      ->getKeyType() instanceof EdgeKeyTypeInterface && ($auth_type = $key
      ->getKeyType()
      ->getAuthenticationType($key)) && ($auth_type === EdgeKeyTypeInterface::EDGE_AUTH_TYPE_JWT || $auth_type === EdgeKeyTypeInterface::EDGE_AUTH_TYPE_DEFAULT_GCE_SERVICE_ACCOUNT)) {
      parent::__construct($key);
    }
    else {
      throw new InvalidArgumentException("The `{$key->id()}` key is not configured for Hybrid Authentication.");
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Credentials::$key protected property The key entity which stores the API credentials.
Credentials::$keyType protected property The key type of the key entity.
Credentials::getAuthentication public function Gets the authentication object which instantiated by the key type. Overrides CredentialsInterface::getAuthentication 1
Credentials::getKey public function Gets the key entity which stores the API credentials. Overrides CredentialsInterface::getKey
Credentials::getKeyType public function Gets the key type of the key entity. Overrides CredentialsInterface::getKeyType
HybridCredentials::__construct public function HybridCredentials constructor. Overrides Credentials::__construct