@@ -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 |
@@ -97,11 +97,11 @@ |
||
97 | 97 | * @throws \Exception |
98 | 98 | */ |
99 | 99 | public function validate() { |
100 | - if(!$this->responseType) { |
|
100 | + if (!$this->responseType) { |
|
101 | 101 | throw new \Exception('Missing response_type parameter'); |
102 | 102 | } |
103 | 103 | |
104 | - if(!$this->clientId) { |
|
104 | + if (!$this->clientId) { |
|
105 | 105 | throw new \Exception('Missing client_id parameter'); |
106 | 106 | } |
107 | 107 | return true; |
@@ -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' |
@@ -19,12 +19,12 @@ |
||
19 | 19 | public function __construct(array $claims) |
20 | 20 | { |
21 | 21 | $missingClaims = array_diff(self::REQUIRED_CLAIMS, array_keys($claims)); |
22 | - if(!empty($missingClaims)) { |
|
22 | + if (!empty($missingClaims)) { |
|
23 | 23 | throw new \Exception('Missing claims : '.implode(', ', $missingClaims)); |
24 | 24 | } |
25 | 25 | |
26 | 26 | $undefinedClaims = array_diff(array_keys($claims), self::DEFINED_CLAIMS); |
27 | - if(!empty($undefinedClaims)) { |
|
27 | + if (!empty($undefinedClaims)) { |
|
28 | 28 | throw new \Exception('Undefined claims : '.implode(', ', $undefinedClaims)); |
29 | 29 | } |
30 | 30 |
@@ -67,13 +67,13 @@ |
||
67 | 67 | foreach (explode(' ', $data['response_type']) as $responseTypeName) { |
68 | 68 | $responseType = $this->server->getResponseTypeRepository()->getResponseType($responseTypeName); |
69 | 69 | if (!$responseType) { |
70 | - throw new OAuthException('invalid_request', 'Unknown response_type : ' . $responseTypeName); |
|
70 | + throw new OAuthException('invalid_request', 'Unknown response_type : '.$responseTypeName); |
|
71 | 71 | } |
72 | 72 | $responseType->verifyRequest($request); |
73 | 73 | $responseTypes[] = $responseType; |
74 | 74 | } |
75 | 75 | |
76 | - if(empty($responseTypes)) { |
|
76 | + if (empty($responseTypes)) { |
|
77 | 77 | throw new OAuthException('invalid_request', 'Invalid response_type parameter'); |
78 | 78 | } |
79 | 79 | else if (count($responseTypes) == 1) { |
@@ -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 |
@@ -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]; |