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: Update Symfony for Scoring and Reports applications #72

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d9f4cd7
feat: Update Symfony for Scoring and Reports applications
Aug 1, 2024
6c7ff1c
feat: Update Symfony for Scoring and Reports applications
Aug 1, 2024
5917fa9
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
d2b5fa6
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
b693860
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
f61a213
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
09e565b
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
f824327
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
156607d
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
74a4804
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
64845ec
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
1a9d1e5
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
4cd2389
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
cf8fcce
feat: Update Symfony for Scoring and Reports applications
Aug 2, 2024
26eb2d2
feat: Upgrade Symfony version
Aug 29, 2024
e8c5316
feat: Upgrade Symfony version
Aug 30, 2024
1be6336
feat: Upgrade Symfony version
Aug 30, 2024
8d54d34
feat: Upgrade Symfony version
Aug 30, 2024
045c788
feat: Upgrade Symfony version
Aug 30, 2024
9f4a47a
feat: Upgrade Symfony version
Aug 30, 2024
742d706
feat: Upgrade Symfony version
Aug 30, 2024
9910fc2
feat: Upgrade Symfony version
Aug 30, 2024
a21dc99
feat: Upgrade Symfony version
Aug 30, 2024
d98ae34
feat: Upgrade Symfony version
Aug 30, 2024
066d2c3
feat: Upgrade Symfony version
Aug 30, 2024
d099ca0
feat: Upgrade Symfony version
Sep 2, 2024
5e111f5
feat: Upgrade Symfony version
Sep 4, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ 8.0, 8.1, 8.2, 8.3 ]
php: [ 8.1, 8.2, 8.3 ]
extra-composer-params: [ "" ]
include:
- php: 8.3
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGELOG
=========

8.0.0
-----
* Upgrade symfony to v6.4

6.1.2
-----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,57 @@

namespace OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Message;

