From 507ab6c5b57d4db74fe6680850b72ad62e42554e Mon Sep 17 00:00:00 2001 From: Igor Nikolaev Date: Tue, 3 Dec 2019 15:27:30 +0300 Subject: [PATCH] Switch OAuth user checker. --- DarvinUserBundle.php | 10 +++++++ .../Compiler/SwitchOAuthUserCheckerPass.php | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 DependencyInjection/Compiler/SwitchOAuthUserCheckerPass.php diff --git a/DarvinUserBundle.php b/DarvinUserBundle.php index 82853ed..10bb243 100644 --- a/DarvinUserBundle.php +++ b/DarvinUserBundle.php @@ -10,6 +10,8 @@ namespace Darvin\UserBundle; +use Darvin\UserBundle\DependencyInjection\Compiler\SwitchOAuthUserCheckerPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; /** @@ -17,5 +19,13 @@ */ class DarvinUserBundle extends Bundle { + /** + * {@inheritDoc} + */ + public function build(ContainerBuilder $container): void + { + parent::build($container); + $container->addCompilerPass(new SwitchOAuthUserCheckerPass()); + } } diff --git a/DependencyInjection/Compiler/SwitchOAuthUserCheckerPass.php b/DependencyInjection/Compiler/SwitchOAuthUserCheckerPass.php new file mode 100644 index 0000000..8f7ac12 --- /dev/null +++ b/DependencyInjection/Compiler/SwitchOAuthUserCheckerPass.php @@ -0,0 +1,29 @@ + + * @copyright Copyright (c) 2019, Darvin Studio + * @link https://www.darvin-studio.ru + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Darvin\UserBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; + +/** + * Switch OAuth user checker compiler pass + */ +class SwitchOAuthUserCheckerPass implements CompilerPassInterface +{ + /** + * {@inheritDoc} + */ + public function process(ContainerBuilder $container): void + { + $container->setAlias('hwi_oauth.user_checker', new Alias('darvin_user.security.user_checker')); + } +}