@@ -82,7 +82,7 @@ |
||
| 82 | 82 | |
| 83 | 83 | switch ($value['type']) { |
| 84 | 84 | case 'array': |
| 85 | - $arr = (array)$data[$value['attr']]; |
|
| 85 | + $arr = (array)$data[$value['attr']]; |
|
| 86 | 86 | unset($arr['count']); |
| 87 | 87 | $attrs[$attr] = $arr; |
| 88 | 88 | break; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | { |
| 205 | 205 | if($this->token_validation_url) { |
| 206 | 206 | $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [ |
| 207 | - 'category' => get_class($this), |
|
| 207 | + 'category' => get_class($this), |
|
| 208 | 208 | ]); |
| 209 | 209 | |
| 210 | 210 | $url = str_replace('{token}', $token, $this->token_validation_url); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $this->logger->debug('validate token via openid-connect userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [ |
| 218 | - 'category' => get_class($this), |
|
| 218 | + 'category' => get_class($this), |
|
| 219 | 219 | ]); |
| 220 | 220 | |
| 221 | 221 | $url = $discovery['userinfo_endpoint'].'?access_token='.$token; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | if($code === 200) { |
| 233 | 233 | $attributes = json_decode($result, true); |
| 234 | 234 | $this->logger->debug('successfully verified oauth2 access token via authorization server', [ |
| 235 | - 'category' => get_class($this), |
|
| 235 | + 'category' => get_class($this), |
|
| 236 | 236 | ]); |
| 237 | 237 | |
| 238 | 238 | if(!isset($attributes[$this->identity_attribute])) { |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | return true; |
| 251 | 251 | } else { |
| 252 | 252 | $this->logger->error('failed verify oauth2 access token via authorization server, received status ['.$code.']', [ |
| 253 | - 'category' => get_class($this), |
|
| 253 | + 'category' => get_class($this), |
|
| 254 | 254 | ]); |
| 255 | 255 | |
| 256 | 256 | throw new Exception('failed verify oauth2 access token via authorization server'); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | $this->logger->debug('fetch user attributes from userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [ |
| 278 | - 'category' => get_class($this), |
|
| 278 | + 'category' => get_class($this), |
|
| 279 | 279 | ]); |
| 280 | 280 | |
| 281 | 281 | $url = $discovery['userinfo_endpoint'].'?access_token='.$this->access_token; |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | if($code === 200) { |
| 291 | 291 | $attributes = json_decode($result, true); |
| 292 | 292 | $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [ |
| 293 | - 'category' => get_class($this), |
|
| 293 | + 'category' => get_class($this), |
|
| 294 | 294 | ]); |
| 295 | 295 | |
| 296 | 296 | return $this->attributes = $attributes; |
| 297 | 297 | } else { |
| 298 | 298 | $this->logger->error('failed requesting user attributes from userinfo_endpoint, status code ['.$code.']', [ |
| 299 | - 'category' => get_class($this), |
|
| 299 | + 'category' => get_class($this), |
|
| 300 | 300 | ]); |
| 301 | 301 | |
| 302 | 302 | throw new Exception('failed requesting user attribute from userinfo_endpoint'); |
@@ -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 | ]); |
@@ -229,19 +229,19 @@ discard block |
||
| 229 | 229 | curl_close($ch); |
| 230 | 230 | $response = json_decode($result, true); |
| 231 | 231 | |
| 232 | - if($code === 200) { |
|
| 232 | + if ($code === 200) { |
|
| 233 | 233 | $attributes = json_decode($result, true); |
| 234 | 234 | $this->logger->debug('successfully verified oauth2 access token via authorization server', [ |
| 235 | 235 | 'category' => get_class($this), |
| 236 | 236 | ]); |
| 237 | 237 | |
| 238 | - if(!isset($attributes[$this->identity_attribute])) { |
|
| 238 | + if (!isset($attributes[$this->identity_attribute])) { |
|
| 239 | 239 | throw new Exception('identity attribute '.$this->identity_attribute.' not found in oauth2 response'); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $this->identifier = $attributes['preferred_username']; |
| 243 | 243 | |
| 244 | - if($this->token_validation_url) { |
|
| 244 | + if ($this->token_validation_url) { |
|
| 245 | 245 | $this->attributes = $attributes; |
| 246 | 246 | } else { |
| 247 | 247 | $this->access_token = $token; |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | public function getAttributes(): array |
| 267 | 267 | { |
| 268 | - if(count($this->attributes) !== 0) { |
|
| 268 | + if (count($this->attributes) !== 0) { |
|
| 269 | 269 | return $this->attributes; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | curl_close($ch); |
| 288 | 288 | $response = json_decode($result, true); |
| 289 | 289 | |
| 290 | - if($code === 200) { |
|
| 290 | + if ($code === 200) { |
|
| 291 | 291 | $attributes = json_decode($result, true); |
| 292 | 292 | $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [ |
| 293 | 293 | 'category' => get_class($this), |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | protected $account_filter = '(uid=%s)'; |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - public function __construct(LdapServer $ldap, LoggerInterface $logger, ?Iterable $config=null) |
|
| 46 | + public function __construct(LdapServer $ldap, LoggerInterface $logger, ?Iterable $config = null) |
|
| 47 | 47 | { |
| 48 | 48 | $this->logger = $logger; |
| 49 | 49 | $this->ldap = $ldap; |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | * @param Logger $logger |
| 88 | 88 | * @return resource |
| 89 | 89 | */ |
| 90 | - public function __construct(LoggerInterface $logger, ?Iterable $config=null) |
|
| 90 | + public function __construct(LoggerInterface $logger, ?Iterable $config = null) |
|
| 91 | 91 | { |
| 92 | 92 | $this->setOptions($config); |
| 93 | 93 | $this->logger = $logger; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->{$option} = (string)$value; |
| 94 | 94 | break; |
| 95 | 95 | case 'adapter': |
| 96 | - foreach($value as $name => $adapter) { |
|
| 96 | + foreach ($value as $name => $adapter) { |
|
| 97 | 97 | $this->injectAdapter($name, $adapter); |
| 98 | 98 | } |
| 99 | 99 | break; |
@@ -127,13 +127,13 @@ discard block |
||
| 127 | 127 | /** |
| 128 | 128 | * {@inheritDoc} |
| 129 | 129 | */ |
| 130 | - public function injectAdapter($adapter, ?string $name=null) : AdapterAwareInterface |
|
| 130 | + public function injectAdapter($adapter, ?string $name = null) : AdapterAwareInterface |
|
| 131 | 131 | { |
| 132 | - if(!($adapter instanceof AdapterInterface)) { |
|
| 132 | + if (!($adapter instanceof AdapterInterface)) { |
|
| 133 | 133 | throw new Exception('adapter needs to implement AdapterInterface'); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if($name === null) { |
|
| 136 | + if ($name === null) { |
|
| 137 | 137 | $name = get_class($adapter); |
| 138 | 138 | } |
| 139 | 139 | |