You are here

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

Same name and namespace in other branches
  1. 8.4 src/Plugin/Oauth2Grant/Implicit.php \Drupal\simple_oauth\Plugin\Oauth2Grant\Implicit::__construct()

Class constructor.

Overrides PluginBase::__construct

File

src/Plugin/Oauth2Grant/Implicit.php, line 31

Class

Implicit
The implicit grant plugin.

Namespace

Drupal\simple_oauth\Plugin\Oauth2Grant

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) {

  // If the implicit grant is not enabled, then bail.
  $enabled = $config_factory
    ->get('simple_oauth.settings')
    ->get('use_implicit');
  if (!$enabled) {
    throw new PluginNotFoundException('implicit');
  }
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $settings = $config_factory
    ->get('simple_oauth.settings');
  $this->expiration = new \DateInterval(sprintf('PT%dS', $settings
    ->get('access_token_expiration')));
}