use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Provider\Message\LtiPlatformMessageAuthenticationProvider;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticationListener;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticator;
use OAT\Library\Lti1p3Core\Message\Launch\Validator\Platform\PlatformLaunchValidatorInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class LtiPlatformMessageSecurityFactory implements SecurityFactoryInterface
class LtiPlatformMessageSecurityFactory implements AuthenticatorFactoryInterface
{
public function getPosition(): string
public const PRIORITY = -10;

public function getPriority(): int
{
return 'pre_auth';
return self::PRIORITY;
}

public function getKey(): string
{
return 'lti1p3_message_platform';
}

public function create(
/**
* Creates the authenticator service(s) for the provided configuration.
*
* @param array<string, mixed> $config
*
* @return string|string[] The authenticator service ID(s) to be used by the firewall
*/
public function createAuthenticator(
ContainerBuilder $container,
$id,
$config,
$userProvider,
$defaultEntryPoint = null
) {
$providerId = sprintf('security.authentication.provider.%s.%s', $this->getKey(), $id);
$providerDefinition = new Definition(LtiPlatformMessageAuthenticationProvider::class);
$providerDefinition
string $firewallName,
array $config,
string $userProviderId
): array|string {
$authenticatorId = sprintf('security.authenticator.%s.%s', $this->getKey(), $firewallName);
$authenticatorDefinition = new Definition(LtiPlatformMessageAuthenticator::class);
$authenticatorDefinition
->setShared(false)
->setArguments(
[
new Reference('security.firewall.map'),
new Reference(HttpMessageFactoryInterface::class),
new Reference(PlatformLaunchValidatorInterface::class),
$id,
$firewallName,
$config['types'] ?? []
]
);
$container->setDefinition($providerId, $providerDefinition);

$listenerId = sprintf('security.authentication.listener.%s.%s', $this->getKey(), $id);
$container->setDefinition($listenerId, new ChildDefinition(LtiPlatformMessageAuthenticationListener::class));
$container->setDefinition($authenticatorId, $authenticatorDefinition);

return [$providerId, $listenerId, $defaultEntryPoint];
return $authenticatorId;
}

public function addConfiguration(NodeDefinition $node): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,53 @@

namespace OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Message;

use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Provider\Message\LtiToolMessageAuthenticationProvider;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticationListener;
use OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticator;
use OAT\Library\Lti1p3Core\Message\Launch\Validator\Tool\ToolLaunchValidatorInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class LtiToolMessageSecurityFactory implements SecurityFactoryInterface
class LtiToolMessageSecurityFactory implements AuthenticatorFactoryInterface
{
public function getPosition(): string
public const PRIORITY = -10;

public function getPriority(): int
{
return 'pre_auth';
return self::PRIORITY;
}

public function getKey(): string
{
return 'lti1p3_message_tool';
}

public function create(
public function createAuthenticator(
ContainerBuilder $container,
$id,
$config,
$userProvider,
$defaultEntryPoint = null
) {
$providerId = sprintf('security.authentication.provider.%s.%s', $this->getKey(), $id);
$providerDefinition = new Definition(LtiToolMessageAuthenticationProvider::class);
$providerDefinition
string $firewallName,
array $config,
string $userProviderId
): array|string {
$authenticatorId = sprintf('security.authenticator.%s.%s', $this->getKey(), $firewallName);
$authenticatorDefinition = new Definition(LtiToolMessageAuthenticator::class);
$authenticatorDefinition
->setShared(false)
->setArguments(
[
new Reference('security.firewall.map'),
new Reference(HttpMessageFactoryInterface::class),
new Reference(LtiToolMessageExceptionHandlerInterface::class),
new Reference(ToolLaunchValidatorInterface::class),
$id,
$firewallName,
$config['types'] ?? []
]
);
$container->setDefinition($providerId, $providerDefinition);

$listenerId = sprintf('security.authentication.listener.%s.%s', $this->getKey(), $id);
$container->setDefinition($listenerId, new ChildDefinition(LtiToolMessageAuthenticationListener::class));
$container->setDefinition($authenticatorId, $authenticatorDefinition);

return [$providerId, $listenerId, $defaultEntryPoint];
return $authenticatorId;
}

public function addConfiguration(NodeDefinition $node): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,51 @@

namespace OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Service;

use OAT\Bundle\Lti1p3Bundle\Security\Authentication\Provider\Service\LtiServiceAuthenticationProvider;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticationListener;
use OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticator;
use OAT\Library\Lti1p3Core\Security\OAuth2\Validator\RequestAccessTokenValidatorInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
use Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class LtiServiceSecurityFactory implements SecurityFactoryInterface
class LtiServiceSecurityFactory implements AuthenticatorFactoryInterface
{
public function getPosition(): string
public const PRIORITY = -10;

public function getPriority(): int
{
return 'pre_auth';
return self::PRIORITY;
}

public function getKey(): string
{
return 'lti1p3_service';
}

public function create(
public function createAuthenticator(
ContainerBuilder $container,
$id,
$config,
$userProvider,
$defaultEntryPoint = null
) {
$providerId = sprintf('security.authentication.provider.%s.%s', $this->getKey(), $id);
$providerDefinition = new Definition(LtiServiceAuthenticationProvider::class);
$providerDefinition
string $firewallName,
array $config,
string $userProviderId
): array|string {
$authenticatorId = sprintf('security.authenticator.%s.%s', $this->getKey(), $firewallName);
$authenticatorDefinition = new Definition(LtiServiceAuthenticator::class);
$authenticatorDefinition
->setShared(false)
->setArguments(
[
new Reference('security.firewall.map'),
new Reference(HttpMessageFactoryInterface::class),
new Reference(RequestAccessTokenValidatorInterface::class),
$id,
$firewallName,
$config['scopes'] ?? []
]
);
$container->setDefinition($providerId, $providerDefinition);

$listenerId = sprintf('security.authentication.listener.%s.%s', $this->getKey(), $id);
$container->setDefinition($listenerId, new ChildDefinition(LtiServiceAuthenticationListener::class));
$container->setDefinition($authenticatorId, $authenticatorDefinition);

return [$providerId, $listenerId, $defaultEntryPoint];
return $authenticatorId;
}

public function addConfiguration(NodeDefinition $node): void
Expand Down
10 changes: 5 additions & 5 deletions Lti1p3Bundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
use OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Message\LtiToolMessageSecurityFactory;
use OAT\Bundle\Lti1p3Bundle\DependencyInjection\Security\Factory\Service\LtiServiceSecurityFactory;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;

class Lti1p3Bundle extends Bundle
{
Expand All @@ -47,15 +47,15 @@ public function build(ContainerBuilder $container): void
$this->configureSecurityExtension($container->getExtension('security'));
}

private function configureSecurityExtension(ExtensionInterface $securityExtension): void
private function configureSecurityExtension(SecurityExtension $securityExtension): void
{
// LTI platform messages security registration
$securityExtension->addSecurityListenerFactory(new LtiPlatformMessageSecurityFactory());
$securityExtension->addAuthenticatorFactory(new LtiPlatformMessageSecurityFactory());

// LTI tool messages security registration
$securityExtension->addSecurityListenerFactory(new LtiToolMessageSecurityFactory());
$securityExtension->addAuthenticatorFactory(new LtiToolMessageSecurityFactory());

// LTI services security registration
$securityExtension->addSecurityListenerFactory(new LtiServiceSecurityFactory());
$securityExtension->addAuthenticatorFactory(new LtiServiceSecurityFactory());
}
}
22 changes: 0 additions & 22 deletions Resources/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,28 +181,6 @@ services:
OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface:
alias: OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandler

OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiPlatformMessageAuthenticationListener:
arguments:
- '@security.token_storage'
- '@security.authentication.manager'
- '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
- '@security.firewall.map'

OAT\Bundle\Lti1p3Bundle\Security\Firewall\Message\LtiToolMessageAuthenticationListener:
arguments:
- '@security.token_storage'
- '@security.authentication.manager'
- '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
- '@OAT\Bundle\Lti1p3Bundle\Security\Exception\LtiToolMessageExceptionHandlerInterface'
- '@security.firewall.map'

OAT\Bundle\Lti1p3Bundle\Security\Firewall\Service\LtiServiceAuthenticationListener:
arguments:
- '@security.token_storage'
- '@security.authentication.manager'
- '@Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface'
- '@security.firewall.map'

OAT\Library\Lti1p3Core\Security\User\UserAuthenticatorInterface: ~

OAT\Library\Lti1p3Core\Message\Launch\Builder\PlatformOriginatingLaunchBuilder:
Expand Down

This file was deleted.

Loading
Loading