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

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the HWIOAuthBundle package.
  4.  *
  5.  * (c) Hardware Info <opensource@hardware.info>
  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\ResourceOwnerMapCompilerPass;
  12. use HWI\Bundle\OAuthBundle\DependencyInjection\CompilerPass\SetResourceOwnerServiceNameCompilerPass;
  13. use HWI\Bundle\OAuthBundle\DependencyInjection\HWIOAuthExtension;
  14. use HWI\Bundle\OAuthBundle\DependencyInjection\Security\Factory\OAuthFactory;
  15. use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
  16. use Symfony\Component\DependencyInjection\ContainerBuilder;
  17. use Symfony\Component\HttpKernel\Bundle\Bundle;
  18. /**
  19.  * @author Geoffrey Bachelet <geoffrey.bachelet@gmail.com>
  20.  * @author Alexander <geoffrey.bachelet@gmail.com>
  21.  */
  22. class HWIOAuthBundle extends Bundle
  23. {
  24.     /**
  25.      * {@inheritdoc}
  26.      */
  27.     public function build(ContainerBuilder $container)
  28.     {
  29.         parent::build($container);
  30.         /** @var $extension SecurityExtension */
  31.         $extension $container->getExtension('security');
  32.         $extension->addSecurityListenerFactory(new OAuthFactory());
  33.         $container->addCompilerPass(new SetResourceOwnerServiceNameCompilerPass());
  34.         $container->addCompilerPass(new ResourceOwnerMapCompilerPass());
  35.     }
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function getContainerExtension()
  40.     {
  41.         // return the right extension instead of "auto-registering" it. Now the
  42.         // alias can be hwi_oauth instead of hwi_o_auth..
  43.         if (null === $this->extension) {
  44.             return new HWIOAuthExtension();
  45.         }
  46.         return $this->extension;
  47.     }
  48. }