for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author Alex Bilbie <[email protected]>
* @copyright Copyright (c) Alex Bilbie
* @license http://mit-license.org/
*
* @link https://github.com/thephpleague/oauth2-server
*/
namespace OAuth2ServerExamples\Repositories;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
use OAuth2ServerExamples\Entities\AccessTokenEntity;
class AccessTokenRepository implements AccessTokenRepositoryInterface
{
* {@inheritdoc}
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity)
// Some logic here to save the access token to a database
}
public function revokeAccessToken($tokenId)
// Some logic here to revoke the access token
public function isAccessTokenRevoked($tokenId)
return false; // Access token hasn't been revoked
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
$accessToken = new AccessTokenEntity();
$accessToken->setClient($clientEntity);
foreach ($scopes as $scope) {
$accessToken->addScope($scope);
$accessToken->setUserIdentifier($userIdentifier);
return $accessToken;