vendor/hwi/oauth-bundle/HWIOAuthBundle.php line 25

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the HWIOAuthBundle package.
  4.  *
  5.  * (c) Hardware.Info <[email protected]>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace HWI\Bundle\OAuthBundle;
  11. use HWI\Bundle\OAuthBundle\DependencyInjection\CompilerPass\SetResourceOwnerServiceNameCompilerPass;
  12. use HWI\Bundle\OAuthBundle\DependencyInjection\HWIOAuthExtension;
  13. use HWI\Bundle\OAuthBundle\DependencyInjection\Security\Factory\OAuthFactory;
  14. use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
  15. use Symfony\Component\DependencyInjection\ContainerBuilder;
  16. use Symfony\Component\HttpKernel\Bundle\Bundle;
  17. /**
  18.  * @author Geoffrey Bachelet <[email protected]>
  19.  * @author Alexander <[email protected]>
  20.  */
  21. class HWIOAuthBundle extends Bundle
  22. {
  23.     /**
  24.      * {@inheritdoc}
  25.      */
  26.     public function build(ContainerBuilder $container)
  27.     {
  28.         parent::build($container);
  29.         /** @var $extension SecurityExtension */
  30.         $extension $container->getExtension('security');
  31.         $extension->addSecurityListenerFactory(new OAuthFactory());
  32.         $container->addCompilerPass(new SetResourceOwnerServiceNameCompilerPass());
  33.     }
  34.     /**
  35.      * {@inheritdoc}
  36.      */
  37.     public function getContainerExtension()
  38.     {
  39.         // return the right extension instead of "auto-registering" it. Now the
  40.         // alias can be hwi_oauth instead of hwi_o_auth..
  41.         if (null === $this->extension) {
  42.             return new HWIOAuthExtension();
  43.         }
  44.         return $this->extension;
  45.     }
  46. }