Passed
Push — master ( 9a636e...af59f2 )
by Alexandre
03:34
created
src/OAuth2/Endpoints/TokenEndpoint.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@
 block discarded – undo
88 88
              */
89 89
             $status = 400;
90 90
             $headers = ['Content-Type' => 'application/json'];
91
-            if($e->getError() === 'invalid_client') {
91
+            if ($e->getError() === 'invalid_client') {
92 92
                 $status = 401;
93
-                    if($request->hasHeader('Authorization')) {
93
+                    if ($request->hasHeader('Authorization')) {
94 94
                         $headers['WWW-Authenticate'] = 'Basic';
95 95
                 }
96 96
             }
Please login to merge, or discard this patch.
src/OAuth2/Endpoints/AuthorizationEndpoint.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 
86 86
     function handleRequest(ServerRequestInterface $request): ResponseInterface
87 87
     {
88
-        if($request->getMethod() === 'GET') {
88
+        if ($request->getMethod() === 'GET') {
89 89
             $requestData = $request->getQueryParams();
90 90
         }
91
-        else if($request->getMethod() === 'POST') {
91
+        else if ($request->getMethod() === 'POST') {
92 92
             $requestData = $request->getParsedBody();
93 93
         }
94 94
         else {
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
             $responseData = [
133 133
                 'error' => $e->getError()
134 134
             ];
135
-            if($e->getErrorDescription()) {
135
+            if ($e->getErrorDescription()) {
136 136
                 $responseData['error_description'] = $e->getErrorDescription();
137 137
             }
138
-            if($e->getErrorUri()) {
138
+            if ($e->getErrorUri()) {
139 139
                 $responseData['error_uri'] = $e->getErrorUri();
140 140
             }
141 141
         }
142 142
 
143
-        if(!empty($this->state)) {
143
+        if (!empty($this->state)) {
144 144
             $responseData['state'] = $this->state;
145 145
         }
146 146
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
         $supportedResponseTypes = $this->client->getMetadata()->getResponseTypes() ?: ['code'];
181 181
         foreach (explode(' ', $requestData['response_type']) as $responseType) {
182
-            if(!in_array($responseType, $supportedResponseTypes)) {
182
+            if (!in_array($responseType, $supportedResponseTypes)) {
183 183
             throw new OAuthException('unsupported_response_type',
184 184
                 'The authorization server does not support obtaining an authorization code using this method.',
185 185
                 'https://tools.ietf.org/html/rfc6749#section-4.1');
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
         }
228 228
         try {
229 229
             $redirectUri = new Uri($redirectUri);
230
-            if($redirectUri->getFragment()) {
230
+            if ($redirectUri->getFragment()) {
231 231
                 throw new \InvalidArgumentException('The endpoint URI must not include a fragment component.');
232 232
             }
233 233
             $this->redirectUri = $redirectUri;
Please login to merge, or discard this patch.
src/OAuth2/ClientAuthentication/ClientSecretPostAuthenticationMethod.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
     function authenticate(ServerRequestInterface $request, array $requestData): ?ClientInterface
35 35
     {
36 36
         $client = $this->clientStorage->get($requestData['client_id']);
37
-        if($client instanceof ConfidentialClient && $client->getPassword() == $requestData['client_secret']) {
37
+        if ($client instanceof ConfidentialClient && $client->getPassword() == $requestData['client_secret']) {
38 38
             return $client;
39 39
         }
40 40
         return null;
Please login to merge, or discard this patch.
src/OAuth2OLD/ScopePolicy/Policies/ScopePolicyInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,5 +13,5 @@
 block discarded – undo
13 13
 
14 14
 interface ScopePolicyInterface
15 15
 {
16
-    function getDefaultScopes(ClientInterface $client) : ?array ;
16
+    function getDefaultScopes(ClientInterface $client) : ?array;
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
src/OAuth2/ClientAuthentication/ClientAuthenticationMethodManager.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
         $clientAuthenticationMethodUsed = null;
58 58
 
59 59
         foreach ($this->clientAuthenticationMethods as $identifier => $clientAuthenticationMethod) {
60
-            if($clientAuthenticationMethod->support($request, $requestData))  {
61
-                if($clientAuthenticationMethodUsedIdentifier) {
60
+            if ($clientAuthenticationMethod->support($request, $requestData)) {
61
+                if ($clientAuthenticationMethodUsedIdentifier) {
62 62
                     throw new OAuthException('invalid_request',
63 63
                         'The request utilizes more than one mechanism for authenticating the client.',
64 64
                         'https://tools.ietf.org/html/rfc6749#section-3.2.1');
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
             }
69 69
         }
70 70
 
71
-        if($clientAuthenticationMethodUsed) {
72
-            if(!$client = $clientAuthenticationMethodUsed->authenticate($request, $requestData)) {
71
+        if ($clientAuthenticationMethodUsed) {
72
+            if (!$client = $clientAuthenticationMethodUsed->authenticate($request, $requestData)) {
73 73
                 throw new OAuthException('invalid_client',
74 74
                     'Client authentication failed. Unknown client.',
75 75
                     'https://tools.ietf.org/html/rfc6749#section-3.2.1');
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     'https://tools.ietf.org/html/rfc6749#section-4.1');
86 86
             }
87 87
 
88
-            if($client->hasCredentials()) {
88
+            if ($client->hasCredentials()) {
89 89
                 throw new OAuthException('invalid_client', 'Client authentication failed. No client authentication included',
90 90
                         'https://tools.ietf.org/html/rfc6749#section-3.2.1');
91 91
             }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         }
95 95
 
96 96
         $tokenEndpointAuthMethod = $client->getMetadata()->getTokenEndpointAuthMethod() ?: 'client_secret_basic';
97
-        if($tokenEndpointAuthMethod !== $clientAuthenticationMethodUsedIdentifier) {
97
+        if ($tokenEndpointAuthMethod !== $clientAuthenticationMethodUsedIdentifier) {
98 98
             throw new OAuthException('invalid_client',
99 99
                 'Client authentication failed. Unsupported authentication method.',
100 100
                 'https://tools.ietf.org/html/rfc6749#section-3.2.1');
Please login to merge, or discard this patch.
src/OAuth2/GrantTypes/RefreshTokenGrantType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 {
19 19
     function handleAccessTokenRequest(TokenEndpoint $tokenEndpoint, array $requestData): array
20 20
     {
21
-        if(empty($requestData['refresh_token'])) {
21
+        if (empty($requestData['refresh_token'])) {
22 22
             throw new OAuthException('invalid_request',
23 23
                 'The request is missing the required parameter refresh_token.',
24 24
                 'https://tools.ietf.org/html/rfc7636#section-4.4');
25 25
         }
26 26
 
27 27
         $refreshToken = $this->refreshTokenStorage->get($requestData['refresh_token']);
28
-        if(!$refreshToken || $refreshToken->getClientIdentifier() !== $tokenEndpoint->getClient()->getIdentifier()) {
28
+        if (!$refreshToken || $refreshToken->getClientIdentifier() !== $tokenEndpoint->getClient()->getIdentifier()) {
29 29
             throw new OAuthException('invalid_grant',
30 30
                 'The request includes the invalid parameter refresh_token.',
31 31
                 'https://tools.ietf.org/html/rfc7636#section-4.4');
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
         // TODO Config alwaysRevokeRefreshTokenOnUse
35 35
         $this->refreshTokenStorage->revoke($refreshToken->getToken());
36 36
 
37
-        if($this->refreshTokenStorage->hasExpired($refreshToken)) {
37
+        if ($this->refreshTokenStorage->hasExpired($refreshToken)) {
38 38
             throw new OAuthException('invalid_grant',
39 39
                 'The request includes the invalid parameter refresh_token. The token has expired.',
40 40
                 'https://tools.ietf.org/html/rfc7636#section-4.4');
41 41
         }
42 42
 
43 43
         $scope = $refreshToken->getScope();
44
-        if(!empty($requestData['scope'])) {
45
-            if(!empty(array_diff(
44
+        if (!empty($requestData['scope'])) {
45
+            if (!empty(array_diff(
46 46
                 explode(' ', $requestData['scope']),
47 47
                 explode(' ', $refreshToken->getScope())))) {
48 48
                 throw new OAuthException('invalid_request',
Please login to merge, or discard this patch.