class AccessTokenRepository in Simple OAuth (OAuth2) & OpenID Connect 8.4
Same name and namespace in other branches
- 8.2 src/Repositories/AccessTokenRepository.php \Drupal\simple_oauth\Repositories\AccessTokenRepository
- 8.3 src/Repositories/AccessTokenRepository.php \Drupal\simple_oauth\Repositories\AccessTokenRepository
- 5.x src/Repositories/AccessTokenRepository.php \Drupal\simple_oauth\Repositories\AccessTokenRepository
The access token repository.
Hierarchy
- class \Drupal\simple_oauth\Repositories\AccessTokenRepository implements \League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface uses RevocableTokenRepositoryTrait
Expanded class hierarchy of AccessTokenRepository
1 string reference to 'AccessTokenRepository'
1 service uses AccessTokenRepository
File
- src/
Repositories/ AccessTokenRepository.php, line 13
Namespace
Drupal\simple_oauth\RepositoriesView source
class AccessTokenRepository implements AccessTokenRepositoryInterface {
use RevocableTokenRepositoryTrait;
/**
* The bundle ID.
*
* @var string
*/
protected static $bundleId = 'access_token';
/**
* The OAuth2 entity class name.
*
* @var string
*/
protected static $entityClass = 'Drupal\\simple_oauth\\Entities\\AccessTokenEntity';
/**
* The OAuth2 entity interface name.
*
* @var string
*/
protected static $entityInterface = 'League\\OAuth2\\Server\\Entities\\AccessTokenEntityInterface';
/**
* {@inheritdoc}
*/
public function persistNewAccessToken(AccessTokenEntityInterface $access_token_entity) {
$this
->persistNew($access_token_entity);
}
/**
* {@inheritdoc}
*/
public function revokeAccessToken($token_id) {
$this
->revoke($token_id);
}
/**
* {@inheritdoc}
*/
public function isAccessTokenRevoked($token_id) {
return $this
->isRevoked($token_id);
}
/**
* {@inheritdoc}
*/
public function getNewToken(ClientEntityInterface $client_entity, array $scopes, $user_identifier = NULL) {
$access_token = new AccessTokenEntity();
$access_token
->setClient($client_entity);
foreach ($scopes as $scope) {
$access_token
->addScope($scope);
}
$access_token
->setUserIdentifier($user_identifier);
return $access_token;
}
}