Compare commits
No commits in common. "0025530b616e3dbf977f4db46fb4449c733518af" and "0c4a100f3439c291d7683cff61c85b77f439176b" have entirely different histories.
0025530b61
...
0c4a100f34
2
.env
2
.env
|
@ -5,6 +5,8 @@
|
||||||
###> symfony/framework-bundle ###
|
###> symfony/framework-bundle ###
|
||||||
APP_ENV=dev
|
APP_ENV=dev
|
||||||
APP_SECRET=xxx
|
APP_SECRET=xxx
|
||||||
|
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
|
||||||
|
#TRUSTED_HOSTS=localhost,example.com
|
||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
|
||||||
###> doctrine/doctrine-bundle ###
|
###> doctrine/doctrine-bundle ###
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,7 +4,6 @@
|
||||||
/.env.local
|
/.env.local
|
||||||
/.env.local.php
|
/.env.local.php
|
||||||
/.env.*.local
|
/.env.*.local
|
||||||
/config/secrets/prod/prod.decrypt.private.php
|
|
||||||
/public/bundles/
|
/public/bundles/
|
||||||
/var/
|
/var/
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|
|
@ -12,58 +12,44 @@
|
||||||
],
|
],
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.1.0",
|
"php": ">=7.4.0 || >=8.0.0",
|
||||||
"ext-ctype": "*",
|
"ext-ctype": "*",
|
||||||
"ext-hash": "*",
|
"ext-hash": "*",
|
||||||
"ext-iconv": "*",
|
"ext-iconv": "*",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"babdev/pagerfanta-bundle": "^3.0",
|
"babdev/pagerfanta-bundle": "^2.4",
|
||||||
"composer/package-versions-deprecated": "1.11.99.5",
|
|
||||||
"doctrine/annotations": "^1.0",
|
|
||||||
"doctrine/doctrine-bundle": "^2",
|
|
||||||
"doctrine/doctrine-migrations-bundle": "^2",
|
|
||||||
"doctrine/orm": "^2",
|
|
||||||
"excelwebzone/recaptcha-bundle": "^1.5",
|
"excelwebzone/recaptcha-bundle": "^1.5",
|
||||||
"pagerfanta/doctrine-orm-adapter": "^3.6",
|
"pugx/sentry-sdk": "^2.0",
|
||||||
"pagerfanta/twig": "^3.6",
|
"sensio/framework-extra-bundle": "^5.1",
|
||||||
"phpdocumentor/reflection-docblock": "^5.3",
|
|
||||||
"phpstan/phpdoc-parser": "^1.6",
|
|
||||||
"sensio/framework-extra-bundle": "^6.0",
|
|
||||||
"sentry/sentry-symfony": "^4",
|
"sentry/sentry-symfony": "^4",
|
||||||
"suin/php-rss-writer": "^1.6",
|
"suin/php-rss-writer": "^1.6",
|
||||||
"symfony/asset": "^5.4",
|
"symfony/asset": "^4.1",
|
||||||
"symfony/console": "^5.4",
|
"symfony/console": "^4.1",
|
||||||
"symfony/dotenv": "^5.4",
|
"symfony/dotenv": "^4.1",
|
||||||
"symfony/expression-language": "^5.4",
|
"symfony/expression-language": "^4.1",
|
||||||
"symfony/flex": "^1.0",
|
"symfony/flex": "^1.0",
|
||||||
"symfony/form": "^5.4",
|
"symfony/form": "^4.1",
|
||||||
"symfony/framework-bundle": "^5.4",
|
"symfony/framework-bundle": "^4.1",
|
||||||
"symfony/http-client": "^5.4",
|
"symfony/http-client": "^4.1",
|
||||||
"symfony/mailer": "^5.4",
|
"symfony/mailer": "^4.1",
|
||||||
"symfony/monolog-bundle": "^3.3",
|
"symfony/monolog-bundle": "^3.3",
|
||||||
"symfony/property-access": "^5.4",
|
"symfony/orm-pack": "^1.0",
|
||||||
"symfony/property-info": "^5.4",
|
"symfony/security-bundle": "^4.1",
|
||||||
"symfony/runtime": "^5.4",
|
"symfony/serializer-pack": "^1.0",
|
||||||
"symfony/security-bundle": "^5.4",
|
"symfony/translation": "^4.1",
|
||||||
"symfony/serializer": "^5.4",
|
"symfony/twig-bundle": "^4.1",
|
||||||
"symfony/translation": "^5.4",
|
"symfony/validator": "^4.1",
|
||||||
"symfony/twig-bundle": "^5.4",
|
"symfony/yaml": "^4.1"
|
||||||
"symfony/validator": "^5.4",
|
|
||||||
"symfony/yaml": "^5.4"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/web-profiler-bundle": "^5.4",
|
"symfony/web-profiler-bundle": "^4.1",
|
||||||
"symfony/web-server-bundle": "^4.1"
|
"symfony/web-server-bundle": "^4.1"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": {
|
"preferred-install": {
|
||||||
"*": "dist"
|
"*": "dist"
|
||||||
},
|
},
|
||||||
"sort-packages": true,
|
"sort-packages": true
|
||||||
"allow-plugins": {
|
|
||||||
"symfony/flex": true,
|
|
||||||
"symfony/runtime": true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
4504
composer.lock
generated
4504
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,25 +0,0 @@
|
||||||
framework:
|
|
||||||
cache:
|
|
||||||
# Unique name of your app: used to compute stable namespaces for cache keys.
|
|
||||||
#prefix_seed: your_vendor_name/app_name
|
|
||||||
|
|
||||||
# The "app" cache stores to the filesystem by default.
|
|
||||||
# The data in this cache should persist between deploys.
|
|
||||||
# Other options include:
|
|
||||||
|
|
||||||
# Redis
|
|
||||||
#app: cache.adapter.redis
|
|
||||||
#default_redis_provider: redis://localhost
|
|
||||||
|
|
||||||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
|
||||||
#app: cache.adapter.apcu
|
|
||||||
|
|
||||||
# Namespaced pools use the above "app" backend by default
|
|
||||||
#pools:
|
|
||||||
#my.dedicated.cache: null
|
|
||||||
prefix_seed: magnetico-web
|
|
||||||
pools:
|
|
||||||
magneticod.cache:
|
|
||||||
adapter: cache.adapter.redis
|
|
||||||
provider: '%env(REDIS_DSN)%'
|
|
||||||
default_lifetime: 600
|
|
|
@ -1,24 +1,36 @@
|
||||||
# see https://symfony.com/doc/current/reference/configuration/framework.html
|
|
||||||
framework:
|
framework:
|
||||||
secret: '%env(APP_SECRET)%'
|
secret: '%env(APP_SECRET)%'
|
||||||
|
#default_locale: en
|
||||||
#csrf_protection: true
|
#csrf_protection: true
|
||||||
http_method_override: false
|
#http_method_override: true
|
||||||
|
|
||||||
# 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:
|
||||||
handler_id: null
|
handler_id: ~
|
||||||
cookie_secure: auto
|
|
||||||
cookie_samesite: lax
|
|
||||||
storage_factory_id: session.storage.factory.native
|
|
||||||
|
|
||||||
#esi: true
|
#esi: true
|
||||||
#fragments: true
|
#fragments: true
|
||||||
php_errors:
|
php_errors:
|
||||||
log: true
|
log: true
|
||||||
|
|
||||||
when@test:
|
cache:
|
||||||
framework:
|
# Put the unique name of your app here: the prefix seed
|
||||||
test: true
|
# is used to compute stable namespaces for cache keys.
|
||||||
session:
|
#prefix_seed: your_vendor_name/app_name
|
||||||
storage_factory_id: session.storage.factory.mock_file
|
|
||||||
|
# The app cache caches to the filesystem by default.
|
||||||
|
# Other options include:
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
#app: cache.adapter.redis
|
||||||
|
#default_redis_provider: redis://localhost
|
||||||
|
|
||||||
|
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
||||||
|
#app: cache.adapter.apcu
|
||||||
|
prefix_seed: magnetico-web
|
||||||
|
pools:
|
||||||
|
magneticod.cache:
|
||||||
|
adapter: cache.adapter.redis
|
||||||
|
provider: '%env(REDIS_DSN)%'
|
||||||
|
default_lifetime: 600
|
||||||
|
|
21
config/packages/nyholm_psr7.yaml
Normal file
21
config/packages/nyholm_psr7.yaml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
services:
|
||||||
|
# Register nyholm/psr7 services for autowiring with PSR-17 (HTTP factories)
|
||||||
|
Psr\Http\Message\RequestFactoryInterface: '@nyholm.psr7.psr17_factory'
|
||||||
|
Psr\Http\Message\ResponseFactoryInterface: '@nyholm.psr7.psr17_factory'
|
||||||
|
Psr\Http\Message\ServerRequestFactoryInterface: '@nyholm.psr7.psr17_factory'
|
||||||
|
Psr\Http\Message\StreamFactoryInterface: '@nyholm.psr7.psr17_factory'
|
||||||
|
Psr\Http\Message\UploadedFileFactoryInterface: '@nyholm.psr7.psr17_factory'
|
||||||
|
Psr\Http\Message\UriFactoryInterface: '@nyholm.psr7.psr17_factory'
|
||||||
|
|
||||||
|
# Register nyholm/psr7 services for autowiring with HTTPlug factories
|
||||||
|
Http\Message\MessageFactory: '@nyholm.psr7.httplug_factory'
|
||||||
|
Http\Message\RequestFactory: '@nyholm.psr7.httplug_factory'
|
||||||
|
Http\Message\ResponseFactory: '@nyholm.psr7.httplug_factory'
|
||||||
|
Http\Message\StreamFactory: '@nyholm.psr7.httplug_factory'
|
||||||
|
Http\Message\UriFactory: '@nyholm.psr7.httplug_factory'
|
||||||
|
|
||||||
|
nyholm.psr7.psr17_factory:
|
||||||
|
class: Nyholm\Psr7\Factory\Psr17Factory
|
||||||
|
|
||||||
|
nyholm.psr7.httplug_factory:
|
||||||
|
class: Nyholm\Psr7\Factory\HttplugFactory
|
21
config/packages/psr_http_message_bridge.yaml
Normal file
21
config/packages/psr_http_message_bridge.yaml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
services:
|
||||||
|
_defaults:
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
||||||
|
|
||||||
|
Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface:
|
||||||
|
'@Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory'
|
||||||
|
|
||||||
|
Symfony\Bridge\PsrHttpMessage\HttpMessageFactoryInterface:
|
||||||
|
'@Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory'
|
||||||
|
|
||||||
|
Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory: null
|
||||||
|
Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory: null
|
||||||
|
|
||||||
|
# Uncomment the following line to allow controllers to receive a
|
||||||
|
# PSR-7 server request object instead of an HttpFoundation request
|
||||||
|
#Symfony\Bridge\PsrHttpMessage\ArgumentValueResolver\PsrServerRequestResolver: null
|
||||||
|
|
||||||
|
# Uncomment the following line to allow controllers to return a
|
||||||
|
# PSR-7 response object instead of an HttpFoundation response
|
||||||
|
#Symfony\Bridge\PsrHttpMessage\EventListener\PsrResponseListener: null
|
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
|
|
||||||
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
|
|
||||||
}
|
|
3
config/routes/dev/twig.yaml
Normal file
3
config/routes/dev/twig.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
_errors:
|
||||||
|
resource: '@TwigBundle/Resources/config/routing/errors.xml'
|
||||||
|
prefix: /_error
|
|
@ -1,4 +0,0 @@
|
||||||
when@dev:
|
|
||||||
_errors:
|
|
||||||
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
|
|
||||||
prefix: /_error
|
|
|
@ -1,6 +1,3 @@
|
||||||
# This file is the entry point to configure your own services.
|
|
||||||
# Files in the packages/ subdirectory configure your dependencies.
|
|
||||||
|
|
||||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||||
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -21,10 +18,8 @@ services:
|
||||||
$newUserInvites: '%env(NEW_USER_INVITES)%'
|
$newUserInvites: '%env(NEW_USER_INVITES)%'
|
||||||
$fromAddress: '%env(MAILER_FROM)%'
|
$fromAddress: '%env(MAILER_FROM)%'
|
||||||
|
|
||||||
# makes classes in src/ available to be used as services
|
|
||||||
# this creates a service per class whose id is the fully-qualified class name
|
|
||||||
App\:
|
App\:
|
||||||
resource: '../src/'
|
resource: '../src/*'
|
||||||
exclude: '../src/{Api/V1/{DTO},Magnetico/{Entity,Migrations},Entity,FormRequest,Migrations,Tests,View,Kernel.php}'
|
exclude: '../src/{Api/V1/{DTO},Magnetico/{Entity,Migrations},Entity,FormRequest,Migrations,Tests,View,Kernel.php}'
|
||||||
# Use array in exclude config from Symfony 4.2
|
# Use array in exclude config from Symfony 4.2
|
||||||
#- '../src/Api/V1/{DTO}'
|
#- '../src/Api/V1/{DTO}'
|
||||||
|
|
|
@ -1,10 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
use App\Kernel;
|
use App\Kernel;
|
||||||
|
use Symfony\Component\Debug\Debug;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
|
require dirname(__DIR__).'/config/bootstrap.php';
|
||||||
|
|
||||||
return function (array $context) {
|
if ($_SERVER['APP_DEBUG']) {
|
||||||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
|
umask(0000);
|
||||||
};
|
|
||||||
|
Debug::enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
|
||||||
|
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
|
||||||
|
Request::setTrustedHosts([$trustedHosts]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||||
|
$request = Request::createFromGlobals();
|
||||||
|
$response = $kernel->handle($request);
|
||||||
|
$response->send();
|
||||||
|
$kernel->terminate($request, $response);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
|
|
||||||
namespace App\Feed;
|
namespace App\Feed;
|
||||||
|
@ -133,4 +132,4 @@ class RssGenerator
|
||||||
{
|
{
|
||||||
return $this->router->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
|
return $this->router->generate($route, $parameters, UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Helper;
|
namespace App\Helper;
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,59 @@
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||||
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\Config\Resource\FileResource;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||||
|
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||||
|
|
||||||
class Kernel extends BaseKernel
|
class Kernel extends BaseKernel
|
||||||
{
|
{
|
||||||
use MicroKernelTrait;
|
use MicroKernelTrait;
|
||||||
|
|
||||||
|
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
|
||||||
|
|
||||||
|
public function getCacheDir()
|
||||||
|
{
|
||||||
|
return $this->getProjectDir().'/var/cache/'.$this->environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLogDir()
|
||||||
|
{
|
||||||
|
return $this->getProjectDir().'/var/log';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerBundles()
|
||||||
|
{
|
||||||
|
$contents = require $this->getProjectDir().'/config/bundles.php';
|
||||||
|
foreach ($contents as $class => $envs) {
|
||||||
|
if (isset($envs['all']) || isset($envs[$this->environment])) {
|
||||||
|
yield new $class();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
|
||||||
|
{
|
||||||
|
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
|
||||||
|
// Feel free to remove the "container.autowiring.strict_mode" parameter
|
||||||
|
// if you are using symfony/dependency-injection 4.0+ as it's the default behavior
|
||||||
|
$container->setParameter('container.autowiring.strict_mode', true);
|
||||||
|
$container->setParameter('container.dumper.inline_class_loader', true);
|
||||||
|
$confDir = $this->getProjectDir().'/config';
|
||||||
|
|
||||||
|
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
|
||||||
|
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
|
||||||
|
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
|
||||||
|
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configureRoutes(RouteCollectionBuilder $routes)
|
||||||
|
{
|
||||||
|
$confDir = $this->getProjectDir().'/config';
|
||||||
|
|
||||||
|
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
|
||||||
|
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
|
||||||
|
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Pager;
|
namespace App\Pager;
|
||||||
|
|
||||||
use Pagerfanta\Doctrine\ORM\QueryAdapter;
|
use Pagerfanta\Adapter\DoctrineORMAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This adapter don't make COUNT() queries.
|
* This adapter don't make COUNT() queries.
|
||||||
*/
|
*/
|
||||||
class PagelessDoctrineORMAdapter extends QueryAdapter
|
class PagelessDoctrineORMAdapter extends DoctrineORMAdapter
|
||||||
{
|
{
|
||||||
public function getNbResults(): int
|
public function getNbResults()
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Pager\View;
|
namespace App\Pager\View;
|
||||||
|
|
||||||
use Pagerfanta\Pagerfanta;
|
use Pagerfanta\Pagerfanta;
|
||||||
|
@ -29,7 +27,7 @@ class TwitterBootstrap4PagelessView implements ViewInterface
|
||||||
$this->template = $template ?: $this->createDefaultTemplate();
|
$this->template = $template ?: $this->createDefaultTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(PagerfantaInterface $pagerfanta, callable $routeGenerator, array $options = []): string
|
public function render(PagerfantaInterface $pagerfanta, $routeGenerator, array $options = array())
|
||||||
{
|
{
|
||||||
$this->initializePagerfanta($pagerfanta);
|
$this->initializePagerfanta($pagerfanta);
|
||||||
|
|
||||||
|
@ -38,7 +36,7 @@ class TwitterBootstrap4PagelessView implements ViewInterface
|
||||||
return $this->generate();
|
return $this->generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(): string
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'twitter_bootstrap4_pageless';
|
return 'twitter_bootstrap4_pageless';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Search;
|
namespace App\Search;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Security;
|
namespace App\Security;
|
||||||
|
|
||||||
|
@ -14,9 +13,6 @@ use Symfony\Component\Security\Core\User\{UserInterface, UserProviderInterface};
|
||||||
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
|
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
|
||||||
use Symfony\Component\Serializer\SerializerInterface;
|
use Symfony\Component\Serializer\SerializerInterface;
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Refactor to new Authenticators system @see https://gitlab.com/skobkin/magnetico-web/-/issues/26
|
|
||||||
*/
|
|
||||||
class ApiTokenAuthenticator extends AbstractGuardAuthenticator
|
class ApiTokenAuthenticator extends AbstractGuardAuthenticator
|
||||||
{
|
{
|
||||||
public const TOKEN_HEADER = 'api-token';
|
public const TOKEN_HEADER = 'api-token';
|
||||||
|
@ -108,14 +104,13 @@ class ApiTokenAuthenticator extends AbstractGuardAuthenticator
|
||||||
return new JsonResponse($json, JsonResponse::HTTP_UNAUTHORIZED,[], true);
|
return new JsonResponse($json, JsonResponse::HTTP_UNAUTHORIZED,[], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @deprecated use AuthenticatorInterface::createToken() instead */
|
|
||||||
public function createAuthenticatedToken(UserInterface $user, $providerKey)
|
public function createAuthenticatedToken(UserInterface $user, $providerKey)
|
||||||
{
|
{
|
||||||
$request = $this->requestStack->getCurrentRequest();
|
$request = $this->requestStack->getCurrentRequest();
|
||||||
|
|
||||||
$tokenKey = $request?->headers?->get(self::TOKEN_HEADER) ?:
|
$tokenKey = $request->headers->get(self::TOKEN_HEADER) ?:
|
||||||
$request?->cookies?->get(self::TOKEN_HEADER) ?:
|
$request->cookies->get(self::TOKEN_HEADER) ?:
|
||||||
$request?->query?->get(self::TOKEN_HEADER)
|
$request->query->get(self::TOKEN_HEADER)
|
||||||
;
|
;
|
||||||
|
|
||||||
return new AuthenticatedApiToken(
|
return new AuthenticatedApiToken(
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Security\Token;
|
namespace App\Security\Token;
|
||||||
|
|
||||||
|
@ -7,11 +6,7 @@ use App\Entity\User;
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
|
use Symfony\Component\Security\Core\Authentication\Token\PreAuthenticatedToken;
|
||||||
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
|
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
|
||||||
|
|
||||||
/**
|
/** This token stores ApiToken key even after eraseCredentials() called */
|
||||||
* This token stores ApiToken key even after eraseCredentials() called
|
|
||||||
*
|
|
||||||
* @deprecated Refactor to new Authenticators system @see https://gitlab.com/skobkin/magnetico-web/-/issues/26
|
|
||||||
*/
|
|
||||||
class AuthenticatedApiToken extends PreAuthenticatedToken implements GuardTokenInterface
|
class AuthenticatedApiToken extends PreAuthenticatedToken implements GuardTokenInterface
|
||||||
{
|
{
|
||||||
/** @var string|null This token is stored only for this request and will not be erased by eraseCredentials() or serialized */
|
/** @var string|null This token is stored only for this request and will not be erased by eraseCredentials() or serialized */
|
||||||
|
@ -28,4 +23,4 @@ class AuthenticatedApiToken extends PreAuthenticatedToken implements GuardTokenI
|
||||||
{
|
{
|
||||||
return $this->tokenKey;
|
return $this->tokenKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
47
symfony.lock
47
symfony.lock
|
@ -120,12 +120,27 @@
|
||||||
"monolog/monolog": {
|
"monolog/monolog": {
|
||||||
"version": "1.23.0"
|
"version": "1.23.0"
|
||||||
},
|
},
|
||||||
|
"nyholm/psr7": {
|
||||||
|
"version": "1.0",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes",
|
||||||
|
"branch": "master",
|
||||||
|
"version": "1.0",
|
||||||
|
"ref": "7c0a9352a57376f04f5444e74565102c3a23d0c7"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"config/packages/nyholm_psr7.yaml"
|
||||||
|
]
|
||||||
|
},
|
||||||
"ocramius/package-versions": {
|
"ocramius/package-versions": {
|
||||||
"version": "1.3.0"
|
"version": "1.3.0"
|
||||||
},
|
},
|
||||||
"ocramius/proxy-manager": {
|
"ocramius/proxy-manager": {
|
||||||
"version": "2.2.0"
|
"version": "2.2.0"
|
||||||
},
|
},
|
||||||
|
"pagerfanta/pagerfanta": {
|
||||||
|
"version": "v2.3.0"
|
||||||
|
},
|
||||||
"php": {
|
"php": {
|
||||||
"version": "8.0"
|
"version": "8.0"
|
||||||
},
|
},
|
||||||
|
@ -228,6 +243,9 @@
|
||||||
"ref": "e3868d2f4a5104f19f844fe551099a00c6562527"
|
"ref": "e3868d2f4a5104f19f844fe551099a00c6562527"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"symfony/debug": {
|
||||||
|
"version": "v4.1.0"
|
||||||
|
},
|
||||||
"symfony/dependency-injection": {
|
"symfony/dependency-injection": {
|
||||||
"version": "v4.1.0"
|
"version": "v4.1.0"
|
||||||
},
|
},
|
||||||
|
@ -271,23 +289,13 @@
|
||||||
"version": "v4.1.0"
|
"version": "v4.1.0"
|
||||||
},
|
},
|
||||||
"symfony/framework-bundle": {
|
"symfony/framework-bundle": {
|
||||||
"version": "5.4",
|
"version": "3.3",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
"repo": "github.com/symfony/recipes",
|
"repo": "github.com/symfony/recipes",
|
||||||
"branch": "main",
|
"branch": "master",
|
||||||
"version": "5.4",
|
"version": "3.3",
|
||||||
"ref": "3cd216a4d007b78d8554d44a5b1c0a446dab24fb"
|
"ref": "1279df12895f20d8076324036431833181eb6645"
|
||||||
},
|
}
|
||||||
"files": [
|
|
||||||
"config/packages/cache.yaml",
|
|
||||||
"config/packages/framework.yaml",
|
|
||||||
"config/preload.php",
|
|
||||||
"config/routes/framework.yaml",
|
|
||||||
"config/services.yaml",
|
|
||||||
"public/index.php",
|
|
||||||
"src/Controller/.gitignore",
|
|
||||||
"src/Kernel.php"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"symfony/http-client": {
|
"symfony/http-client": {
|
||||||
"version": "v4.4.2"
|
"version": "v4.4.2"
|
||||||
|
@ -301,6 +309,9 @@
|
||||||
"symfony/http-kernel": {
|
"symfony/http-kernel": {
|
||||||
"version": "v4.1.0"
|
"version": "v4.1.0"
|
||||||
},
|
},
|
||||||
|
"symfony/intl": {
|
||||||
|
"version": "v4.1.0"
|
||||||
|
},
|
||||||
"symfony/mailer": {
|
"symfony/mailer": {
|
||||||
"version": "4.3",
|
"version": "4.3",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
@ -331,6 +342,9 @@
|
||||||
"symfony/options-resolver": {
|
"symfony/options-resolver": {
|
||||||
"version": "v4.1.0"
|
"version": "v4.1.0"
|
||||||
},
|
},
|
||||||
|
"symfony/orm-pack": {
|
||||||
|
"version": "v1.0.5"
|
||||||
|
},
|
||||||
"symfony/polyfill-intl-grapheme": {
|
"symfony/polyfill-intl-grapheme": {
|
||||||
"version": "v1.17.1"
|
"version": "v1.17.1"
|
||||||
},
|
},
|
||||||
|
@ -412,6 +426,9 @@
|
||||||
"symfony/serializer": {
|
"symfony/serializer": {
|
||||||
"version": "v4.1.0"
|
"version": "v4.1.0"
|
||||||
},
|
},
|
||||||
|
"symfony/serializer-pack": {
|
||||||
|
"version": "v1.0.1"
|
||||||
|
},
|
||||||
"symfony/service-contracts": {
|
"symfony/service-contracts": {
|
||||||
"version": "v1.1.5"
|
"version": "v1.1.5"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue