Skip to content

Commit c3761b0

Browse files
committed
#366: Continued work on implementing calls to get available intervals
1 parent 99deece commit c3761b0

18 files changed

+394
-79
lines changed

.env

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,25 @@ CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
4141
###> App ###
4242
APP_DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
4343
APP_ACTIVATION_CODE_EXPIRE_INTERNAL=P2D
44+
APP_KEY_VAULT_SOURCE=ENVIRONMENT
45+
APP_KEY_VAULT_JSON="{}"
4446
###< App ###
4547

4648
###> lexik/jwt-authentication-bundle ###
4749
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
4850
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
4951
JWT_PASSPHRASE=APP_JWT_PASSPHRASE
50-
JWT_TOKEN_TTL=3600 # 1 hour
51-
JWT_SCREEN_TOKEN_TTL=1296000 # 15 days
52+
# 1 hour
53+
JWT_TOKEN_TTL=3600
54+
# 15 days
55+
JWT_SCREEN_TOKEN_TTL=1296000
5256
###< lexik/jwt-authentication-bundle ###
5357

5458
###> gesdinet/jwt-refresh-token-bundle ###
55-
JWT_REFRESH_TOKEN_TTL=7200 # 2 hours
56-
JWT_SCREEN_REFRESH_TOKEN_TTL=2592000 # 30 days
59+
# 2 hours
60+
JWT_REFRESH_TOKEN_TTL=7200
61+
# 30 days
62+
JWT_SCREEN_REFRESH_TOKEN_TTL=2592000
5763
###< gesdinet/jwt-refresh-token-bundle ###
5864

5965
###> itk-dev/openid-connect-bundle ###
@@ -75,6 +81,7 @@ EXTERNAL_OIDC_REDIRECT_URI=EXTERNAL_OIDC_REDIRECT_URI
7581
EXTERNAL_OIDC_LEEWAY=30
7682
EXTERNAL_OIDC_HASH_SALT=
7783
EXTERNAL_OIDC_CLAIM_ID=signinname
84+
###< itk-dev/openid-connect-bundle ###
7885

7986
# cli redirect url
8087
OIDC_CLI_REDIRECT=APP_CLI_REDIRECT_URI
@@ -84,3 +91,4 @@ OIDC_CLI_REDIRECT=APP_CLI_REDIRECT_URI
8491
REDIS_CACHE_PREFIX=DisplayApiService
8592
REDIS_CACHE_DSN=redis://redis:6379/0
8693
###< redis ###
94+

.env.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ DATABASE_URL="mysql://root:password@mariadb:3306/db_test?serverVersion=mariadb-1
1111
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
1212
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
1313
JWT_PASSPHRASE=APP_JWT_PASSPHRASE
14-
JWT_TOKEN_TTL=1800 # 30 min
15-
JWT_SCREEN_TOKEN_TTL=43200 # 12 hours
14+
JWT_TOKEN_TTL=1800
15+
JWT_SCREEN_TOKEN_TTL=43200
1616
###< lexik/jwt-authentication-bundle ###
1717

1818
###> gesdinet/jwt-refresh-token-bundle ###
19-
JWT_REFRESH_TOKEN_TTL=3600 # 1 hour
20-
JWT_SCREEN_REFRESH_TOKEN_TTL=86400 # 24 hours
19+
JWT_REFRESH_TOKEN_TTL=3600
20+
JWT_SCREEN_REFRESH_TOKEN_TTL=86400
2121
###< gesdinet/jwt-refresh-token-bundle ###

config/services.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ services:
5151
Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface: '@Lexik\Bundle\JWTAuthenticationBundle\Security\Http\Authentication\AuthenticationFailureHandler'
5252
Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface: '@Lexik\Bundle\JWTAuthenticationBundle\Security\Http\Authentication\AuthenticationSuccessHandler'
5353

54+
App\Service\KeyVaultService:
55+
arguments:
56+
$keyVaultSource: '%env(string:APP_KEY_VAULT_SOURCE)%'
57+
$keyVaultArray: '%env(json:APP_KEY_VAULT_JSON)%'
58+
5459
App\Service\UserService:
5560
arguments:
5661
$hashSalt: '%env(EXTERNAL_OIDC_HASH_SALT)%'

