@@ -92,8 +92,8 @@ |
||
| 92 | 92 | public function getDefaultScopes(): array |
| 93 | 93 | { |
| 94 | 94 | $result = $this->query() |
| 95 | - ->where('is_default')->is(1) |
|
| 96 | - ->all(); |
|
| 95 | + ->where('is_default')->is(1) |
|
| 96 | + ->all(); |
|
| 97 | 97 | $scopes = []; |
| 98 | 98 | foreach ($result as $row) { |
| 99 | 99 | $scopes[] = Scope::createNewScope( |
@@ -58,14 +58,12 @@ |
||
| 58 | 58 | * @package Platine\Framework\OAuth2\Repository |
| 59 | 59 | * @extends Repository<OauthScope> |
| 60 | 60 | */ |
| 61 | -class ScopeRepository extends Repository implements ScopeRepositoryInterface |
|
| 62 | -{ |
|
| 61 | +class ScopeRepository extends Repository implements ScopeRepositoryInterface { |
|
| 63 | 62 | /** |
| 64 | 63 | * Create new instance |
| 65 | 64 | * @param EntityManager<OauthScope> $manager |
| 66 | 65 | */ |
| 67 | - public function __construct(EntityManager $manager) |
|
| 68 | - { |
|
| 66 | + public function __construct(EntityManager $manager) { |
|
| 69 | 67 | parent::__construct($manager, OauthScope::class); |
| 70 | 68 | } |
| 71 | 69 | |
@@ -79,27 +79,27 @@ discard block |
||
| 79 | 79 | $this->clientService = $clientService; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * {@inheritdoc} |
|
| 84 | - */ |
|
| 82 | + /** |
|
| 83 | + * {@inheritdoc} |
|
| 84 | + */ |
|
| 85 | 85 | public function cleanExpiredTokens(): void |
| 86 | 86 | { |
| 87 | 87 | $this->query()->where('expires')->lte(date('Y-m-d H:i:s')) |
| 88 | - ->delete(); |
|
| 88 | + ->delete(); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * {@inheritdoc} |
|
| 93 | - */ |
|
| 91 | + /** |
|
| 92 | + * {@inheritdoc} |
|
| 93 | + */ |
|
| 94 | 94 | public function deleteToken(BaseToken $token): bool |
| 95 | 95 | { |
| 96 | 96 | return $this->query()->where('refresh_token')->is($token->getToken()) |
| 97 | - ->delete() >= 0; |
|
| 97 | + ->delete() >= 0; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * {@inheritdoc} |
|
| 102 | - */ |
|
| 100 | + /** |
|
| 101 | + * {@inheritdoc} |
|
| 102 | + */ |
|
| 103 | 103 | public function getByToken(string $token): ?BaseToken |
| 104 | 104 | { |
| 105 | 105 | $refreshToken = $this->find($token); |
@@ -121,17 +121,17 @@ discard block |
||
| 121 | 121 | ]); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - /** |
|
| 125 | - * {@inheritdoc} |
|
| 126 | - */ |
|
| 124 | + /** |
|
| 125 | + * {@inheritdoc} |
|
| 126 | + */ |
|
| 127 | 127 | public function isTokenExists(string $token): bool |
| 128 | 128 | { |
| 129 | 129 | return $this->find($token) !== null; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * {@inheritdoc} |
|
| 134 | - */ |
|
| 132 | + /** |
|
| 133 | + * {@inheritdoc} |
|
| 134 | + */ |
|
| 135 | 135 | public function saveRefreshToken(RefreshToken $token): RefreshToken |
| 136 | 136 | { |
| 137 | 137 | $clientId = null; |
@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | * @package Platine\Framework\OAuth2\Repository |
| 62 | 62 | * @extends Repository<OauthRefreshToken> |
| 63 | 63 | */ |
| 64 | -class RefreshTokenRepository extends Repository implements RefreshTokenRepositoryInterface |
|
| 65 | -{ |
|
| 64 | +class RefreshTokenRepository extends Repository implements RefreshTokenRepositoryInterface { |
|
| 66 | 65 | /** |
| 67 | 66 | * The Client Service |
| 68 | 67 | * @var ClientService |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | * @param EntityManager<OauthRefreshToken> $manager |
| 75 | 74 | * @param ClientService $clientService |
| 76 | 75 | */ |
| 77 | - public function __construct(EntityManager $manager, ClientService $clientService) |
|
| 78 | - { |
|
| 76 | + public function __construct(EntityManager $manager, ClientService $clientService) { |
|
| 79 | 77 | parent::__construct($manager, OauthRefreshToken::class); |
| 80 | 78 | $this->clientService = $clientService; |
| 81 | 79 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public function cleanExpiredTokens(): void |
| 86 | 86 | { |
| 87 | 87 | $this->query()->where('expires')->lte(date('Y-m-d H:i:s')) |
| 88 | - ->delete(); |
|
| 88 | + ->delete(); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | public function deleteToken(BaseToken $token): bool |
| 95 | 95 | { |
| 96 | 96 | return $this->query()->where('access_token')->is($token->getToken()) |
| 97 | - ->delete() >= 0; |
|
| 97 | + ->delete() >= 0; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -61,8 +61,7 @@ discard block |
||
| 61 | 61 | * @package Platine\Framework\OAuth2\Repository |
| 62 | 62 | * @extends Repository<OauthAccessToken> |
| 63 | 63 | */ |
| 64 | -class AccessTokenRepository extends Repository implements AccessTokenRepositoryInterface |
|
| 65 | -{ |
|
| 64 | +class AccessTokenRepository extends Repository implements AccessTokenRepositoryInterface { |
|
| 66 | 65 | /** |
| 67 | 66 | * The Client Service |
| 68 | 67 | * @var ClientService |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | * @param EntityManager<OauthAccessToken> $manager |
| 75 | 74 | * @param ClientService $clientService |
| 76 | 75 | */ |
| 77 | - public function __construct(EntityManager $manager, ClientService $clientService) |
|
| 78 | - { |
|
| 76 | + public function __construct(EntityManager $manager, ClientService $clientService) { |
|
| 79 | 77 | parent::__construct($manager, OauthAccessToken::class); |
| 80 | 78 | $this->clientService = $clientService; |
| 81 | 79 | } |
@@ -42,8 +42,7 @@ discard block |
||
| 42 | 42 | * @class TokenRevocationRequestHandler |
| 43 | 43 | * @package Platine\Framework\OAuth2\Handler |
| 44 | 44 | */ |
| 45 | -class TokenRevocationRequestHandler implements RequestHandlerInterface |
|
| 46 | -{ |
|
| 45 | +class TokenRevocationRequestHandler implements RequestHandlerInterface { |
|
| 47 | 46 | /** |
| 48 | 47 | * The Authorization Server |
| 49 | 48 | * @var AuthorizationServerInterface |
@@ -54,8 +53,7 @@ discard block |
||
| 54 | 53 | * Create new instance |
| 55 | 54 | * @param AuthorizationServerInterface $authorizationServer |
| 56 | 55 | */ |
| 57 | - public function __construct(AuthorizationServerInterface $authorizationServer) |
|
| 58 | - { |
|
| 56 | + public function __construct(AuthorizationServerInterface $authorizationServer) { |
|
| 59 | 57 | $this->authorizationServer = $authorizationServer; |
| 60 | 58 | } |
| 61 | 59 | |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | * @class AccessTokenRequestHandler |
| 44 | 44 | * @package Platine\Framework\OAuth2\Handler |
| 45 | 45 | */ |
| 46 | -class AccessTokenRequestHandler implements RequestHandlerInterface |
|
| 47 | -{ |
|
| 46 | +class AccessTokenRequestHandler implements RequestHandlerInterface { |
|
| 48 | 47 | /** |
| 49 | 48 | * The Authorization Server |
| 50 | 49 | * @var AuthorizationServerInterface |
@@ -55,8 +54,7 @@ discard block |
||
| 55 | 54 | * Create new instance |
| 56 | 55 | * @param AuthorizationServerInterface $authorizationServer |
| 57 | 56 | */ |
| 58 | - public function __construct(AuthorizationServerInterface $authorizationServer) |
|
| 59 | - { |
|
| 57 | + public function __construct(AuthorizationServerInterface $authorizationServer) { |
|
| 60 | 58 | $this->authorizationServer = $authorizationServer; |
| 61 | 59 | } |
| 62 | 60 | |
@@ -43,8 +43,7 @@ discard block |
||
| 43 | 43 | * @class AuthorizationRequestHandler |
| 44 | 44 | * @package Platine\Framework\OAuth2\Handler |
| 45 | 45 | */ |
| 46 | -class AuthorizationRequestHandler implements RequestHandlerInterface |
|
| 47 | -{ |
|
| 46 | +class AuthorizationRequestHandler implements RequestHandlerInterface { |
|
| 48 | 47 | /** |
| 49 | 48 | * The Authorization Server |
| 50 | 49 | * @var AuthorizationServerInterface |
@@ -55,8 +54,7 @@ discard block |
||
| 55 | 54 | * Create new instance |
| 56 | 55 | * @param AuthorizationServerInterface $authorizationServer |
| 57 | 56 | */ |
| 58 | - public function __construct(AuthorizationServerInterface $authorizationServer) |
|
| 59 | - { |
|
| 57 | + public function __construct(AuthorizationServerInterface $authorizationServer) { |
|
| 60 | 58 | $this->authorizationServer = $authorizationServer; |
| 61 | 59 | } |
| 62 | 60 | |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | protected function shouldBeProcessed(ServerRequestInterface $request): bool |
| 122 | 122 | { |
| 123 | - //If no route has been match no need check |
|
| 123 | + //If no route has been match no need check |
|
| 124 | 124 | /** @var Route|null $route */ |
| 125 | 125 | $route = $request->getAttribute(Route::class); |
| 126 | 126 | if ($route === null) { |
@@ -49,8 +49,7 @@ |
||
| 49 | 49 | * @package Platine\Framework\OAuth2\Middleware |
| 50 | 50 | * @template T |
| 51 | 51 | */ |
| 52 | -class OauthResourceMiddleware implements MiddlewareInterface |
|
| 53 | -{ |
|
| 52 | +class OauthResourceMiddleware implements MiddlewareInterface { |
|
| 54 | 53 | /** |
| 55 | 54 | * The Resource Server |
| 56 | 55 | * @var ResourceServerInterface |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class TokenOwner |
| 54 | 54 | * @package Platine\Framework\OAuth2\User |
| 55 | 55 | */ |
| 56 | -class TokenOwner implements TokenOwnerInterface |
|
| 57 | -{ |
|
| 56 | +class TokenOwner implements TokenOwnerInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * The owner id |
| 60 | 59 | * @var mixed |
@@ -65,16 +64,14 @@ discard block |
||
| 65 | 64 | * Create new instance |
| 66 | 65 | * @param mixed|null $id |
| 67 | 66 | */ |
| 68 | - public function __construct($id = null) |
|
| 69 | - { |
|
| 67 | + public function __construct($id = null) { |
|
| 70 | 68 | $this->id = $id; |
| 71 | 69 | } |
| 72 | 70 | |
| 73 | 71 | /** |
| 74 | 72 | * {@inheritdoc} |
| 75 | 73 | */ |
| 76 | - public function getOwnerId() |
|
| 77 | - { |
|
| 74 | + public function getOwnerId() { |
|
| 78 | 75 | return $this->id; |
| 79 | 76 | } |
| 80 | 77 | } |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * @class UserAuthentication |
| 57 | 57 | * @package Platine\Framework\OAuth2\User |
| 58 | 58 | */ |
| 59 | -class UserAuthentication implements UserAuthenticationInterface |
|
| 60 | -{ |
|
| 59 | +class UserAuthentication implements UserAuthenticationInterface { |
|
| 61 | 60 | /** |
| 62 | 61 | * The Authentication |
| 63 | 62 | * @var AuthenticationInterface |
@@ -68,8 +67,7 @@ discard block |
||
| 68 | 67 | * Create new instance |
| 69 | 68 | * @param AuthenticationInterface $authentication |
| 70 | 69 | */ |
| 71 | - public function __construct(AuthenticationInterface $authentication) |
|
| 72 | - { |
|
| 70 | + public function __construct(AuthenticationInterface $authentication) { |
|
| 73 | 71 | $this->authentication = $authentication; |
| 74 | 72 | } |
| 75 | 73 | |