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