@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | ?string $errorUri = null, ?string $state = null) |
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 | $redirectUri = Uri::withQueryValue($redirectUri, '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 | |
54 | 54 | $redirectUri = Uri::withQueryValue($redirectUri, 'error_description', $errorDescription); |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | |
57 | 57 | if ($errorUri) { |
58 | 58 | if ($this->containsNotAsciiChar($errorUri)) { |
59 | - throw new \Exception('Malformed error uri. Expect ascii string. Got : ' . $errorUri); |
|
59 | + throw new \Exception('Malformed error uri. Expect ascii string. Got : '.$errorUri); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $redirectUri = Uri::withQueryValue($redirectUri, 'error_uri', $errorUri); |
63 | 63 | } |
64 | 64 | |
65 | - if($state) { |
|
65 | + if ($state) { |
|
66 | 66 | $redirectUri = Uri::withQueryValue($redirectUri, 'state', $state); |
67 | 67 | } |
68 | 68 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * @return array |
32 | 32 | */ |
33 | 33 | public function handle(ServerRequestInterface $request, ResourceOwnerInterface $resourceOwner, |
34 | - RegisteredClient $client, ?array $scope = null): array; |
|
34 | + RegisteredClient $client, ?array $scope = null): array; |
|
35 | 35 | |
36 | 36 | public function getDefaultResponseMode(): string; |
37 | 37 |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * @return array |
41 | 41 | */ |
42 | 42 | public function handle(ServerRequestInterface $request, ResourceOwnerInterface $resourceOwner, |
43 | - RegisteredClient $client, ?array $scope = null): array |
|
43 | + RegisteredClient $client, ?array $scope = null): array |
|
44 | 44 | { |
45 | 45 | // TODO: Implement handle() method. |
46 | 46 | } |
@@ -71,7 +71,7 @@ |
||
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' |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * @return array |
32 | 32 | */ |
33 | 33 | public function handle(ServerRequestInterface $request, ResourceOwnerInterface $resourceOwner, |
34 | - RegisteredClient $client, ?array $scope = null): array |
|
34 | + RegisteredClient $client, ?array $scope = null): array |
|
35 | 35 | { |
36 | 36 | |
37 | 37 | } |
@@ -221,7 +221,7 @@ |
||
221 | 221 | if (!$scopePolicyManager->checkScope($client, $scope)) { |
222 | 222 | $supportedScopes = implode(', ', $scopePolicyManager->getSupportedScopes($client)); |
223 | 223 | throw new OAuthException('invalid_scope', |
224 | - 'Some of requested scopes are not supported. Scope supported : ' . $supportedScopes, |
|
224 | + 'Some of requested scopes are not supported. Scope supported : '.$supportedScopes, |
|
225 | 225 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
226 | 226 | } |
227 | 227 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $grantType = $this->server->getGrantTypeRepository()->getGrantType($grantTypeName); |
37 | 37 | if (!$grantType) { |
38 | 38 | return new ErrorResponse('unsupported_grant_type', |
39 | - 'Unsupported grant type : ' . $grantTypeName, |
|
39 | + 'Unsupported grant type : '.$grantTypeName, |
|
40 | 40 | 'https://tools.ietf.org/html/rfc6749#section-5.2'); |
41 | 41 | } |
42 | 42 | |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | } catch (OAuthException $e) { |
55 | 55 | if ($e->getError() == 'invalid_client' && $request->hasHeader('Authorization')) { |
56 | 56 | return new ErrorResponse($e->getError(), |
57 | - 'Client authentication failed : ' . $e->getMessage(), |
|
57 | + 'Client authentication failed : '.$e->getMessage(), |
|
58 | 58 | $e->getErrorUri(), 401, [ |
59 | 59 | 'WWW-Authenticate' => 'Basic' |
60 | 60 | ]); |
61 | 61 | } else { |
62 | 62 | return new ErrorResponse($e->getError(), |
63 | - 'Client authentication failed : ' . $e->getMessage(), |
|
63 | + 'Client authentication failed : '.$e->getMessage(), |
|
64 | 64 | $e->getErrorUri(), 401); |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - if(!$client) { |
|
68 | + if (!$client) { |
|
69 | 69 | if (!isset($request->getParsedBody()['client_id'])) { |
70 | 70 | return new ErrorResponse('invalid_request', |
71 | 71 | 'Client authentication not included, missing a parameter : client_id : ', |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if ($client->hasCredentials()) { |
83 | 83 | return new ErrorResponse('invalid_client', |
84 | - 'Client authentication failed : ' . $guard->getError(), |
|
84 | + 'Client authentication failed : '.$guard->getError(), |
|
85 | 85 | 'https://tools.ietf.org/html/rfc6749#section-5.2', 401, [ |
86 | 86 | 'WWW-Authenticate' => 'Basic' |
87 | 87 | ]); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | if (is_array($client->getSupportedGrantTypes()) && !in_array($grantType->getUri(), $client->getSupportedGrantTypes())) { |
92 | 92 | return new ErrorResponse('unauthorized_client', |
93 | - 'Unauthorized grant type : ' . $grantType->getUri(), |
|
93 | + 'Unauthorized grant type : '.$grantType->getUri(), |
|
94 | 94 | 'https://tools.ietf.org/html/rfc6749#section-5.2'); |
95 | 95 | } |
96 | 96 |
@@ -96,8 +96,7 @@ |
||
96 | 96 | |
97 | 97 | try { |
98 | 98 | return $grantType->grant($request, $client); |
99 | - } |
|
100 | - catch (OAuthException $e) { |
|
99 | + } catch (OAuthException $e) { |
|
101 | 100 | return new ErrorResponse($e->getError(), |
102 | 101 | $e->getErrorDescription(), |
103 | 102 | $e->getErrorUri()); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | public function __construct(array $authenticators) |
31 | 31 | { |
32 | - if(!isset($authenticators[ClientPasswordAuthenticator::class])) { |
|
32 | + if (!isset($authenticators[ClientPasswordAuthenticator::class])) { |
|
33 | 33 | throw new \Exception('Authorization server MUST support the HTTP Basic authentication scheme'); |
34 | 34 | } |
35 | 35 | $this->authenticators = $authenticators; |
@@ -34,10 +34,10 @@ discard block |
||
34 | 34 | public function __construct(array $storages) |
35 | 35 | { |
36 | 36 | foreach (self::STORAGES_INTERFACES as $name => $interface) { |
37 | - if(!isset($storages[$name])) { |
|
37 | + if (!isset($storages[$name])) { |
|
38 | 38 | throw new \Exception("Missing storage '$name'"); |
39 | 39 | } |
40 | - if(!is_a($storages[$name], $interface)) { |
|
40 | + if (!is_a($storages[$name], $interface)) { |
|
41 | 41 | throw new \Exception("Storage '$name' must implement '$interface'"); |
42 | 42 | } |
43 | 43 | $this->storages[$name] = $storages[$name]; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @throws \Exception |
51 | 51 | */ |
52 | 52 | public function getStorage(string $name) { |
53 | - if(!isset($this->storages[$name])) { |
|
53 | + if (!isset($this->storages[$name])) { |
|
54 | 54 | throw new \Exception("Unknown storage '$name'"); |
55 | 55 | } |
56 | 56 | return $this->storages[$name]; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function __construct(array $config = []) |
41 | 41 | { |
42 | 42 | if (array_diff(self::MINIMAL_CONFIG, array_keys($config))) { |
43 | - throw new \Exception('Missing minimal configuration. Required : ' . implode(', ', self::MINIMAL_CONFIG)); |
|
43 | + throw new \Exception('Missing minimal configuration. Required : '.implode(', ', self::MINIMAL_CONFIG)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $this->config = array_merge(self::DEFAULT_CONFIG, $config); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @throws \Exception |
53 | 53 | */ |
54 | 54 | public function getConfig(string $name) { |
55 | - if(!array_key_exists($name, $this->config)) { |
|
55 | + if (!array_key_exists($name, $this->config)) { |
|
56 | 56 | throw new \Exception("Unknown config '$name' in ".implode(', ', array_keys($this->config))); |
57 | 57 | } |
58 | 58 | return $this->config[$name]; |