@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param Iterable $config |
70 | 70 | * @return void |
71 | 71 | */ |
72 | - public function __construct(LoggerInterface $logger, ?Iterable $config=null) |
|
72 | + public function __construct(LoggerInterface $logger, ?Iterable $config = null) |
|
73 | 73 | { |
74 | 74 | $this->logger = $logger; |
75 | 75 | $this->setOptions($config); |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | return $this; |
89 | 89 | } |
90 | 90 | |
91 | - foreach($config as $option => $value) { |
|
92 | - switch($option) { |
|
91 | + foreach ($config as $option => $value) { |
|
92 | + switch ($option) { |
|
93 | 93 | case 'provider_url': |
94 | 94 | case 'token_validation_url': |
95 | 95 | case 'identity_attribute': |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
172 | 172 | curl_close($ch); |
173 | 173 | |
174 | - if($code === 200) { |
|
174 | + if ($code === 200) { |
|
175 | 175 | $discovery = json_decode($result, true); |
176 | 176 | $this->logger->debug('received openid-connect discovery document from ['.$url.']', [ |
177 | 177 | 'category' => get_class($this), |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function verifyToken(string $token): bool |
204 | 204 | { |
205 | - if($this->token_validation_url) { |
|
205 | + if ($this->token_validation_url) { |
|
206 | 206 | $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [ |
207 | 207 | 'category' => get_class($this), |
208 | 208 | ]); |
@@ -257,12 +257,12 @@ discard block |
||
257 | 257 | return false; |
258 | 258 | } |
259 | 259 | |
260 | - if($response['active']) { |
|
260 | + if ($response['active']) { |
|
261 | 261 | $this->logger->debug('successfully verified oauth2 access token via authorization server', [ |
262 | 262 | 'category' => get_class($this), |
263 | 263 | ]); |
264 | 264 | |
265 | - if(!isset($response['username'])) { |
|
265 | + if (!isset($response['username'])) { |
|
266 | 266 | throw new Exception('attribute \'username\' not found in oauth2 response'); |
267 | 267 | } |
268 | 268 | |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param array $response |
283 | 283 | * @return bool |
284 | 284 | */ |
285 | - protected function verifyUserinfo(int $code, ?array $response): bool |
|
285 | + protected function verifyUserinfo(int $code, ? array $response) : bool |
|
286 | 286 | { |
287 | 287 | if ($code === 200) { |
288 | 288 | $attributes = $response; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | 'category' => get_class($this), |
291 | 291 | ]); |
292 | 292 | |
293 | - if(!isset($attributes[$this->identity_attribute])) { |
|
293 | + if (!isset($attributes[$this->identity_attribute])) { |
|
294 | 294 | throw new Exception('identity attribute '.$this->identity_attribute.' not found in oauth2 response'); |
295 | 295 | } |
296 | 296 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function getAttributes(): array |
313 | 313 | { |
314 | - if(count($this->attributes) !== 0) { |
|
314 | + if (count($this->attributes) !== 0) { |
|
315 | 315 | return $this->attributes; |
316 | 316 | } |
317 | 317 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | curl_close($ch); |
334 | 334 | $response = json_decode($result, true); |
335 | 335 | |
336 | - if($code === 200) { |
|
336 | + if ($code === 200) { |
|
337 | 337 | $attributes = json_decode($result, true); |
338 | 338 | $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [ |
339 | 339 | 'category' => get_class($this), |