class OauthCredentials in Apigee Edge 8
The API credentials for OAuth.
@todo: move to \Drupal\apigee_edge\Connector namespace.
Hierarchy
- class \Drupal\apigee_edge\Credentials implements CredentialsInterface
- class \Drupal\apigee_edge\OauthCredentials
Expanded class hierarchy of OauthCredentials
File
- src/
OauthCredentials.php, line 32
Namespace
Drupal\apigee_edgeView source
class OauthCredentials extends Credentials {
/**
* OauthCredentials 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_OAUTH) {
parent::__construct($key);
}
else {
throw new InvalidArgumentException("The `{$key->id()}` key is not configured for OAuth.");
}
}
/**
* {@inheritdoc}
*/
public function getAuthentication() : Authentication {
return $this->keyType
->getAuthenticationMethod($this->key);
}
}
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 key entity which stores the API credentials. Overrides CredentialsInterface:: |
|
Credentials:: |
public | function |
Gets the key type of the key entity. Overrides CredentialsInterface:: |
|
OauthCredentials:: |
public | function |
Gets the authentication object which instantiated by the key type. Overrides Credentials:: |
|
OauthCredentials:: |
public | function |
OauthCredentials constructor. Overrides Credentials:: |