class Credentials in Apigee Edge 8
The API credentials.
@todo: move to \Drupal\apigee_edge\Connector namespace.
Hierarchy
- class \Drupal\apigee_edge\Credentials implements CredentialsInterface
Expanded class hierarchy of Credentials
1 file declares its use of Credentials
- HybridCredentials.php in src/
Connector/ HybridCredentials.php
5 string references to 'Credentials'
- apigee_edge.links.task.yml in ./
apigee_edge.links.task.yml - apigee_edge.links.task.yml
- apigee_edge.routing.yml in ./
apigee_edge.routing.yml - apigee_edge.routing.yml
- apigee_edge_entity_extra_field_info in ./
apigee_edge.module - Implements hook_entity_extra_field_info().
- apigee_edge_teams.links.task.yml in modules/
apigee_edge_teams/ apigee_edge_teams.links.task.yml - modules/apigee_edge_teams/apigee_edge_teams.links.task.yml
- apigee_edge_teams.routing.yml in modules/
apigee_edge_teams/ apigee_edge_teams.routing.yml - modules/apigee_edge_teams/apigee_edge_teams.routing.yml
File
- src/
Credentials.php, line 31
Namespace
Drupal\apigee_edgeView source
class Credentials implements CredentialsInterface {
/**
* The key entity which stores the API credentials.
*
* @var \Drupal\key\KeyInterface
*/
protected $key;
/**
* The key type of the key entity.
*
* @var \Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface
*/
protected $keyType;
/**
* Credentials 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_type = $key
->getKeyType()) instanceof EdgeKeyTypeInterface) {
throw new \InvalidArgumentException("Type of {$key->id()} key does not implement EdgeKeyTypeInterface.");
}
$this->key = $key;
$this->keyType = $key_type;
}
/**
* {@inheritdoc}
*/
public function getAuthentication() : Authentication {
return $this->keyType
->getAuthenticationMethod($this->key);
}
/**
* {@inheritdoc}
*/
public function getKey() : KeyInterface {
return $this->key;
}
/**
* {@inheritdoc}
*/
public function getKeyType() : EdgeKeyTypeInterface {
return $this->keyType;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Credentials:: |
protected | property | The key entity which stores the API credentials. | |
Credentials:: |
protected | property | The key type of the key entity. | |
Credentials:: |
public | function |
Gets the authentication object which instantiated by the key type. Overrides CredentialsInterface:: |
1 |
Credentials:: |
public | function |
Gets the key entity which stores the API credentials. Overrides CredentialsInterface:: |
|
Credentials:: |
public | function |
Gets the key type of the key entity. Overrides CredentialsInterface:: |
|
Credentials:: |
public | function | Credentials constructor. | 2 |