@@ -552,17 +552,17 @@ discard block |
||
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | $metadata = array("service"=> |
| 555 | - array("displayName" => $this->_name, |
|
| 556 | - "identifier" => $this->_identifier, |
|
| 557 | - "logoUrl" => $this->_logoUrl, |
|
| 558 | - "infoUrl" => $this->_infoUrl, |
|
| 559 | - "authenticationUrl" => $authenticationUrl, |
|
| 560 | - "ocraSuite" => $this->_ocraSuite, |
|
| 561 | - "enrollmentUrl" => $enrollmentUrl |
|
| 562 | - ), |
|
| 563 | - "identity"=> |
|
| 564 | - array("identifier" =>$data["userId"], |
|
| 565 | - "displayName"=>$data["displayName"])); |
|
| 555 | + array("displayName" => $this->_name, |
|
| 556 | + "identifier" => $this->_identifier, |
|
| 557 | + "logoUrl" => $this->_logoUrl, |
|
| 558 | + "infoUrl" => $this->_infoUrl, |
|
| 559 | + "authenticationUrl" => $authenticationUrl, |
|
| 560 | + "ocraSuite" => $this->_ocraSuite, |
|
| 561 | + "enrollmentUrl" => $enrollmentUrl |
|
| 562 | + ), |
|
| 563 | + "identity"=> |
|
| 564 | + array("identifier" =>$data["userId"], |
|
| 565 | + "displayName"=>$data["displayName"])); |
|
| 566 | 566 | |
| 567 | 567 | $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
| 568 | 568 | |
@@ -585,18 +585,18 @@ discard block |
||
| 585 | 585 | */ |
| 586 | 586 | public function getEnrollmentSecret($enrollmentKey) |
| 587 | 587 | { |
| 588 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
| 589 | - $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET); |
|
| 590 | - $enrollmentData = [ |
|
| 591 | - "userId" => $data["userId"], |
|
| 592 | - "sessionId" => $data["sessionId"] |
|
| 593 | - ]; |
|
| 594 | - $this->_stateStorage->setValue( |
|
| 595 | - self::PREFIX_ENROLLMENT_SECRET . $secret, |
|
| 596 | - $enrollmentData, |
|
| 597 | - self::ENROLLMENT_EXPIRE |
|
| 598 | - ); |
|
| 599 | - return $secret; |
|
| 588 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
| 589 | + $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET); |
|
| 590 | + $enrollmentData = [ |
|
| 591 | + "userId" => $data["userId"], |
|
| 592 | + "sessionId" => $data["sessionId"] |
|
| 593 | + ]; |
|
| 594 | + $this->_stateStorage->setValue( |
|
| 595 | + self::PREFIX_ENROLLMENT_SECRET . $secret, |
|
| 596 | + $enrollmentData, |
|
| 597 | + self::ENROLLMENT_EXPIRE |
|
| 598 | + ); |
|
| 599 | + return $secret; |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | /** |
@@ -635,18 +635,18 @@ discard block |
||
| 635 | 635 | */ |
| 636 | 636 | public function finalizeEnrollment($enrollmentSecret) |
| 637 | 637 | { |
| 638 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
| 639 | - if (is_array($data)) { |
|
| 640 | - // Enrollment is finalized, destroy our session data. |
|
| 641 | - $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED); |
|
| 642 | - $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
| 643 | - } else { |
|
| 644 | - $this->logger->error( |
|
| 645 | - 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' . |
|
| 646 | - 'Warning! the method will still return "true" as a result.' |
|
| 647 | - ); |
|
| 648 | - } |
|
| 649 | - return true; |
|
| 638 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
| 639 | + if (is_array($data)) { |
|
| 640 | + // Enrollment is finalized, destroy our session data. |
|
| 641 | + $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED); |
|
| 642 | + $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
| 643 | + } else { |
|
| 644 | + $this->logger->error( |
|
| 645 | + 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' . |
|
| 646 | + 'Warning! the method will still return "true" as a result.' |
|
| 647 | + ); |
|
| 648 | + } |
|
| 649 | + return true; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | /** |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | $challengeUserId = NULL; |
| 685 | 685 | if (isset($state["userId"])) { |
| 686 | - $challengeUserId = $state["userId"]; |
|
| 686 | + $challengeUserId = $state["userId"]; |
|
| 687 | 687 | } |
| 688 | 688 | // Check if we're dealing with a second factor |
| 689 | 689 | if ($challengeUserId!=NULL && ($userId != $challengeUserId)) { |
@@ -830,6 +830,6 @@ discard block |
||
| 830 | 830 | */ |
| 831 | 831 | protected function _setEnrollmentStatus($sessionId, $status) |
| 832 | 832 | { |
| 833 | - $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE); |
|
| 833 | + $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE); |
|
| 834 | 834 | } |
| 835 | 835 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | public function encrypt($data); |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Decrypts the given data. |
|
| 44 | + * Decrypts the given data. |
|
| 45 | 45 | * |
| 46 | 46 | * @param String $data Data to decrypt. |
| 47 | 47 | * |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Decrypts the given data. |
|
| 60 | + * Decrypts the given data. |
|
| 61 | 61 | * |
| 62 | 62 | * @param String $data Data to decrypt. |
| 63 | 63 | * |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * Decrypts the given data. |
|
| 60 | + * Decrypts the given data. |
|
| 61 | 61 | * |
| 62 | 62 | * @param String $data Data to decrypt. |
| 63 | 63 | * |