class AuthorizationCode in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 5.x src/Plugin/Oauth2Grant/AuthorizationCode.php \Drupal\simple_oauth\Plugin\Oauth2Grant\AuthorizationCode
The authorization code grant plugin.
Plugin annotation
@Oauth2Grant(
id = "authorization_code",
label = @Translation("Authorization Code")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\simple_oauth\Plugin\Oauth2GrantBase implements Oauth2GrantInterface
- class \Drupal\simple_oauth\Plugin\Oauth2Grant\AuthorizationCode
- class \Drupal\simple_oauth\Plugin\Oauth2GrantBase implements Oauth2GrantInterface
Expanded class hierarchy of AuthorizationCode
File
- src/
Plugin/ Oauth2Grant/ AuthorizationCode.php, line 20
Namespace
Drupal\simple_oauth\Plugin\Oauth2GrantView source
class AuthorizationCode extends Oauth2GrantBase {
/**
* The authorization code repository.
*
* @var \League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface
*/
protected $authCodeRepository;
/**
* The refresh token repository.
*
* @var \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface
*/
protected $refreshTokenRepository;
/**
* The expiration for the code.
*
* @var \DateTime
*/
protected $authCodeExpiration;
/**
* Class constructor.
*/
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;
$this->authCodeExpiration = new \DateInterval(sprintf('PT%dS', $settings
->get('authorization_code_expiration')));
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('simple_oauth.repositories.auth_code'), $container
->get('simple_oauth.repositories.refresh_token'), $container
->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function getGrantType() {
return new AuthCodeGrant($this->authCodeRepository, $this->refreshTokenRepository, $this->authCodeExpiration);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AuthorizationCode:: |
protected | property | The expiration for the code. | |
AuthorizationCode:: |
protected | property | The authorization code repository. | |
AuthorizationCode:: |
protected | property | The refresh token repository. | |
AuthorizationCode:: |
public static | function |
Creates an instance of the plugin. Overrides Oauth2GrantBase:: |
|
AuthorizationCode:: |
public | function |
Gets the grant object. Overrides Oauth2GrantInterface:: |
|
AuthorizationCode:: |
public | function |
Class constructor. Overrides PluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. |