@@ -54,8 +54,8 @@ |
||
| 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))) { |
@@ -21,7 +21,6 @@ |
||
| 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, |
@@ -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 | /** |