class RefreshToken in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 5.x src/Plugin/Oauth2Grant/RefreshToken.php \Drupal\simple_oauth\Plugin\Oauth2Grant\RefreshToken
The refresh token grant plugin.
Plugin annotation
@Oauth2Grant(
id = "refresh_token",
label = @Translation("Refresh Token")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\simple_oauth\Plugin\Oauth2GrantBase implements Oauth2GrantInterface
- class \Drupal\simple_oauth\Plugin\Oauth2Grant\RefreshToken
- class \Drupal\simple_oauth\Plugin\Oauth2GrantBase implements Oauth2GrantInterface
Expanded class hierarchy of RefreshToken
File
- src/
Plugin/ Oauth2Grant/ RefreshToken.php, line 19
Namespace
Drupal\simple_oauth\Plugin\Oauth2GrantView source
class RefreshToken extends Oauth2GrantBase {
/**
* The refresh token repository.
*
* @var \League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface
*/
protected $refreshTokenRepository;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Class constructor.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, RefreshTokenRepositoryInterface $refresh_token_repository, ConfigFactoryInterface $config_factory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->refreshTokenRepository = $refresh_token_repository;
$this->configFactory = $config_factory;
}
/**
* {@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.refresh_token'), $container
->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function getGrantType() {
$grant = new RefreshTokenGrant($this->refreshTokenRepository);
$settings = $this->configFactory
->get('simple_oauth.settings');
$grant
->setRefreshTokenTTL(new \DateInterval(sprintf('PT%dS', $settings
->get('refresh_token_expiration'))));
return $grant;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
RefreshToken:: |
protected | property | The config factory. | |
RefreshToken:: |
protected | property | The refresh token repository. | |
RefreshToken:: |
public static | function |
Creates an instance of the plugin. Overrides Oauth2GrantBase:: |
|
RefreshToken:: |
public | function |
Gets the grant object. Overrides Oauth2GrantInterface:: |
|
RefreshToken:: |
public | function |
Class constructor. Overrides PluginBase:: |