@@ -97,9 +97,9 @@ |
||
97 | 97 | |
98 | 98 | // Wait and retry once in case of a 502 Bad Gateway error |
99 | 99 | if ($statusCode === 502 && !($retry)) { |
100 | - sleep(2); |
|
101 | - $this->_sendFirebase($deviceToken, $alert, $challenge, $apiKey, true); |
|
102 | - return; |
|
100 | + sleep(2); |
|
101 | + $this->_sendFirebase($deviceToken, $alert, $challenge, $apiKey, true); |
|
102 | + return; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | if ($statusCode !== 200) { |
@@ -538,17 +538,17 @@ discard block |
||
538 | 538 | } |
539 | 539 | |
540 | 540 | $metadata = array("service"=> |
541 | - array("displayName" => $this->_name, |
|
542 | - "identifier" => $this->_identifier, |
|
543 | - "logoUrl" => $this->_logoUrl, |
|
544 | - "infoUrl" => $this->_infoUrl, |
|
545 | - "authenticationUrl" => $authenticationUrl, |
|
546 | - "ocraSuite" => $this->_ocraSuite, |
|
547 | - "enrollmentUrl" => $enrollmentUrl |
|
548 | - ), |
|
549 | - "identity"=> |
|
550 | - array("identifier" =>$data["userId"], |
|
551 | - "displayName"=>$data["displayName"])); |
|
541 | + array("displayName" => $this->_name, |
|
542 | + "identifier" => $this->_identifier, |
|
543 | + "logoUrl" => $this->_logoUrl, |
|
544 | + "infoUrl" => $this->_infoUrl, |
|
545 | + "authenticationUrl" => $authenticationUrl, |
|
546 | + "ocraSuite" => $this->_ocraSuite, |
|
547 | + "enrollmentUrl" => $enrollmentUrl |
|
548 | + ), |
|
549 | + "identity"=> |
|
550 | + array("identifier" =>$data["userId"], |
|
551 | + "displayName"=>$data["displayName"])); |
|
552 | 552 | |
553 | 553 | $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
554 | 554 | |
@@ -571,18 +571,18 @@ discard block |
||
571 | 571 | */ |
572 | 572 | public function getEnrollmentSecret($enrollmentKey) |
573 | 573 | { |
574 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
575 | - $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET); |
|
576 | - $enrollmentData = [ |
|
577 | - "userId" => $data["userId"], |
|
578 | - "sessionId" => $data["sessionId"] |
|
579 | - ]; |
|
580 | - $this->_stateStorage->setValue( |
|
581 | - self::PREFIX_ENROLLMENT_SECRET . $secret, |
|
582 | - $enrollmentData, |
|
583 | - self::ENROLLMENT_EXPIRE |
|
584 | - ); |
|
585 | - return $secret; |
|
574 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
575 | + $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET); |
|
576 | + $enrollmentData = [ |
|
577 | + "userId" => $data["userId"], |
|
578 | + "sessionId" => $data["sessionId"] |
|
579 | + ]; |
|
580 | + $this->_stateStorage->setValue( |
|
581 | + self::PREFIX_ENROLLMENT_SECRET . $secret, |
|
582 | + $enrollmentData, |
|
583 | + self::ENROLLMENT_EXPIRE |
|
584 | + ); |
|
585 | + return $secret; |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | */ |
598 | 598 | public function validateEnrollmentSecret($enrollmentSecret) |
599 | 599 | { |
600 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
601 | - if (is_array($data)) { |
|
602 | - // Secret is valid, application may accept the user secret. |
|
603 | - $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_PROCESSED); |
|
604 | - return $data["userId"]; |
|
605 | - } |
|
606 | - return false; |
|
600 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
601 | + if (is_array($data)) { |
|
602 | + // Secret is valid, application may accept the user secret. |
|
603 | + $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_PROCESSED); |
|
604 | + return $data["userId"]; |
|
605 | + } |
|
606 | + return false; |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | /** |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function finalizeEnrollment($enrollmentSecret) |
622 | 622 | { |
623 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
624 | - if (is_array($data)) { |
|
625 | - // Enrollment is finalized, destroy our session data. |
|
626 | - $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED); |
|
627 | - $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
628 | - } |
|
629 | - return true; |
|
623 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
624 | + if (is_array($data)) { |
|
625 | + // Enrollment is finalized, destroy our session data. |
|
626 | + $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED); |
|
627 | + $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret); |
|
628 | + } |
|
629 | + return true; |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | $challengeUserId = NULL; |
664 | 664 | if (isset($state["userId"])) { |
665 | - $challengeUserId = $state["userId"]; |
|
665 | + $challengeUserId = $state["userId"]; |
|
666 | 666 | } |
667 | 667 | // Check if we're dealing with a second factor |
668 | 668 | if ($challengeUserId!=NULL && ($userId != $challengeUserId)) { |
@@ -801,6 +801,6 @@ discard block |
||
801 | 801 | */ |
802 | 802 | protected function _setEnrollmentStatus($sessionId, $status) |
803 | 803 | { |
804 | - $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE); |
|
804 | + $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE); |
|
805 | 805 | } |
806 | 806 | } |