-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #32 add disable access token saving feature (Orkin)
This PR was squashed before being merged into the 0.1-dev branch. Discussion ---------- add disable access token saving feature `@mtarld` `@chalasr` this is the port of disabled access token saving feature 😉 Commits ------- 03e815d add disable access token saving feature
- Loading branch information
Showing
14 changed files
with
280 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace League\Bundle\OAuth2ServerBundle\Manager\Null; | ||
|
||
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface; | ||
use League\Bundle\OAuth2ServerBundle\Model\AccessToken; | ||
|
||
final class AccessTokenManager implements AccessTokenManagerInterface | ||
{ | ||
public function find(string $identifier): ?AccessToken | ||
{ | ||
return null; | ||
} | ||
|
||
public function save(AccessToken $accessToken): void | ||
{ | ||
} | ||
|
||
public function clearExpired(): int | ||
{ | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace League\Bundle\OAuth2ServerBundle\Repository; | ||
|
||
use League\Bundle\OAuth2ServerBundle\Entity\AccessToken as AccessTokenEntity; | ||
use League\OAuth2\Server\Entities\AccessTokenEntityInterface; | ||
use League\OAuth2\Server\Entities\ClientEntityInterface; | ||
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; | ||
|
||
final class NullAccessTokenRepository implements AccessTokenRepositoryInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null): AccessTokenEntityInterface | ||
{ | ||
/** @var int|string|null $userIdentifier */ | ||
$accessToken = new AccessTokenEntity(); | ||
$accessToken->setClient($clientEntity); | ||
$accessToken->setUserIdentifier($userIdentifier); | ||
|
||
foreach ($scopes as $scope) { | ||
$accessToken->addScope($scope); | ||
} | ||
|
||
return $accessToken; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity): void | ||
{ | ||
// do nothing | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function revokeAccessToken($tokenId): void | ||
{ | ||
// do nothing | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function isAccessTokenRevoked($tokenId): bool | ||
{ | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use function Symfony\Component\DependencyInjection\Loader\Configurator\service; | ||
use League\Bundle\OAuth2ServerBundle\Converter\ScopeConverterInterface; | ||
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface; | ||
use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface; | ||
use League\Bundle\OAuth2ServerBundle\Repository\AccessTokenRepository; | ||
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
|
||
->set('league.oauth2_server.repository.access_token', AccessTokenRepository::class) | ||
->args([ | ||
service(AccessTokenManagerInterface::class), | ||
service(ClientManagerInterface::class), | ||
service(ScopeConverterInterface::class), | ||
]) | ||
->alias(AccessTokenRepositoryInterface::class, 'league.oauth2_server.repository.access_token') | ||
->alias(AccessTokenRepository::class, 'league.oauth2_server.repository.access_token'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface; | ||
use League\Bundle\OAuth2ServerBundle\Manager\Null\AccessTokenManager; | ||
use League\Bundle\OAuth2ServerBundle\Repository\AccessTokenRepository; | ||
use League\Bundle\OAuth2ServerBundle\Repository\NullAccessTokenRepository; | ||
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$container->services() | ||
->set('league.oauth2_server.repository.access_token', NullAccessTokenRepository::class) | ||
->alias(AccessTokenRepositoryInterface::class, 'league.oauth2_server.repository.access_token') | ||
->alias(AccessTokenRepository::class, 'league.oauth2_server.repository.access_token') | ||
|
||
->set('league.oauth2_server.manager.null.access_token', AccessTokenManager::class) | ||
->alias(AccessTokenManagerInterface::class, 'league.oauth2_server.manager.null.access_token') | ||
->alias(AccessTokenManager::class, 'league.oauth2_server.manager.null.access_token'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.