@@ -547,17 +547,17 @@ discard block |
||
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $metadata = array("service"=> |
| 550 | - array("displayName" => $this->_name, |
|
| 551 | - "identifier" => $this->_identifier, |
|
| 552 | - "logoUrl" => $this->_logoUrl, |
|
| 553 | - "infoUrl" => $this->_infoUrl, |
|
| 554 | - "authenticationUrl" => $authenticationUrl, |
|
| 555 | - "ocraSuite" => $this->_ocraSuite, |
|
| 556 | - "enrollmentUrl" => $enrollmentUrl |
|
| 557 | - ), |
|
| 558 | - "identity"=> |
|
| 559 | - array("identifier" =>$data["userId"], |
|
| 560 | - "displayName"=>$data["displayName"])); |
|
| 550 | + array("displayName" => $this->_name, |
|
| 551 | + "identifier" => $this->_identifier, |
|
| 552 | + "logoUrl" => $this->_logoUrl, |
|
| 553 | + "infoUrl" => $this->_infoUrl, |
|
| 554 | + "authenticationUrl" => $authenticationUrl, |
|
| 555 | + "ocraSuite" => $this->_ocraSuite, |
|
| 556 | + "enrollmentUrl" => $enrollmentUrl |
|
| 557 | + ), |
|
| 558 | + "identity"=> |
|
| 559 | + array("identifier" =>$data["userId"], |
|
| 560 | + "displayName"=>$data["displayName"])); |
|
| 561 | 561 | |
| 562 | 562 | $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
| 563 | 563 | |
@@ -587,27 +587,27 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | public function getEnrollmentSecret(string $enrollmentKey): string |
| 589 | 589 | { |
| 590 | - $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
| 591 | - if (!is_array($data)) { |
|
| 592 | - $this->logger->error('getEnrollmentSecret: enrollment key not found'); |
|
| 593 | - throw new RuntimeException('enrollment key not found'); |
|
| 594 | - } |
|
| 595 | - $userId = $data["userId"] ?? NULL; |
|
| 596 | - $sessionId = $data["sessionId"] ?? NULL; |
|
| 597 | - if (!is_string($userId) || !(is_string($sessionId))) { |
|
| 598 | - throw new RuntimeException('getEnrollmentSecret: invalid enrollment data'); |
|
| 599 | - } |
|
| 600 | - $enrollmentData = [ |
|
| 601 | - "userId" => $userId, |
|
| 602 | - "sessionId" => $sessionId |
|
| 603 | - ]; |
|
| 604 | - $enrollmentSecret = $this->_uniqueSessionKey(); |
|
| 605 | - $this->_stateStorage->setValue( |
|
| 606 | - self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret, |
|
| 607 | - $enrollmentData, |
|
| 608 | - self::ENROLLMENT_EXPIRE |
|
| 609 | - ); |
|
| 610 | - return $enrollmentSecret; |
|
| 590 | + $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey); |
|
| 591 | + if (!is_array($data)) { |
|
| 592 | + $this->logger->error('getEnrollmentSecret: enrollment key not found'); |
|
| 593 | + throw new RuntimeException('enrollment key not found'); |
|
| 594 | + } |
|
| 595 | + $userId = $data["userId"] ?? NULL; |
|
| 596 | + $sessionId = $data["sessionId"] ?? NULL; |
|
| 597 | + if (!is_string($userId) || !(is_string($sessionId))) { |
|
| 598 | + throw new RuntimeException('getEnrollmentSecret: invalid enrollment data'); |
|
| 599 | + } |
|
| 600 | + $enrollmentData = [ |
|
| 601 | + "userId" => $userId, |
|
| 602 | + "sessionId" => $sessionId |
|
| 603 | + ]; |
|
| 604 | + $enrollmentSecret = $this->_uniqueSessionKey(); |
|
| 605 | + $this->_stateStorage->setValue( |
|
| 606 | + self::PREFIX_ENROLLMENT_SECRET . $enrollmentSecret, |
|
| 607 | + $enrollmentData, |
|
| 608 | + self::ENROLLMENT_EXPIRE |
|
| 609 | + ); |
|
| 610 | + return $enrollmentSecret; |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /** |