-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: commit oat-sa/environment-management#
- Loading branch information
github-actions
committed
Nov 5, 2024
1 parent
1335871
commit 8f98cdc
Showing
74 changed files
with
3,294 additions
and
1,791 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2022-2024 (original work) Open Assessment Technologies SA; | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OAT\Library\EnvironmentManagementClient\Converter; | ||
|
||
use OAT\Library\EnvironmentManagementClient\Model\LtiPlatformInterface; | ||
use OAT\Library\Lti1p3Core\Platform\Platform; | ||
use OAT\Library\Lti1p3Core\Platform\PlatformInterface; | ||
|
||
class LtiPlatformConverter | ||
{ | ||
public function convert(LtiPlatformInterface $platform): PlatformInterface | ||
{ | ||
return new Platform( | ||
$platform->getId(), | ||
$platform->getName(), | ||
$platform->getAudience(), | ||
$platform->getOidcAuthenticationUrl(), | ||
$platform->getOauth2AccessTokenUrl() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?php | ||
|
||
/** | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2022-2024 (original work) Open Assessment Technologies SA; | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OAT\Library\EnvironmentManagementClient\Converter; | ||
|
||
use InvalidArgumentException; | ||
use OAT\Library\EnvironmentManagementClient\Model\LtiRegistrationInterface; | ||
use OAT\Library\EnvironmentManagementClient\Model\TenantAwareRegistration; | ||
use OAT\Library\EnvironmentManagementClient\Model\TenantAwareRegistrationInterface; | ||
use OAT\Library\Lti1p3Core\Registration\Registration; | ||
use OAT\Library\Lti1p3Core\Registration\RegistrationInterface; | ||
use OAT\Library\Lti1p3Core\Security\Key\KeyChainFactoryInterface; | ||
|
||
class LtiRegistrationConverter | ||
{ | ||
private LtiPlatformConverter $platformConverter; | ||
private LtiToolConverter $toolConverter; | ||
private KeyChainFactoryInterface $keyChainFactory; | ||
|
||
public function __construct( | ||
LtiPlatformConverter $platformConverter, | ||
LtiToolConverter $toolConverter, | ||
KeyChainFactoryInterface $keyChainFactory, | ||
) { | ||
$this->platformConverter = $platformConverter; | ||
$this->toolConverter = $toolConverter; | ||
$this->keyChainFactory = $keyChainFactory; | ||
} | ||
|
||
public function convert(LtiRegistrationInterface $ltiRegistration): RegistrationInterface | ||
{ | ||
if (null === $ltiRegistration->getLtiPlatform()) { | ||
throw new InvalidArgumentException(sprintf( | ||
'LTI Platform not returned for Registration %s', | ||
$ltiRegistration->getId(), | ||
)); | ||
} | ||
|
||
if (null === $ltiRegistration->getLtiTool()) { | ||
throw new InvalidArgumentException(sprintf( | ||
'LTI Tool not returned for Registration %s', | ||
$ltiRegistration->getId(), | ||
)); | ||
} | ||
|
||
$ltiPlatformKeyChain = $ltiRegistration->getPlatformKeyChain(); | ||
$ltiToolKeyChain = $ltiRegistration->getToolKeyChain(); | ||
|
||
return new Registration( | ||
$ltiRegistration->getId(), | ||
$ltiRegistration->getClientId(), | ||
$this->platformConverter->convert($ltiRegistration->getLtiPlatform()), | ||
$this->toolConverter->convert($ltiRegistration->getLtiTool()), | ||
$ltiRegistration->getDeploymentIds(), | ||
$ltiPlatformKeyChain | ||
&& $ltiPlatformKeyChain->getPublicKey() | ||
&& $ltiPlatformKeyChain->getPrivateKey() | ||
&& $ltiPlatformKeyChain->getKeySetName() | ||
? $this->keyChainFactory->create( | ||
$ltiPlatformKeyChain?->getId(), | ||
$ltiPlatformKeyChain?->getKeySetName(), | ||
$ltiPlatformKeyChain?->getPublicKey(), | ||
$ltiPlatformKeyChain?->getPrivateKey(), | ||
$ltiPlatformKeyChain?->getPrivateKeyPassphrase(), | ||
) | ||
: null, | ||
$ltiToolKeyChain | ||
&& $ltiToolKeyChain->getPublicKey() | ||
&& $ltiToolKeyChain->getPrivateKey() | ||
&& $ltiToolKeyChain->getKeySetName() | ||
? $this->keyChainFactory->create( | ||
$ltiToolKeyChain->getId(), | ||
$ltiToolKeyChain->getKeySetName(), | ||
$ltiToolKeyChain->getPublicKey(), | ||
$ltiToolKeyChain->getPrivateKey(), | ||
$ltiToolKeyChain->getPrivateKeyPassphrase(), | ||
) | ||
: null, | ||
$ltiRegistration->getPlatformJwksUrl(), | ||
$ltiRegistration->getToolJwksUrl(), | ||
); | ||
} | ||
|
||
public function convertWithTenantId(LtiRegistrationInterface $ltiRegistration): TenantAwareRegistrationInterface | ||
{ | ||
return TenantAwareRegistration::fromBaseRegistration( | ||
$this->convert($ltiRegistration), | ||
$ltiRegistration->getTenantId(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2022-2024 (original work) Open Assessment Technologies SA; | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OAT\Library\EnvironmentManagementClient\Converter; | ||
|
||
use OAT\Library\EnvironmentManagementClient\Model\LtiToolInterface; | ||
use OAT\Library\Lti1p3Core\Tool\Tool; | ||
use OAT\Library\Lti1p3Core\Tool\ToolInterface; | ||
|
||
class LtiToolConverter | ||
{ | ||
public function convert(LtiToolInterface $tool): ToolInterface | ||
{ | ||
return new Tool( | ||
$tool->getId(), | ||
$tool->getName(), | ||
$tool->getAudience(), | ||
$tool->getOidcInitiationUrl(), | ||
$tool->getLaunchUrl(), | ||
$tool->getDeepLinkingUrl() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OAT\Library\EnvironmentManagementClient\Exception; | ||
|
||
class ConfigurationNotFoundException extends EnvironmentManagementClientException | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OAT\Library\EnvironmentManagementClient\Exception; | ||
|
||
class FeatureFlagNotFoundException extends EnvironmentManagementClientException | ||
{ | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OAT\Library\EnvironmentManagementClient\Exception; | ||
|
||
class LtiRegistrationNotFoundException extends EnvironmentManagementClientException | ||
{ | ||
} |
Oops, something went wrong.