Completed
Push — master ( c1a2da...091d0a )
by Raffael
02:04
created
src/Auth/Adapter/Oidc.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         if($this->token_validation_url) {
191 191
             $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [
192
-               'category' => get_class($this),
192
+                'category' => get_class($this),
193 193
             ]);
194 194
 
195 195
             $url = str_replace('{token}', $token, $this->token_validation_url);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             }
201 201
 
202 202
             $this->logger->debug('validate token via openid-connect userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [
203
-               'category' => get_class($this),
203
+                'category' => get_class($this),
204 204
             ]);
205 205
         
206 206
             $url = $discovery['userinfo_endpoint'].'?access_token='.$token;
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         if($code === 200) {
218 218
             $attributes = json_decode($result, true);
219 219
             $this->logger->debug('successfully verified oauth2 access token via authorization server', [
220
-               'category' => get_class($this),
220
+                'category' => get_class($this),
221 221
             ]);
222 222
         
223 223
             if(!isset($attributes[$this->identity_attribute])) {
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             return true;
236 236
         } else {
237 237
             $this->logger->error('failed verify oauth2 access token via authorization server, received status ['.$code.']', [
238
-               'category' => get_class($this),
238
+                'category' => get_class($this),
239 239
             ]);
240 240
             
241 241
             throw new Exception('failed verify oauth2 access token via authorization server');
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         }
261 261
 
262 262
         $this->logger->debug('fetch user attributes from userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [
263
-           'category' => get_class($this),
263
+            'category' => get_class($this),
264 264
         ]);
265 265
         
266 266
         $url = $discovery['userinfo_endpoint'].'?access_token='.$this->access_token;
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
         if($code === 200) {
276 276
             $attributes = json_decode($result, true);
277 277
             $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [
278
-               'category' => get_class($this),
278
+                'category' => get_class($this),
279 279
             ]);
280 280
         
281 281
             return $this->attributes = $attributes;    
282 282
         } else {
283 283
             $this->logger->error('failed requesting user attributes from userinfo_endpoint, status code ['.$code.']', [
284
-               'category' => get_class($this),
284
+                'category' => get_class($this),
285 285
             ]);
286 286
             
287 287
             throw new Exception('failed requesting user attribute from userinfo_endpoint');
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
             return $this;
75 75
         }
76 76
 
77
-        foreach($config as $option => $value) {
78
-            switch($option) {
77
+        foreach ($config as $option => $value) {
78
+            switch ($option) {
79 79
                 case 'provider_url':
80 80
                 case 'token_validation_url':
81 81
                 case 'identity_attribute':
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
157 157
             curl_close($ch);
158 158
 
159
-            if($code === 200) {
159
+            if ($code === 200) {
160 160
                 $discovery = json_decode($result, true);
161 161
                 $this->logger->debug('received openid-connect discovery document from ['.$url.']', [
162 162
                     'category' => get_class($this),
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     protected function verifyToken(string $token): bool
189 189
     {
190
-        if($this->token_validation_url) {
190
+        if ($this->token_validation_url) {
191 191
             $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [
192 192
                'category' => get_class($this),
193 193
             ]);
@@ -214,19 +214,19 @@  discard block
 block discarded – undo
214 214
         curl_close($ch);
215 215
         $response = json_decode($result, true);
216 216
         
217
-        if($code === 200) {
217
+        if ($code === 200) {
218 218
             $attributes = json_decode($result, true);
219 219
             $this->logger->debug('successfully verified oauth2 access token via authorization server', [
220 220
                'category' => get_class($this),
221 221
             ]);
222 222
         
223
-            if(!isset($attributes[$this->identity_attribute])) {
223
+            if (!isset($attributes[$this->identity_attribute])) {
224 224
                 throw new Exception('identity attribute '.$this->identity_attribute.' not found in oauth2 response');
225 225
             }
226 226
 
227 227
             $this->identifier = $attributes['preferred_username'];
228 228
         
229
-            if($this->token_validation_url) {
229
+            if ($this->token_validation_url) {
230 230
                 $this->attributes = $attributes;    
231 231
             } else {
232 232
                 $this->access_token = $token;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function getAttributes(): array
252 252
     {
253
-        if(count($this->attributes) !== 0) {
253
+        if (count($this->attributes) !== 0) {
254 254
             return $this->attributes;
255 255
         }
256 256
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         curl_close($ch);
273 273
         $response = json_decode($result, true);
274 274
         
275
-        if($code === 200) {
275
+        if ($code === 200) {
276 276
             $attributes = json_decode($result, true);
277 277
             $this->logger->debug('successfully requested user attributes from userinfo_endpoint', [
278 278
                'category' => get_class($this),
Please login to merge, or discard this patch.