Skip to content

Commit 8979144

Browse files
committed
Merge branch '1.5'
2 parents 2ec651d + f27384d commit 8979144

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

DependencyInjection/Security/Factory/OAuthFactory.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
1515
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
17+
use Symfony\Component\DependencyInjection\ChildDefinition;
1718
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1819
use Symfony\Component\DependencyInjection\Reference;
1920

@@ -30,13 +31,24 @@ class OAuthFactory implements SecurityFactoryInterface
3031
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
3132
{
3233
$providerId = 'security.authentication.provider.fos_oauth_server.'.$id;
34+
if (class_exists(ChildDefinition::class)) {
35+
$definition = new ChildDefinition('fos_oauth_server.security.authentication.provider');
36+
} else {
37+
$definition = new DefinitionDecorator('fos_oauth_server.security.authentication.provider');
38+
}
3339
$container
34-
->setDefinition($providerId, new DefinitionDecorator('fos_oauth_server.security.authentication.provider'))
40+
->setDefinition($providerId, $definition)
3541
->replaceArgument(0, new Reference($userProvider))
36-
;
42+
;
3743

3844
$listenerId = 'security.authentication.listener.fos_oauth_server.'.$id;
39-
$container->setDefinition($listenerId, new DefinitionDecorator('fos_oauth_server.security.authentication.listener'));
45+
46+
if (class_exists(ChildDefinition::class)) {
47+
$definition = new ChildDefinition('fos_oauth_server.security.authentication.listener');
48+
} else {
49+
$definition = new DefinitionDecorator('fos_oauth_server.security.authentication.listener');
50+
}
51+
$container->setDefinition($listenerId, $definition);
4052

4153
return array($providerId, $listenerId, 'fos_oauth_server.security.entry_point');
4254
}

Resources/config/oauth.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
<argument>%fos_oauth_server.server.options%</argument>
2424
</service>
2525

26-
<service id="fos_oauth_server.controller.token" class="FOS\OAuthServerBundle\Controller\TokenController">
26+
<service id="FOS\OAuthServerBundle\Controller\TokenController">
2727
<argument type="service" id="fos_oauth_server.server" />
2828
</service>
29+
<service id="fos_oauth_server.controller.token" alias="FOS\OAuthServerBundle\Controller\TokenController" public="true" />
2930
</services>
3031
</container>

0 commit comments

Comments
 (0)