@@ -73,25 +73,25 @@ discard block |
||
| 73 | 73 | ]; |
| 74 | 74 | |
| 75 | 75 | // todo, include if auth_time is marked as an essential claim by the client otherwise it is optional (conf ?) |
| 76 | - if(isset($data['max_age']) && $data['max_age']) { |
|
| 76 | + if (isset($data['max_age']) && $data['max_age']) { |
|
| 77 | 77 | $claims['auth_time'] = $resourceOwner->getTimeWhenAuthenticationOccured(); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if(isset($data['nonce']) && !is_null($data['nonce'])) { |
|
| 80 | + if (isset($data['nonce']) && !is_null($data['nonce'])) { |
|
| 81 | 81 | $claims['nonce'] = $data['nonce']; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if(empty($extendedResponseTypes)) { |
|
| 84 | + if (empty($extendedResponseTypes)) { |
|
| 85 | 85 | $standardClaims = $this->userInfoClaimsStorage->getClaims($resourceOwner); |
| 86 | 86 | |
| 87 | 87 | foreach ($this->userInfoClaimsStorage->getClaimsByScope($scope) as $claimRequested) { |
| 88 | - if(isset($standardClaims[$claimRequested]) && $standardClaims[$claimRequested]) { |
|
| 88 | + if (isset($standardClaims[$claimRequested]) && $standardClaims[$claimRequested]) { |
|
| 89 | 89 | $claims[$claimRequested] = $standardClaims[$claimRequested]; |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if(isset($extendedResponseTypes['code'])) { |
|
| 94 | + if (isset($extendedResponseTypes['code'])) { |
|
| 95 | 95 | //c_hash |
| 96 | 96 | /** |
| 97 | 97 | * @var \OAuth2\ResponseTypes\ResponseTypeInterface $responseType |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $claims['c_hash'] = 'todo'; //todo |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if(isset($extendedResponseTypes['token'])) { |
|
| 105 | + if (isset($extendedResponseTypes['token'])) { |
|
| 106 | 106 | //at_hash |
| 107 | 107 | /** |
| 108 | 108 | * @var \OAuth2\ResponseTypes\ResponseTypeInterface $responseType |
@@ -111,8 +111,7 @@ |
||
| 111 | 111 | $token = $responseType->handle($request, $resourceOwner, $client, $scope)['token']; |
| 112 | 112 | $result['token'] = $token; |
| 113 | 113 | $claims['at_hash'] = 'todo'; //todo |
| 114 | - } |
|
| 115 | - else { |
|
| 114 | + } else { |
|
| 116 | 115 | $requestedScopes = isset($data['scope']) ? explode(' ', $data['scope']) : []; |
| 117 | 116 | |
| 118 | 117 | if ((empty($requestedScopes) && !is_null($scope)) || (is_array($scope) && !empty(array_diff($requestedScopes, $scope)))) { |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $certsRepository = $this->sqlOauth->getRepository(Cert::class); |
| 47 | 47 | |
| 48 | 48 | $actualCerts = $certsRepository->findBy([], ['createdAt' => 'DESC'], 2); |
| 49 | - if(!isset($actualCerts[0])) { |
|
| 49 | + if (!isset($actualCerts[0])) { |
|
| 50 | 50 | list('privKey' => $privKey, 'pubKey' => $pubKey, 'rsa' => $rsa) = $this->generateRSAKeys(); |
| 51 | 51 | |
| 52 | 52 | $oldCert = new Cert(); |
@@ -142,22 +142,22 @@ |
||
| 142 | 142 | function jsonSerialize() |
| 143 | 143 | { |
| 144 | 144 | $data = []; |
| 145 | - if($this->formatted) { |
|
| 145 | + if ($this->formatted) { |
|
| 146 | 146 | $data['formatted'] = $this->formatted; |
| 147 | 147 | } |
| 148 | - if($this->streetAddress) { |
|
| 148 | + if ($this->streetAddress) { |
|
| 149 | 149 | $data['street_address'] = $this->streetAddress; |
| 150 | 150 | } |
| 151 | - if($this->locality) { |
|
| 151 | + if ($this->locality) { |
|
| 152 | 152 | $data['locality'] = $this->locality; |
| 153 | 153 | } |
| 154 | - if($this->region) { |
|
| 154 | + if ($this->region) { |
|
| 155 | 155 | $data['region'] = $this->region; |
| 156 | 156 | } |
| 157 | - if($this->postalCode) { |
|
| 157 | + if ($this->postalCode) { |
|
| 158 | 158 | $data['postal_code'] = $this->postalCode; |
| 159 | 159 | } |
| 160 | - if($this->country) { |
|
| 160 | + if ($this->country) { |
|
| 161 | 161 | $data['country'] = $this->country; |
| 162 | 162 | } |
| 163 | 163 | return empty($data) ? '' : json_encode($data); |
@@ -445,7 +445,7 @@ |
||
| 445 | 445 | { |
| 446 | 446 | $getter = 'get'.ucfirst($this->snakeToCamel($offset)); |
| 447 | 447 | $result = $this->{$getter}(); |
| 448 | - if(is_object($result)) { |
|
| 448 | + if (is_object($result)) { |
|
| 449 | 449 | return json_encode($result); |
| 450 | 450 | } |
| 451 | 451 | return $result; |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | public function __construct(array $storages) |
| 35 | 35 | { |
| 36 | 36 | foreach (static::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]; |