@@ -94,8 +94,7 @@ |
||
94 | 94 | * @class OAuth2ServiceProvider |
95 | 95 | * @package Platine\App\Provider |
96 | 96 | */ |
97 | -class OAuth2ServiceProvider extends ServiceProvider |
|
98 | -{ |
|
97 | +class OAuth2ServiceProvider extends ServiceProvider { |
|
99 | 98 | /** |
100 | 99 | * {@inheritdoc} |
101 | 100 | */ |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ); |
111 | 111 | |
112 | 112 | // Configuration |
113 | - $this->app->bind(Configuration::class, function (ContainerInterface $app) { |
|
113 | + $this->app->bind(Configuration::class, function(ContainerInterface $app) { |
|
114 | 114 | return new Configuration($app->get(Config::class)->get('oauth2', [])); |
115 | 115 | }); |
116 | 116 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function addRoutes(Router $router): void |
171 | 171 | { |
172 | - $router->group('/oauth2', function (Router $router) { |
|
172 | + $router->group('/oauth2', function(Router $router) { |
|
173 | 173 | $router->post('/token', AccessTokenRequestHandler::class, 'oauth2_access_token'); |
174 | 174 | $router->add('/authorize', AuthorizationRequestHandler::class, ['GET', 'POST'], 'oauth2_authorization_code'); |
175 | 175 | $router->post('/revocation', TokenRevocationRequestHandler::class, 'oauth2_revoke_access_token'); |
@@ -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('authorization_code')->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<OauthAuthorizationCode> |
63 | 63 | */ |
64 | -class AuthorizationCodeRepository extends Repository implements AuthorizationCodeRepositoryInterface |
|
65 | -{ |
|
64 | +class AuthorizationCodeRepository extends Repository implements AuthorizationCodeRepositoryInterface { |
|
66 | 65 | /** |
67 | 66 | * The Client Service |
68 | 67 | * @var ClientService |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | * @param EntityManager<OauthAuthorizationCode> $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, OauthAuthorizationCode::class); |
80 | 78 | $this->clientService = $clientService; |
81 | 79 | } |
@@ -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 | } |
@@ -59,8 +59,7 @@ |
||
59 | 59 | * @package Platine\Framework\Task\Command |
60 | 60 | * @template T |
61 | 61 | */ |
62 | -abstract class AbstractCommand extends Command |
|
63 | -{ |
|
62 | +abstract class AbstractCommand extends Command { |
|
64 | 63 | /** |
65 | 64 | * The scheduler instance |
66 | 65 | * @var SchedulerInterface |
@@ -101,7 +101,7 @@ |
||
101 | 101 | * @param string|TaskInterface $task |
102 | 102 | * @return void |
103 | 103 | */ |
104 | - protected function addTask(string|TaskInterface $task): void |
|
104 | + protected function addTask(string | TaskInterface $task): void |
|
105 | 105 | { |
106 | 106 | if (is_string($task)) { |
107 | 107 | $task = $this->createTask($task); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return []; |
151 | 151 | } |
152 | 152 | |
153 | - $policy = new FeaturePermissionPolicy($config); |
|
153 | + $policy = new FeaturePermissionPolicy($config); |
|
154 | 154 | |
155 | 155 | return ['Permissions-Policy' => $policy->headers()]; |
156 | 156 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | return []; |
168 | 168 | } |
169 | 169 | |
170 | - $policy = new StrictTransportSecurityPolicy($config); |
|
170 | + $policy = new StrictTransportSecurityPolicy($config); |
|
171 | 171 | |
172 | 172 | return ['Strict-Transport-Security' => $policy->headers()]; |
173 | 173 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | return []; |
186 | 186 | } |
187 | 187 | |
188 | - $policy = new ClearSiteDataPolicy($config); |
|
188 | + $policy = new ClearSiteDataPolicy($config); |
|
189 | 189 | |
190 | 190 | return ['Clear-Site-Data' => $policy->headers()]; |
191 | 191 | } |
@@ -61,8 +61,7 @@ |
||
61 | 61 | * @package Platine\Framework\Security |
62 | 62 | * @template T |
63 | 63 | */ |
64 | -class SecurityPolicy |
|
65 | -{ |
|
64 | +class SecurityPolicy { |
|
66 | 65 | /** |
67 | 66 | * The nonce's for script-src and style-src |
68 | 67 | * @var array<string, array<string>> |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class StrictTransportSecurityPolicy |
53 | 53 | * @package Platine\Framework\Security\Policy |
54 | 54 | */ |
55 | -class StrictTransportSecurityPolicy extends AbstractPolicy |
|
56 | -{ |
|
55 | +class StrictTransportSecurityPolicy extends AbstractPolicy { |
|
57 | 56 | /** |
58 | 57 | * {@inheritdoc} |
59 | 58 | */ |
@@ -79,7 +79,7 @@ |
||
79 | 79 | $directives = array_intersect_key($config, $this->whitelist); |
80 | 80 | $values = array_filter($directives); |
81 | 81 | |
82 | - $results = array_map(function (string $directive) { |
|
82 | + $results = array_map(function(string $directive) { |
|
83 | 83 | if ($directive === 'execution-contexts') { |
84 | 84 | $directive = 'executionContexts'; |
85 | 85 | } |
@@ -52,8 +52,7 @@ |
||
52 | 52 | * @class ClearSiteDataPolicy |
53 | 53 | * @package Platine\Framework\Security\Policy |
54 | 54 | */ |
55 | -class ClearSiteDataPolicy extends AbstractPolicy |
|
56 | -{ |
|
55 | +class ClearSiteDataPolicy extends AbstractPolicy { |
|
57 | 56 | /** |
58 | 57 | * Clear Site Data white list directives. |
59 | 58 | * @var array<string, bool> |