Completed
Push — master ( 49cbbd...fa99dd )
by Alexandre
06:00
created
OAuth2/ClientAuthentication/Authenticators/ClientPasswordAuthenticator.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,6 @@
 block discarded – undo
9 9
 namespace OAuth2\ClientAuthentication\Authenticators;
10 10
 
11 11
 
12
-use OAuth2\Role\Client\Type\ClientPassword;
13
-use OAuth2\Role\Client\Type\ConfidentialClient;
14 12
 use OAuth2\Roles\ClientInterface;
15 13
 use OAuth2\Roles\Clients\ConfidentialClientInterface;
16 14
 use OAuth2\Storages\ClientStorageInterface;
Please login to merge, or discard this patch.
src/OAuth2/EndpointMessages/Authorization/AuthorizationResponse.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,6 @@
 block discarded – undo
9 9
 namespace OAuth2\EndpointMessages\Authorization;
10 10
 
11 11
 use GuzzleHttp\Psr7\Response;
12
-use GuzzleHttp\Psr7\Uri;
13
-use OAuth2\Credentials\AuthorizationCode;
14 12
 use Psr\Http\Message\UriInterface;
15 13
 
16 14
 
Please login to merge, or discard this patch.
src/OAuth2/EndpointMessages/Token/AccessTokenResponse.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,6 @@
 block discarded – undo
10 10
 
11 11
 
12 12
 use GuzzleHttp\Psr7\Response;
13
-use Psr\Http\Message\UriInterface;
14 13
 
