You are here

public function EdgeKeyTypeBase::getUsername in Apigee Edge 8

Gets the API username.

Parameters

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

Return value

string The API username.

Overrides EdgeKeyTypeInterface::getUsername

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

File

src/Plugin/EdgeKeyTypeBase.php, line 123

Class

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

Namespace

Drupal\apigee_edge\Plugin

Code

public function getUsername(KeyInterface $key) : string {
  if (!isset($key
    ->getKeyValues()['username'])) {
    throw new AuthenticationKeyValueMalformedException('username');
  }
  return $key
    ->getKeyValues()['username'];
}