mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-13 19:29:51 +00:00
Update configuration to comply with symfony 7.2
This commit is contained in:
parent
1e5d676aa5
commit
d9a47fdee9
104
composer.json
104
composer.json
@ -16,13 +16,14 @@
|
|||||||
"ext-zlib": "*",
|
"ext-zlib": "*",
|
||||||
"champs-libres/wopi-bundle": "dev-master@dev",
|
"champs-libres/wopi-bundle": "dev-master@dev",
|
||||||
"champs-libres/wopi-lib": "dev-master@dev",
|
"champs-libres/wopi-lib": "dev-master@dev",
|
||||||
|
"doctrine/annotations": "^2.0",
|
||||||
"doctrine/data-fixtures": "^1.8",
|
"doctrine/data-fixtures": "^1.8",
|
||||||
"doctrine/doctrine-bundle": "^2.1",
|
"doctrine/doctrine-bundle": "^2.1",
|
||||||
"doctrine/doctrine-migrations-bundle": "^3.0",
|
"doctrine/doctrine-migrations-bundle": "^3.0",
|
||||||
"doctrine/orm": "^2.13.0",
|
"doctrine/orm": "^2.13.0",
|
||||||
"erusev/parsedown": "^1.7",
|
"erusev/parsedown": "^1.7",
|
||||||
"knplabs/knp-menu-bundle": "^3.0",
|
"knplabs/knp-menu-bundle": "^3.0",
|
||||||
"knplabs/knp-time-bundle": "^1.12",
|
"knplabs/knp-time-bundle": "^2.0",
|
||||||
"knpuniversity/oauth2-client-bundle": "^2.10",
|
"knpuniversity/oauth2-client-bundle": "^2.10",
|
||||||
"league/csv": "^9.7.1",
|
"league/csv": "^9.7.1",
|
||||||
"lexik/jwt-authentication-bundle": "^2.16",
|
"lexik/jwt-authentication-bundle": "^2.16",
|
||||||
@ -32,54 +33,51 @@
|
|||||||
"ovh/ovh": "^3.0",
|
"ovh/ovh": "^3.0",
|
||||||
"phpoffice/phpspreadsheet": "^1.16",
|
"phpoffice/phpspreadsheet": "^1.16",
|
||||||
"ramsey/uuid-doctrine": "^1.7",
|
"ramsey/uuid-doctrine": "^1.7",
|
||||||
"sensio/framework-extra-bundle": "^5.5",
|
|
||||||
"smalot/pdfparser": "^2.10",
|
"smalot/pdfparser": "^2.10",
|
||||||
"spomky-labs/base64url": "^2.0",
|
"spomky-labs/base64url": "^2.0",
|
||||||
"symfony/asset": "^5.4",
|
"symfony/asset": "^7.2",
|
||||||
"symfony/browser-kit": "^5.4",
|
"symfony/browser-kit": "^7.2",
|
||||||
"symfony/cache": "^5.4",
|
"symfony/cache": "^7.2",
|
||||||
"symfony/clock": "^6.2",
|
"symfony/clock": "^7.2",
|
||||||
"symfony/config": "^5.4",
|
"symfony/config": "^7.2",
|
||||||
"symfony/console": "^5.4",
|
"symfony/console": "^7.2",
|
||||||
"symfony/css-selector": "^5.4",
|
"symfony/css-selector": "^7.2",
|
||||||
"symfony/dom-crawler": "^5.4",
|
"symfony/dom-crawler": "^7.2",
|
||||||
"symfony/error-handler": "^5.4",
|
"symfony/error-handler": "^7.2",
|
||||||
"symfony/event-dispatcher": "^5.4",
|
"symfony/event-dispatcher": "^7.2",
|
||||||
"symfony/event-dispatcher-contracts": "^2.4",
|
"symfony/event-dispatcher-contracts": "^3.0",
|
||||||
"symfony/expression-language": "^5.4",
|
"symfony/expression-language": "^7.2",
|
||||||
"symfony/filesystem": "^5.4",
|
"symfony/filesystem": "^7.2",
|
||||||
"symfony/finder": "^5.4",
|
"symfony/finder": "^7.2",
|
||||||
"symfony/form": "^5.4",
|
"symfony/form": "^7.2",
|
||||||
"symfony/framework-bundle": "^5.4",
|
"symfony/framework-bundle": "^7.2",
|
||||||
"symfony/http-client": "^5.4",
|
"symfony/http-client": "^7.2",
|
||||||
"symfony/http-foundation": "^5.4",
|
"symfony/http-foundation": "^7.2",
|
||||||
"symfony/intl": "^5.4",
|
"symfony/intl": "^7.2",
|
||||||
"symfony/mailer": "^5.4",
|
"symfony/mailer": "^7.2",
|
||||||
"symfony/messenger": "^5.4",
|
"symfony/messenger": "^7.2",
|
||||||
"symfony/mime": "^5.4",
|
"symfony/mime": "^7.2",
|
||||||
"symfony/monolog-bundle": "^3.5",
|
"symfony/monolog-bundle": "^3.5",
|
||||||
"symfony/notifier": "^5.4",
|
"symfony/notifier": "^7.2",
|
||||||
"symfony/options-resolver": "^5.4",
|
"symfony/options-resolver": "^7.2",
|
||||||
"symfony/ovh-cloud-notifier": "^5.4",
|
"symfony/ovh-cloud-notifier": "^7.2",
|
||||||
"symfony/process": "^5.4",
|
"symfony/process": "^7.2",
|
||||||
"symfony/property-access": "^5.4",
|
"symfony/property-access": "^7.2",
|
||||||
"symfony/property-info": "^5.4",
|
"symfony/property-info": "^7.2",
|
||||||
"symfony/routing": "^5.4",
|
"symfony/routing": "^7.2",
|
||||||
"symfony/security-bundle": "^5.4",
|
"symfony/security-bundle": "^7.2",
|
||||||
"symfony/security-core": "^5.4",
|
"symfony/security-core": "^7.2",
|
||||||
"symfony/security-csrf": "^5.4",
|
"symfony/security-csrf": "^7.2",
|
||||||
"symfony/security-guard": "^5.4",
|
"symfony/security-http": "^7.2",
|
||||||
"symfony/security-http": "^5.4",
|
"symfony/serializer": "^7.2",
|
||||||
"symfony/serializer": "^5.4",
|
"symfony/string": "^7.2",
|
||||||
"symfony/string": "^5.4",
|
"symfony/translation": "^7.2",
|
||||||
"symfony/templating": "^5.4",
|
"symfony/twig-bundle": "^7.2",
|
||||||
"symfony/translation": "^5.4",
|
|
||||||
"symfony/twig-bundle": "^5.4",
|
|
||||||
"symfony/ux-translator": "^2.22",
|
"symfony/ux-translator": "^2.22",
|
||||||
"symfony/validator": "^5.4",
|
"symfony/validator": "^7.2",
|
||||||
"symfony/webpack-encore-bundle": "^1.11",
|
"symfony/webpack-encore-bundle": "^2.0",
|
||||||
"symfony/workflow": "^5.4",
|
"symfony/workflow": "^7.2",
|
||||||
"symfony/yaml": "^5.4",
|
"symfony/yaml": "^7.2",
|
||||||
"thenetworg/oauth2-azure": "^2.0",
|
"thenetworg/oauth2-azure": "^2.0",
|
||||||
"twig/extra-bundle": "^3.0",
|
"twig/extra-bundle": "^3.0",
|
||||||
"twig/intl-extra": "^3.0",
|
"twig/intl-extra": "^3.0",
|
||||||
@ -101,22 +99,24 @@
|
|||||||
"phpstan/phpstan-strict-rules": "^1.0",
|
"phpstan/phpstan-strict-rules": "^1.0",
|
||||||
"phpunit/phpunit": "^10.5.24",
|
"phpunit/phpunit": "^10.5.24",
|
||||||
"rector/rector": "^1.1.0",
|
"rector/rector": "^1.1.0",
|
||||||
"symfony/amqp-messenger": "^5.4.45",
|
"symfony/amqp-messenger": "^7.2",
|
||||||
"symfony/debug-bundle": "^5.4",
|
"symfony/debug-bundle": "^7.2",
|
||||||
"symfony/dotenv": "^5.4",
|
"symfony/dotenv": "^7.2",
|
||||||
"symfony/flex": "^2.4",
|
"symfony/flex": "^2.4",
|
||||||
"symfony/maker-bundle": "^1.20",
|
"symfony/maker-bundle": "^1.20",
|
||||||
"symfony/phpunit-bridge": "^7.1",
|
"symfony/phpunit-bridge": "^7.1",
|
||||||
"symfony/runtime": "^5.4",
|
"symfony/runtime": "^7.2",
|
||||||
"symfony/stopwatch": "^5.4",
|
"symfony/stopwatch": "^7.2",
|
||||||
"symfony/var-dumper": "^5.4",
|
"symfony/var-dumper": "^7.2",
|
||||||
"symfony/web-profiler-bundle": "^5.4"
|
"symfony/web-profiler-bundle": "^7.2"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"symfony/symfony": "*"
|
"symfony/symfony": "*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\DependencyInjection\\": "src/Symfony/Component/DependencyInjection",
|
||||||
|
"ChampsLibres\\WopiBundle\\": "src/ChampsLibres/WopiBundle",
|
||||||
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
"Chill\\ActivityBundle\\": "src/Bundle/ChillActivityBundle",
|
||||||
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
"Chill\\AsideActivityBundle\\": "src/Bundle/ChillAsideActivityBundle/src",
|
||||||
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
|
"Chill\\BudgetBundle\\": "src/Bundle/ChillBudgetBundle",
|
||||||
|
@ -14,7 +14,6 @@ return [
|
|||||||
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
|
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
|
||||||
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true],
|
Nelmio\Alice\Bridge\Symfony\NelmioAliceBundle::class => ['dev' => true, 'test' => true],
|
||||||
Misd\PhoneNumberBundle\MisdPhoneNumberBundle::class => ['all' => true],
|
Misd\PhoneNumberBundle\MisdPhoneNumberBundle::class => ['all' => true],
|
||||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
|
||||||
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
|
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
|
||||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||||
|
@ -4,6 +4,16 @@ framework:
|
|||||||
#csrf_protection: true
|
#csrf_protection: true
|
||||||
http_method_override: false
|
http_method_override: false
|
||||||
|
|
||||||
|
|
||||||
|
# Enable EntityValueResolver for automatic entity injection in controllers
|
||||||
|
# This replaces the functionality previously provided by SensioFrameworkExtraBundle
|
||||||
|
http_client:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
request:
|
||||||
|
formats:
|
||||||
|
json: ['application/json']
|
||||||
|
|
||||||
# Enables session support. Note that the session will ONLY be started if you read or write from it.
|
# Enables session support. Note that the session will ONLY be started if you read or write from it.
|
||||||
# Remove or comment this section to explicitly disable session support.
|
# Remove or comment this section to explicitly disable session support.
|
||||||
session:
|
session:
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
framework:
|
framework:
|
||||||
messenger:
|
messenger:
|
||||||
# reset services after consuming messages
|
|
||||||
reset_on_message: true
|
|
||||||
|
|
||||||
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
|
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling.
|
||||||
failure_transport: failed
|
failure_transport: failed
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
security:
|
security:
|
||||||
enable_authenticator_manager: true
|
|
||||||
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
||||||
password_hashers:
|
password_hashers:
|
||||||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
|
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
|
||||||
@ -28,16 +27,13 @@ security:
|
|||||||
pattern: ^/wopi
|
pattern: ^/wopi
|
||||||
provider: chill_chain_provider
|
provider: chill_chain_provider
|
||||||
stateless: true
|
stateless: true
|
||||||
guard:
|
jwt: ~
|
||||||
authenticators:
|
|
||||||
- lexik_jwt_authentication.jwt_token_authenticator
|
|
||||||
dav:
|
dav:
|
||||||
pattern: ^/dav
|
pattern: ^/dav
|
||||||
provider: chill_chain_provider
|
provider: chill_chain_provider
|
||||||
stateless: true
|
stateless: true
|
||||||
guard:
|
custom_authenticator:
|
||||||
authenticators:
|
- Chill\DocStoreBundle\Security\Authenticator\JWTOnDavUrlAuthenticator
|
||||||
- Chill\DocStoreBundle\Security\Guard\JWTOnDavUrlAuthenticator
|
|
||||||
# this firewall is the main firewall for chill. It should be the last one in the stack,
|
# this firewall is the main firewall for chill. It should be the last one in the stack,
|
||||||
# unless you have specific needs
|
# unless you have specific needs
|
||||||
chill_main:
|
chill_main:
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
sensio_framework_extra:
|
|
||||||
router:
|
|
||||||
annotations: false
|
|
@ -1,3 +1,3 @@
|
|||||||
kernel:
|
kernel:
|
||||||
resource: ../../src/app/Kernel.php
|
resource: ../../src/app/Kernel.php
|
||||||
type: annotation
|
type: attribute
|
||||||
|
@ -11,3 +11,7 @@ services:
|
|||||||
autowire: true # Automatically injects dependencies in your services.
|
autowire: true # Automatically injects dependencies in your services.
|
||||||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||||
|
|
||||||
|
# Custom entity value resolver to replace SensioFrameworkExtraBundle functionality
|
||||||
|
Chill\MainBundle\ArgumentResolver\EntityValueResolver:
|
||||||
|
tags:
|
||||||
|
- { name: controller.argument_value_resolver, priority: 50 }
|
||||||
|
@ -22,7 +22,7 @@ use function is_int;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_activity');
|
$treeBuilder = new TreeBuilder('chill_activity');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
|
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_aside_activity');
|
$treeBuilder = new TreeBuilder('chill_aside_activity');
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
|
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_budget');
|
$treeBuilder = new TreeBuilder('chill_budget');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_calendar');
|
$treeBuilder = new TreeBuilder('chill_calendar');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -22,7 +22,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_custom_fields');
|
$treeBuilder = new TreeBuilder('chill_custom_fields');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
|
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_doc_generator');
|
$treeBuilder = new TreeBuilder('chill_doc_generator');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -19,6 +19,7 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
|||||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||||
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
use Symfony\Contracts\HttpClient\HttpClientInterface;
|
||||||
|
|
||||||
|
#[\Symfony\Component\Console\Attribute\AsCommand(name: 'chill:doc-store:configure-openstack')]
|
||||||
class ConfigureOpenstackObjectStorageCommand extends Command
|
class ConfigureOpenstackObjectStorageCommand extends Command
|
||||||
{
|
{
|
||||||
protected static $defaultDescription = 'Configure openstack container to store documents';
|
protected static $defaultDescription = 'Configure openstack container to store documents';
|
||||||
@ -39,7 +40,6 @@ class ConfigureOpenstackObjectStorageCommand extends Command
|
|||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
->setName('chill:doc-store:configure-openstack')
|
|
||||||
->addOption('os_token', 'o', InputOption::VALUE_REQUIRED, 'Openstack token')
|
->addOption('os_token', 'o', InputOption::VALUE_REQUIRED, 'Openstack token')
|
||||||
->addOption('domain', 'd', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Domain name')
|
->addOption('domain', 'd', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Domain name')
|
||||||
;
|
;
|
||||||
|
@ -22,7 +22,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_doc_store');
|
$treeBuilder = new TreeBuilder('chill_doc_store');
|
||||||
/** @var ArrayNodeDefinition $rootNode */
|
/** @var ArrayNodeDefinition $rootNode */
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Security\Authenticator;
|
||||||
|
|
||||||
|
use Lexik\Bundle\JWTAuthenticationBundle\TokenExtractor\TokenExtractorInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract the JWT Token from the segment of the dav endpoints.
|
||||||
|
*
|
||||||
|
* A segment is a separation inside the string, using the character "/".
|
||||||
|
*
|
||||||
|
* For recognizing the JWT, the first segment must be "dav", and the second one must be
|
||||||
|
* the JWT endpoint.
|
||||||
|
*/
|
||||||
|
final readonly class DavOnUrlTokenExtractor implements TokenExtractorInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private LoggerInterface $logger,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function extract(Request $request): false|string
|
||||||
|
{
|
||||||
|
$uri = $request->getRequestUri();
|
||||||
|
|
||||||
|
$segments = array_values(
|
||||||
|
array_filter(
|
||||||
|
explode('/', $uri),
|
||||||
|
fn ($item) => '' !== trim($item)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (2 > count($segments)) {
|
||||||
|
$this->logger->info('not enough segment for parsing URL');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('dav' !== $segments[0]) {
|
||||||
|
$this->logger->info('the first segment of the url must be DAV');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $segments[1];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\DocStoreBundle\Security\Authenticator;
|
||||||
|
|
||||||
|
use Chill\DocStoreBundle\Security\Authenticator\DavOnUrlTokenExtractor;
|
||||||
|
use Lexik\Bundle\JWTAuthenticationBundle\Exception\InvalidTokenException;
|
||||||
|
use Lexik\Bundle\JWTAuthenticationBundle\Exception\JWTDecodeFailureException;
|
||||||
|
use Lexik\Bundle\JWTAuthenticationBundle\Exception\MissingTokenException;
|
||||||
|
use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
||||||
|
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||||
|
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
|
||||||
|
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
|
||||||
|
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
|
||||||
|
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JWT authenticator for DAV URL endpoints.
|
||||||
|
*/
|
||||||
|
class JWTOnDavUrlAuthenticator extends AbstractAuthenticator
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly JWTTokenManagerInterface $jwtManager,
|
||||||
|
private readonly DavOnUrlTokenExtractor $davOnUrlTokenExtractor,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function supports(Request $request): ?bool
|
||||||
|
{
|
||||||
|
return false !== $this->davOnUrlTokenExtractor->extract($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function authenticate(Request $request): Passport
|
||||||
|
{
|
||||||
|
$token = $this->davOnUrlTokenExtractor->extract($request);
|
||||||
|
|
||||||
|
if (false === $token) {
|
||||||
|
throw new MissingTokenException('JWT Token not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$payload = $this->jwtManager->parse($token);
|
||||||
|
} catch (JWTDecodeFailureException $e) {
|
||||||
|
throw new InvalidTokenException('Invalid JWT Token', 0, $e);
|
||||||
|
}
|
||||||
|
|
||||||
|
$username = $payload['username'] ?? $payload['email'] ?? $payload['user_id'] ?? null;
|
||||||
|
|
||||||
|
if (null === $username) {
|
||||||
|
throw new InvalidTokenException('Invalid JWT Token: Username not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SelfValidatingPassport(new UserBadge($username));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
|
||||||
|
{
|
||||||
|
// On success, let the request continue
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
|
||||||
|
{
|
||||||
|
throw $exception;
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_event');
|
$treeBuilder = new TreeBuilder('chill_event');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_france_travail_api');
|
$treeBuilder = new TreeBuilder('chill_france_travail_api');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_job');
|
$treeBuilder = new TreeBuilder('chill_job');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Chill\MainBundle\ArgumentResolver;
|
||||||
|
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpKernel\Controller\ValueResolverInterface;
|
||||||
|
use Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves entity arguments for controllers.
|
||||||
|
*
|
||||||
|
* This replaces the functionality previously provided by SensioFrameworkExtraBundle.
|
||||||
|
*/
|
||||||
|
class EntityValueResolver implements ValueResolverInterface
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly ManagerRegistry $doctrine,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||||
|
{
|
||||||
|
$type = $argument->getType();
|
||||||
|
if (null === $type || !class_exists($type) || !$this->isEntity($type)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $argument->getName();
|
||||||
|
|
||||||
|
// If the argument name is 'id', we don't want to resolve it as an entity
|
||||||
|
if ('id' === $name) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to find the entity ID from various possible parameter names
|
||||||
|
$id = $this->findEntityId($request, $name, $type);
|
||||||
|
|
||||||
|
if (null === $id) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$entity = $this->doctrine->getRepository($type)->find($id);
|
||||||
|
|
||||||
|
if (null === $entity) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$entity];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to find the entity ID from various possible parameter names.
|
||||||
|
*
|
||||||
|
* This method checks for the following parameter names in order:
|
||||||
|
* 1. The parameter name specified in the route (e.g., 'id', 'person_id', 'household_id')
|
||||||
|
* 2. A parameter named after the entity with 'Id' suffix (e.g., 'personId' for Person entity)
|
||||||
|
* 3. A parameter named after the entity with '_id' suffix (e.g., 'person_id' for Person entity)
|
||||||
|
* 4. The 'id' parameter as a fallback
|
||||||
|
*/
|
||||||
|
private function findEntityId(Request $request, string $name, string $type): mixed
|
||||||
|
{
|
||||||
|
// Common parameter naming patterns
|
||||||
|
$possibleNames = [
|
||||||
|
$name . 'Id',
|
||||||
|
$name . '_id',
|
||||||
|
$this->getShortClassName($type) . '_id',
|
||||||
|
$this->getShortClassName($type) . 'Id',
|
||||||
|
'id',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Special cases based on observed @ParamConverter usage
|
||||||
|
$specialCases = [
|
||||||
|
'Household' => ['household_id'],
|
||||||
|
'AccompanyingCourse' => ['accompanying_period_id'],
|
||||||
|
'AccompanyingPeriod' => ['accompanying_period_id'],
|
||||||
|
'Event' => ['event_id'],
|
||||||
|
'User' => ['userId'],
|
||||||
|
'Person' => ['person_id'],
|
||||||
|
'Action' => ['action_id'],
|
||||||
|
];
|
||||||
|
|
||||||
|
// Add special cases if applicable
|
||||||
|
$shortClassName = $this->getShortClassName($type);
|
||||||
|
if (isset($specialCases[$shortClassName])) {
|
||||||
|
$possibleNames = array_merge($specialCases[$shortClassName], $possibleNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try each possible parameter name
|
||||||
|
foreach ($possibleNames as $paramName) {
|
||||||
|
if ($request->attributes->has($paramName)) {
|
||||||
|
return $request->attributes->get($paramName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the short class name (without namespace) from a fully qualified class name.
|
||||||
|
*/
|
||||||
|
private function getShortClassName(string $class): string
|
||||||
|
{
|
||||||
|
$parts = explode('\\', $class);
|
||||||
|
return end($parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function isEntity(string $class): bool
|
||||||
|
{
|
||||||
|
if (!$this->doctrine->getManagerForClass($class) instanceof EntityManagerInterface) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !$this->doctrine->getManagerForClass($class)->getMetadataFactory()->isTransient($class);
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
$this->setWidgetFactories($widgetFactories);
|
$this->setWidgetFactories($widgetFactories);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_main');
|
$treeBuilder = new TreeBuilder('chill_main');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -25,7 +25,7 @@ class Configuration implements ConfigurationInterface
|
|||||||
.' any birthdate is not allowed. The birthdate is expressed as ISO8601 : '
|
.' any birthdate is not allowed. The birthdate is expressed as ISO8601 : '
|
||||||
.'https://en.wikipedia.org/wiki/ISO_8601#Durations';
|
.'https://en.wikipedia.org/wiki/ISO_8601#Durations';
|
||||||
|
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('cl_chill_person');
|
$treeBuilder = new TreeBuilder('cl_chill_person');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_report');
|
$treeBuilder = new TreeBuilder('chill_report');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_task');
|
$treeBuilder = new TreeBuilder('chill_task');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
*/
|
*/
|
||||||
class Configuration implements ConfigurationInterface
|
class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_third_party');
|
$treeBuilder = new TreeBuilder('chill_third_party');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -16,7 +16,7 @@ use Symfony\Component\Config\Definition\ConfigurationInterface;
|
|||||||
|
|
||||||
final class Configuration implements ConfigurationInterface
|
final class Configuration implements ConfigurationInterface
|
||||||
{
|
{
|
||||||
public function getConfigTreeBuilder()
|
public function getConfigTreeBuilder(): \Symfony\Component\Config\Definition\Builder\TreeBuilder
|
||||||
{
|
{
|
||||||
$treeBuilder = new TreeBuilder('chill_wopi');
|
$treeBuilder = new TreeBuilder('chill_wopi');
|
||||||
$rootNode = $treeBuilder->getRootNode();
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace ChampsLibres\WopiBundle\DependencyInjection;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||||
|
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||||
|
|
||||||
|
final class Configuration implements ConfigurationInterface
|
||||||
|
{
|
||||||
|
public function getConfigTreeBuilder(): TreeBuilder
|
||||||
|
{
|
||||||
|
$treeBuilder = new TreeBuilder('wopi');
|
||||||
|
|
||||||
|
/** @var \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition $rootNode */
|
||||||
|
$rootNode = $treeBuilder->getRootNode();
|
||||||
|
|
||||||
|
/** @phpstan-ignore-next-line */
|
||||||
|
$rootNode
|
||||||
|
->children()
|
||||||
|
->scalarNode('server')->end()
|
||||||
|
->enumNode('version_management')->values(['version', 'timestamp'])
|
||||||
|
->info('Manager document versioning through version (Office 365) or last modified time (Collabora Online, CODE, etc.)')
|
||||||
|
->defaultValue('timestamp')
|
||||||
|
->end()
|
||||||
|
->booleanNode('enable_lock')->defaultTrue()->end()
|
||||||
|
->end();
|
||||||
|
|
||||||
|
return $treeBuilder;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Symfony\Component\DependencyInjection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContainerAwareTrait implementation.
|
||||||
|
*
|
||||||
|
* This trait is a replacement for the original Symfony ContainerAwareTrait
|
||||||
|
* which has been removed in newer Symfony versions.
|
||||||
|
*/
|
||||||
|
trait ContainerAwareTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var ContainerInterface|null
|
||||||
|
*/
|
||||||
|
protected $container;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the container.
|
||||||
|
*/
|
||||||
|
public function setContainer(ContainerInterface $container = null): void
|
||||||
|
{
|
||||||
|
$this->container = $container;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user