You are here

public function AppCredentialControllerBase::generate in Apigee Edge 8

File

src/Entity/Controller/AppCredentialControllerBase.php, line 179

Class

AppCredentialControllerBase
Base class for developer- and company app credential controller services.

Namespace

Drupal\apigee_edge\Entity\Controller

Code

public function generate(array $api_products, AttributesProperty $app_attributes, string $callback_url, array $scopes = [], string $key_expires_in = '-1') : AppCredentialInterface {
  $credential = $this
    ->decorated()
    ->generate($api_products, $app_attributes, $callback_url, $scopes, $key_expires_in);
  $this->eventDispatcher
    ->dispatch(AppCredentialGenerateEvent::EVENT_NAME, new AppCredentialGenerateEvent($this
    ->getAppType(), $this->owner, $this->appName, $credential));

  // By removing app from cache we force reload the credentials as well.
  $this->appCacheByOwner
    ->removeEntities([
    $this->appName,
  ]);
  return $credential;
}