migrations/Version20240227095949.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use Doctrine\DBAL\Schema\Schema;
8+
use Doctrine\Migrations\AbstractMigration;
9+
10+
/**
11+
* Auto-generated Migration: Please modify to your needs!
12+
*/
13+
final class Version20240227095949 extends AbstractMigration
14+
{
15+
public function getDescription(): string
16+
{
17+
return '';
18+
}
19+
20+
public function up(Schema $schema): void
21+
{
22+
// this up() migration is auto-generated, please modify it to your needs
23+
$this->addSql('ALTER TABLE interactive ADD version INT DEFAULT 1 NOT NULL');
24+
}
25+
26+
public function down(Schema $schema): void
27+
{
28+
// this down() migration is auto-generated, please modify it to your needs
29+
$this->addSql('ALTER TABLE interactive DROP version');
30+
}
31+
}

src/Command/Tenant/ConfigureTenantCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ final protected function execute(InputInterface $input, OutputInterface $output)
8080
foreach ($configurables as $interactiveClass => $configurable) {
8181
$question = new ConfirmationQuestion('Configure '.$interactiveClass.' (y/n)?', false);
8282
if ($helper->ask($input, $output, $question)) {
83-
$io->info("Configuring ".$interactiveClass);
83+
$io->info('Configuring '.$interactiveClass);
8484

8585
$configuration = [];
8686

8787
foreach ($configurable as $key => $data) {
88-
$value = $io->ask($key . ' (' . $data['description'] . ')');
88+
$value = $io->ask($key.' ('.$data['description'].')');
8989

9090
$configuration[$key] = $value;
9191
}
9292

93-
$this->interactiveService->saveConfiguration($tenant, (string)$interactiveClass, $configuration);
93+
$this->interactiveService->saveConfiguration($tenant, (string) $interactiveClass, $configuration);
9494
}
9595
}
9696
}

src/Controller/AuthOidcController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Lexik\Bundle\JWTAuthenticationBundle\Security\Http\Authentication\AuthenticationSuccessHandler;
1313
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1414
use Symfony\Component\HttpFoundation\JsonResponse;
15+
use Symfony\Component\HttpFoundation\RedirectResponse;
1516
use Symfony\Component\HttpFoundation\Request;
1617
use Symfony\Component\HttpFoundation\Response;
1718
use Symfony\Component\HttpFoundation\Session\SessionInterface;

src/Controller/InteractiveController.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use App\Entity\Tenant\Slide;
88
use App\Service\InteractiveService;
9+
use Symfony\Bundle\SecurityBundle\Security;
910
use Symfony\Component\HttpFoundation\JsonResponse;
1011
use Symfony\Component\HttpFoundation\Request;
1112
use Symfony\Component\HttpKernel\Attribute\AsController;
@@ -14,7 +15,8 @@
1415
final readonly class InteractiveController
1516
{
1617
public function __construct(
17-
private InteractiveService $interactiveSlideService
18+
private InteractiveService $interactiveSlideService,
19+
private Security $security,
1820
) {}
1921

2022
public function __invoke(Request $request, Slide $slide): JsonResponse
@@ -23,6 +25,8 @@ public function __invoke(Request $request, Slide $slide): JsonResponse
2325

2426
$interaction = $this->interactiveSlideService->parseRequestBody($requestBody);
2527

26-
return new JsonResponse($this->interactiveSlideService->performAction($slide, $interaction));
28+
$user = $this->security->getUser();
29+
30+
return new JsonResponse($this->interactiveSlideService->performAction($user, $slide, $interaction));
2731
}
2832
}

src/Dto/InteractiveSlideActionInput.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Dto;
46

57
class InteractiveSlideActionInput

src/Entity/Tenant/Interactive.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Entity\Tenant;
46

57
use App\Repository\InteractiveRepository;
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Exceptions;
46

57
class InteractiveException extends \Exception
68
{
7-
89
}

src/Interactive/InteractionRequest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Interactive;
46

57
readonly class InteractionRequest
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace App\Interactive;
46

57
use App\Entity\Tenant\Slide;
8+
use App\Exceptions\InteractiveException;
9+
use Symfony\Component\Security\Core\User\UserInterface;
610

711
interface InteractiveInterface
812
{
913
public function getConfigOptions(): array;
10-
public function performAction(Slide $slide, InteractionRequest $interactionRequest): array;
14+
15+
/**
16+
* Perform the given InteractionRequest with the given Slide.
17+
*
18+
* @throws InteractiveException
19+
*/
20+
public function performAction(UserInterface $user, Slide $slide, InteractionRequest $interactionRequest): array;
1121
}

0 commit comments

Comments
 (0)