Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: publish to two solar tenants #402

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading