@@ -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 | /** |
@@ -263,8 +263,7 @@ discard block |
||
| 263 | 263 | if (isset($options['ocraservice']) && $options['ocraservice']['type'] != 'tiqr') { |
| 264 | 264 | $options['ocraservice']['ocra.suite'] = $this->_ocraSuite; |
| 265 | 265 | $this->_ocraService = Tiqr_OcraService::getOcraService($options['ocraservice']['type'], $options['ocraservice'], $logger); |
| 266 | - } |
|
| 267 | - else { // Create default ocraservice |
|
| 266 | + } else { // Create default ocraservice |
|
| 268 | 267 | $this->_ocraService = Tiqr_OcraService::getOcraService('tiqr', array('ocra.suite' => $this->_ocraSuite), $logger); |
| 269 | 268 | } |
| 270 | 269 | } |
@@ -487,7 +486,9 @@ discard block |
||
| 487 | 486 | $sessionId = session_id(); |
| 488 | 487 | } |
| 489 | 488 | $status = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_STATUS.$sessionId); |
| 490 | - if (is_null($status)) return self::ENROLLMENT_STATUS_IDLE; |
|
| 489 | + if (is_null($status)) { |
|
| 490 | + return self::ENROLLMENT_STATUS_IDLE; |
|
| 491 | + } |
|
| 491 | 492 | return $status; |
| 492 | 493 | } |
| 493 | 494 | |
@@ -843,8 +844,7 @@ discard block |
||
| 843 | 844 | |
| 844 | 845 | try { |
| 845 | 846 | return $this->_stateStorage->getValue("authenticated_".$sessionId); |
| 846 | - } |
|
| 847 | - catch (Exception $e) { |
|
| 847 | + } catch (Exception $e) { |
|
| 848 | 848 | $this->logger->error('getAuthenticatedUser failed', array('exception'=>$e)); |
| 849 | 849 | return NULL; |
| 850 | 850 | } |