15 14
 /**
16 15
  * Class AccessTokenResponse
Please login to merge, or discard this patch.
src/OAuth2/EndpointMessages/Token/ErrorResponse.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,6 @@
 block discarded – undo
10 10
 
11 11
 
12 12
 use GuzzleHttp\Psr7\Response;
13
-use GuzzleHttp\Psr7\Uri;
14
-use Psr\Http\Message\UriInterface;
15 13
 
16 14
 class ErrorResponse extends Response
17 15
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,25 +37,25 @@
 block discarded – undo
37 37
     public function __construct(string $error, ?string $errorDescription = null, ?string $errorUri = null, int $status = 400, array $headers = [])
38 38
     {
39 39
         if ($this->containsNotAsciiChar($error)) {
40
-            throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error);
40
+            throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error);
41 41
         }
42 42
 
43 43
         if (!in_array($error, self::errors)) {
44
-            throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors));
44
+            throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors));
45 45
         }
46 46
 
47 47
         $data = ['error' => $error];
48 48
 
49 49
         if ($errorDescription) {
50 50
             if ($this->containsNotAsciiChar($errorDescription)) {
51
-                throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $errorDescription);
51
+                throw new \Exception('Malformed error description. Expect ascii string. Got : '.$errorDescription);
52 52
             }
53 53
             $data['error_description'] = $errorDescription;
54 54
         }
55 55
 
56 56
         if ($errorUri) {
57 57
             if ($this->containsNotAsciiChar($errorUri)) {
58
-                throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri);
58
+                throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri);
59 59
             }
60 60
 
61 61
             $data['error_uri'] = $errorUri;
Please login to merge, or discard this patch.
src/OAuth2/OpenID/ResponseTypes/CodeResponseType.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 use OAuth2\Config;
13 13
 use OAuth2\Exceptions\OAuthException;
14 14
 use OAuth2\Repositories\ConfigurationRepository;
15
-use OAuth2\ResponseTypes\ResponseTypeInterface;
16 15
 use OAuth2\Roles\Clients\RegisteredClient;
17 16
 use OAuth2\Roles\ResourceOwnerInterface;
18 17
 use OAuth2\Storages\AuthorizationCodeStorageInterface;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
             );
72 72
         }
73 73
 
74
-        if(!$state && $this->configurationRepository->getConfig(Config::ENFORCE_STATE)) {
74
+        if (!$state && $this->configurationRepository->getConfig(Config::ENFORCE_STATE)) {
75 75
             throw new OAuthException('invalid_request',
76 76
                 'Missing a required parameter : state',
77 77
                 'http://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint'
Please login to merge, or discard this patch.
src/Old/Endpoint/Server/Authorization.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -10,20 +10,16 @@
 block discarded – undo
10 10
 
11 11
 use GuzzleHttp\Psr7\Response;
12 12
 use GuzzleHttp\Psr7\Uri;
13
-use OAuth2\Credential\AuthorizationCode;
14 13
 use OAuth2\Endpoint\Config;
15 14
 use OAuth2\Endpoint\Endpoint;
16 15
 use OAuth2\Endpoint\Server\Messages\Authorization\AuthorizationRequest as AuthorizationRequest;
17
-use OAuth2\Endpoint\Server\Messages\Authorization\AuthorizationResponse as AuthorizationResponse;
18 16
 use OAuth2\Endpoint\Server\Messages\Authorization\ErrorResponse;
19 17
 use OAuth2\Exception\MissingResourceOwnerDecision;
20 18
 use OAuth2\Exception\ResourceOwnerNotAuthenticatedException;
21 19
 use OAuth2\ResponseType\ResponseTypeInterface;
22
-use OAuth2\Storage\ClientStorage;
23 20
 use OAuth2\Role\Client\RegisteredClient;
24 21
 use OAuth2\Role\Client\Type\ClientPassword;
25 22
 use OAuth2\Role\Client\Type\PublicClient;
26
-use OAuth2\Role\Client\WebApplication;
27 23
 use OAuth2\Role\ResourceOwner;
28 24
 
29 25
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
             $responseTypes = [];
176 176
             foreach (explode(' ', $request->getResponseType()) as $responseTypeRequested) {
177 177
                 $responseType = $this->server->getResponseType($responseTypeRequested);
178
-                if(!$responseType) {
178
+                if (!$responseType) {
179 179
                     return new ErrorResponse($redirectUri, 'unsupported_response_type', 'Invalid response_type parameter',
180 180
                         'https://tools.ietf.org/html/rfc6749#section-3.1.1');
181 181
                 }
182 182
 
183
-                if($responseType->isImplicit()) {
183
+                if ($responseType->isImplicit()) {
184 184
                     $isImplicitResponseType = true;
185 185
                 }
186 186
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
             $params['state'] = $request->getState();
237 237
         }
238 238
 
239
-        if($isImplicitResponseType) {
239
+        if ($isImplicitResponseType) {
240 240
             $redirectUri = $redirectUri->withFragment(http_build_query($params));
241 241
         }
242 242
         else {
Please login to merge, or discard this patch.
src/Old/Endpoint/Server/Message/AccessToken/ErrorResponse.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,6 @@
 block discarded – undo
10 10
 
11 11
 
12 12
 use GuzzleHttp\Psr7\Response;
13
-use GuzzleHttp\Psr7\Uri;
14
-use Psr\Http\Message\UriInterface;
15 13
 
16 14
 class ErrorResponse extends Response
17 15
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,25 +36,25 @@
 block discarded – undo
36 36
     public function __construct(string $error, ?string $errorDescription = null, ?string $errorUri = null, int $status = 400, array $headers = [])
37 37
     {
38 38
         if ($this->containsNotAsciiChar($error)) {
39
-            throw new \Exception('Malformed error type. Expect ascii string. Got : ' . $error);
39
+            throw new \Exception('Malformed error type. Expect ascii string. Got : '.$error);
40 40
         }
41 41
 
42 42
         if (!in_array($error, self::errors)) {
43
-            throw new \Exception('Unexpected error type. Expect one of : ' . implode(', ', self::errors));
43
+            throw new \Exception('Unexpected error type. Expect one of : '.implode(', ', self::errors));
44 44
         }
45 45
 
46 46
         $data = ['error' => $error];
47 47
 
48 48
         if ($errorDescription) {
49 49
             if ($this->containsNotAsciiChar($errorDescription)) {
50
-                throw new \Exception('Malformed error description. Expect ascii string. Got : ' . $errorDescription);
50
+                throw new \Exception('Malformed error description. Expect ascii string. Got : '.$errorDescription);
51 51
             }
52 52
             $data['error_description'] = $errorDescription;
53 53
         }
54 54
 
55 55
         if ($errorUri) {
56 56
             if ($this->containsNotAsciiChar($errorUri)) {
57
-                throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri);
57
+                throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri);
58 58
             }
59 59
 
60 60
             $data['error_uri'] = $errorDescription;
Please login to merge, or discard this patch.
src/Old/Endpoint/Server/Server.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 use OAuth2\Storage\AuthorizationCodeStorage;
19 19
 use OAuth2\Storage\ClientStorage;
20 20
 use OAuth2\Role\Client\RegisteredClient;
21
-use OAuth2\Role\Client\Type\ClientPassword;
22 21
 use Psr\Http\Message\ServerRequestInterface;
23 22
 
24 23
 class Server
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
     {
91 91
         foreach (self::STORAGES as $name => $class) {
92 92
             if (!isset($storages[$name])) {
93
-                throw new \Exception('Missing storage "' . $name . '"');
93
+                throw new \Exception('Missing storage "'.$name.'"');
94 94
             }
95 95
             if (!is_a($storages[$name], $class)) {
96
-                throw new \Exception('Storage "' . $name . '" must implement interface "' . $class . '"');
96
+                throw new \Exception('Storage "'.$name.'" must implement interface "'.$class.'"');
97 97
             }
98 98
         }
99 99
 
100 100
         if (array_diff(self::MINIMAL_CONFIG, array_keys($config))) {
101
-            throw new \Exception('Missing minimal configuration. Required : ' . implode(', ', self::MINIMAL_CONFIG));
101
+            throw new \Exception('Missing minimal configuration. Required : '.implode(', ', self::MINIMAL_CONFIG));
102 102
         }
103 103
 
104 104
         $this->config = array_merge(self::DEFAULT_CONFIG, $config);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public function getConfig(string $name)
148 148
     {
149
-        if(!isset($this->config[$name])) {
149
+        if (!isset($this->config[$name])) {
150 150
             throw new \Exception('Config with name "'.$name.'" not found');
151 151
         }
152 152
         return $this->config[$name];
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     public function authenticate(ServerRequestInterface $request)
393 393
     {
394 394
         $this->client = $this->guard->authenticate($request);
395
-        return (bool)$this->client;
395
+        return (bool) $this->client;
396 396
     }
397 397
 
398 398
     /**
Please login to merge, or discard this patch.
src/Old/Endpoint/Server/Token.php 2 patches
Unused Use Statements   -8 removed lines patch added patch discarded remove patch
@@ -11,19 +11,11 @@
 block discarded – undo
11 11
 use GuzzleHttp\Psr7\Uri;
12 12
 use OAuth2\Credential\AccessToken;
13 13
 use OAuth2\Credential\RefreshToken;
14
-use OAuth2\Credential\TokenType\BearerToken;
15
-use OAuth2\Endpoint\Config;
16 14
 use OAuth2\Endpoint\Server\Messages\AccessToken\AccessTokenRequest;
17 15
 use OAuth2\Endpoint\Server\Messages\AccessToken\AccessTokenResponse;
18
-use OAuth2\Endpoint\Server\Messages\Authorization\AuthorizationRequest;
19 16
 use OAuth2\Endpoint\Server\Messages\AccessToken\ErrorResponse;
20
-use OAuth2\GrantType\AuthorizationCode;
21 17
 use OAuth2\GrantType\InvalidGrantType;
22
-use OAuth2\Storage\ClientStorage;
23 18
 use OAuth2\Role\Client;
24
-use OAuth2\Role\Client\RegisteredClient;
25
-use OAuth2\Role\Client\Type\ClientPassword;
26
-use Psr\Http\Message\ServerRequestInterface;
27 19
 
28 20
 
29 21
 /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@
 block discarded – undo
167 167
         try {
168 168
             $redirectUri = $grantType->grant($request, $client);
169 169
         }
170
-        catch(InvalidGrantType $e) {
170
+        catch (InvalidGrantType $e) {
171 171
             return new ErrorResponse('invalid_grant', $e->getErrorDescription(), $e->getErrorUri());
172 172
         }
173 173
 
Please login to merge, or discard this patch.