You are here

public function AuthorizationCode::__construct in Simple OAuth (OAuth2) & OpenID Connect 8.2

Same name and namespace in other branches
  1. 8.3 simple_oauth_extras/src/Plugin/Oauth2Grant/AuthorizationCode.php \Drupal\simple_oauth_extras\Plugin\Oauth2Grant\AuthorizationCode::__construct()

Class constructor.

Overrides PluginBase::__construct

File

simple_oauth_extras/src/Plugin/Oauth2Grant/AuthorizationCode.php, line 39

Class

AuthorizationCode
Plugin annotation @Oauth2Grant( id = "authorization_code", label = @Translation("Authorization Code") )

Namespace

Drupal\simple_oauth_extras\Plugin\Oauth2Grant

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, AuthCodeRepositoryInterface $auth_code_repository, RefreshTokenRepositoryInterface $refresh_token_repository, ConfigFactoryInterface $config_factory) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $settings = $config_factory
    ->get('simple_oauth.settings');
  $this->authCodeRepository = $auth_code_repository;
  $this->refreshTokenRepository = $refresh_token_repository;

  // TODO: Make this configurable and not just the same as the access toke expiration.
  $this->authCodeExpiration = new \DateInterval(sprintf('PT%dS', $settings
    ->get('access_token_expiration')));
}