Skip to content

Commit

Permalink
Merge branch 'release-15.17.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Mar 12, 2024
2 parents 27390e7 + c35f5bc commit 8168f6e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ public function find(string $identifier): ?KeyChainInterface
]
);

$platformKeyChainRepository = $this->getPlatformKeyChainRepository();
$configuration = $this->getPlatformKeyChainRepository()->findConfiguration($identifier);

return new KeyChain(
$platformKeyChainRepository->getOption(PlatformKeyChainRepository::OPTION_DEFAULT_KEY_ID),
$platformKeyChainRepository->getOption(PlatformKeyChainRepository::OPTION_DEFAULT_KEY_NAME),
$configuration[PlatformKeyChainRepository::OPTION_DEFAULT_KEY_ID] ?? '',
$configuration[PlatformKeyChainRepository::OPTION_DEFAULT_KEY_NAME] ?? '',
new Key($rawKeys[sprintf(self::PUBLIC_PATTERN, $identifier)]),
new Key($rawKeys[sprintf(self::PRIVATE_PATTERN, $identifier)])
);
Expand Down Expand Up @@ -99,12 +99,12 @@ public function findAll(KeyChainQuery $query): KeyChainCollection
]
);

$platformKeyChainRepository = $this->getPlatformKeyChainRepository();
$configuration = $this->getPlatformKeyChainRepository()->findConfiguration($query->getIdentifier());

return new KeyChainCollection(
new TaoKeyChain(
$platformKeyChainRepository->getOption(PlatformKeyChainRepository::OPTION_DEFAULT_KEY_ID),
$platformKeyChainRepository->getOption(PlatformKeyChainRepository::OPTION_DEFAULT_KEY_NAME),
$configuration[PlatformKeyChainRepository::OPTION_DEFAULT_KEY_ID] ?? '',
$configuration[PlatformKeyChainRepository::OPTION_DEFAULT_KEY_NAME] ?? '',
new TaoKey($rawKeys[sprintf(self::PUBLIC_PATTERN, $query->getIdentifier())]),
new TaoKey($rawKeys[sprintf(self::PRIVATE_PATTERN, $query->getIdentifier())])
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private function getFileSystem(): FilesystemInterface
* @param string $identifier
* @return array|null
*/
protected function findConfiguration(string $identifier): ?array
public function findConfiguration(string $identifier): ?array
{
$options = $this->getOptions();
foreach ($options as $configs) {
Expand Down
4 changes: 3 additions & 1 deletion scripts/install/GenerateKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@

use oat\oatbox\extension\AbstractAction;
use oat\taoLti\models\classes\Platform\Service\CachedKeyChainGenerator;
use oat\taoLti\models\classes\Security\DataAccess\Repository\PlatformKeyChainRepository;

class GenerateKeys extends AbstractAction
{
public function __invoke($params)
{
$this->getServiceLocator()->get(CachedKeyChainGenerator::class)->generate();
$defaultKeyId = $this->getServiceLocator()->get(PlatformKeyChainRepository::SERVICE_ID)->getDefaultKeyId();
$this->getServiceLocator()->get(CachedKeyChainGenerator::class)->generate($defaultKeyId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public function testFind(): void
]
);

$this->platformKeyChainRepository
->expects($this->once())
->method('findConfiguration')
->willReturn([PlatformKeyChainRepository::OPTION_DEFAULT_KEY_ID => self::KEY_CHAIN_ID]);

$keyChain = $this->subject->find(self::KEY_CHAIN_ID);

$this->assertSame(self::KEY_CHAIN_ID, $keyChain->getIdentifier());
Expand Down

0 comments on commit 8168f6e

Please sign in to comment.