ClientEntity.php in Simple OAuth (OAuth2) & OpenID Connect 8.4
File
src/Entities/ClientEntity.php
View source
<?php
namespace Drupal\simple_oauth\Entities;
use Drupal\consumers\Entity\Consumer;
use League\OAuth2\Server\Entities\Traits\ClientTrait;
use League\OAuth2\Server\Entities\Traits\EntityTrait;
class ClientEntity implements ClientEntityInterface {
use EntityTrait, ClientTrait;
protected $entity;
public function __construct(Consumer $entity) {
$this->entity = $entity;
$this
->setIdentifier($entity
->uuid());
$this
->setName($entity
->label());
if ($entity
->hasField('redirect')) {
$this->redirectUri = $entity
->get('redirect')->value;
}
}
public function setName($name) {
$this->name = $name;
}
public function getDrupalEntity() {
return $this->entity;
}
}