Passed
Branch feature/remove-ocra-v1 (68bd7c)
by Pieter van der
04:02
created
library/tiqr/Tiqr/StateStorage/File.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@
 block discarded – undo
54 54
         }
55 55
 
56 56
         $envelope = array("expire"=>$expire,
57
-                          "createdAt"=>time(),
58
-                          "value"=>$value);
57
+                            "createdAt"=>time(),
58
+                            "value"=>$value);
59 59
         $filename = $this->getFilenameByKey($key);
60 60
         
61 61
         if (!file_put_contents($filename, serialize($envelope))) {
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/Pdo.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,6 @@
 block discarded – undo
21 21
  * 
22 22
  * 
23 23
  * Create SQL table (MySQL):
24
-
25 24
  * CREATE TABLE IF NOT EXISTS tiqrstate (
26 25
     key varchar(255) PRIMARY KEY,
27 26
     expire BIGINT,
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Service.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -584,17 +584,17 @@  discard block
 block discarded – undo
584 584
         }
585 585
 
586 586
         $metadata = array("service"=>
587
-                               array("displayName"       => $this->_name,
588
-                                     "identifier"        => $this->_identifier,
589
-                                     "logoUrl"           => $this->_logoUrl,
590
-                                     "infoUrl"           => $this->_infoUrl,
591
-                                     "authenticationUrl" => $authenticationUrl,
592
-                                     "ocraSuite"         => $this->_ocraSuite,
593
-                                     "enrollmentUrl"     => $enrollmentUrl
594
-                               ),
595
-                          "identity"=>
596
-                               array("identifier" =>$data["userId"],
597
-                                     "displayName"=>$data["displayName"]));
587
+                                array("displayName"       => $this->_name,
588
+                                        "identifier"        => $this->_identifier,
589
+                                        "logoUrl"           => $this->_logoUrl,
590
+                                        "infoUrl"           => $this->_infoUrl,
591
+                                        "authenticationUrl" => $authenticationUrl,
592
+                                        "ocraSuite"         => $this->_ocraSuite,
593
+                                        "enrollmentUrl"     => $enrollmentUrl
594
+                                ),
595
+                            "identity"=>
596
+                                array("identifier" =>$data["userId"],
597
+                                        "displayName"=>$data["displayName"]));
598 598
 
599 599
         $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
600 600
 
@@ -618,18 +618,18 @@  discard block
 block discarded – undo
618 618
      */
619 619
     public function getEnrollmentSecret(string $enrollmentKey): string
620 620
     {
621
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
622
-         $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
623
-         $enrollmentData = [
624
-             "userId" => $data["userId"],
625
-             "sessionId" => $data["sessionId"]
626
-         ];
627
-         $this->_stateStorage->setValue(
628
-             self::PREFIX_ENROLLMENT_SECRET . $secret,
629
-             $enrollmentData,
630
-             self::ENROLLMENT_EXPIRE
631
-         );
632
-         return $secret;
621
+            $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
622
+            $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
623
+            $enrollmentData = [
624
+                "userId" => $data["userId"],
625
+                "sessionId" => $data["sessionId"]
626
+            ];
627
+            $this->_stateStorage->setValue(
628
+                self::PREFIX_ENROLLMENT_SECRET . $secret,
629
+                $enrollmentData,
630
+                self::ENROLLMENT_EXPIRE
631
+            );
632
+            return $secret;
633 633
     } 
634 634
 
635 635
     /**
@@ -668,18 +668,18 @@  discard block
 block discarded – undo
668 668
      */
669 669
     public function finalizeEnrollment($enrollmentSecret) 
670 670
     {
671
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
672
-         if (is_array($data)) {
673
-             // Enrollment is finalized, destroy our session data.
674
-             $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED);
675
-             $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
676
-         } else {
677
-             $this->logger->error(
678
-                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
679
-                 'Warning! the method will still return "true" as a result.'
680
-             );
681
-         }
682
-         return true;
671
+            $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
672
+            if (is_array($data)) {
673
+                // Enrollment is finalized, destroy our session data.
674
+                $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED);
675
+                $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
676
+            } else {
677
+                $this->logger->error(
678
+                    'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
679
+                    'Warning! the method will still return "true" as a result.'
680
+                );
681
+            }
682
+            return true;
683 683
     }
684 684
 
685 685
     /**
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 
717 717
         $challengeUserId = NULL;
718 718
         if (isset($state["userId"])) {
719
-          $challengeUserId = $state["userId"];
719
+            $challengeUserId = $state["userId"];
720 720
         }
721 721
         // Check if we're dealing with a second factor
722 722
         if ($challengeUserId!=NULL && ($userId != $challengeUserId)) {
@@ -864,6 +864,6 @@  discard block
 block discarded – undo
864 864
      */
865 865
     protected function _setEnrollmentStatus($sessionId, $status)
866 866
     {
867
-       $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE);
867
+        $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE);
868 868
     }
869 869
 }
Please login to merge, or discard this patch.