You are here

public function ResourceServer::__construct in Simple OAuth (OAuth2) & OpenID Connect 5.x

Same name and namespace in other branches
  1. 8.4 src/Server/ResourceServer.php \Drupal\simple_oauth\Server\ResourceServer::__construct()
  2. 8.2 src/Server/ResourceServer.php \Drupal\simple_oauth\Server\ResourceServer::__construct()
  3. 8.3 src/Server/ResourceServer.php \Drupal\simple_oauth\Server\ResourceServer::__construct()

ResourceServer constructor.

File

src/Server/ResourceServer.php, line 49

Class

ResourceServer
The resource server.

Namespace

Drupal\simple_oauth\Server

Code

public function __construct(AccessTokenRepositoryInterface $access_token_repository, ConfigFactoryInterface $config_factory, HttpMessageFactoryInterface $message_factory, HttpFoundationFactoryInterface $foundation_factory) {
  try {
    $public_key = $config_factory
      ->get('simple_oauth.settings')
      ->get('public_key');
    $public_key_real = $this
      ->fileSystem()
      ->realpath($public_key);
    if ($public_key && $public_key_real) {
      $this->subject = new LeageResourceServer($access_token_repository, $public_key_real);
    }
  } catch (\LogicException $exception) {
    trigger_error($exception, E_USER_WARNING);
  }
  $this->messageFactory = $message_factory;
  $this->foundationFactory = $foundation_factory;
}