Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| DefaultToolConfig | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getTool | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| getJwksUrl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2022 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | * @author Ricardo Quintanilha <ricardo.quintanilha@taotesting.com> |
| 21 | */ |
| 22 | |
| 23 | declare(strict_types=1); |
| 24 | |
| 25 | namespace oat\taoLti\models\classes\Platform\Repository; |
| 26 | |
| 27 | use OAT\Library\Lti1p3Core\Tool\Tool; |
| 28 | |
| 29 | final class DefaultToolConfig |
| 30 | { |
| 31 | private const TOOL_ID = 'tao_tool'; |
| 32 | private const OIDC_PATH = 'taoLti/Security/oidc'; |
| 33 | private const JWKS_PATH = 'taoLti/Security/jwks'; |
| 34 | |
| 35 | /** @var string */ |
| 36 | private $baseUri; |
| 37 | |
| 38 | public function __construct(string $baseUri) |
| 39 | { |
| 40 | $this->baseUri = $baseUri; |
| 41 | } |
| 42 | |
| 43 | public function getTool(): Tool |
| 44 | { |
| 45 | return new Tool( |
| 46 | self::TOOL_ID, |
| 47 | self::TOOL_ID, |
| 48 | rtrim($this->baseUri, '/'), |
| 49 | $this->baseUri . self::OIDC_PATH |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | public function getJwksUrl(): string |
| 54 | { |
| 55 | return $this->baseUri . self::JWKS_PATH; |
| 56 | } |
| 57 | } |