Skip to content

Commit faa8d67

Browse files
Luis PabonGuilhemN
authored andcommitted
Handle lack of service security.token_storage on compiler pass only
1 parent 1c47ce3 commit faa8d67

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

DependencyInjection/Compiler/TokenStorageCompilerPass.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ public function process(ContainerBuilder $container)
2727
{
2828
$definition = $container->getDefinition('fos_oauth_server.security.authentication.listener');
2929

30-
if ($container->hasDefinition('security.token_storage')) {
31-
$tokenStorageReference = new Reference('security.token_storage');
32-
} else {
33-
$tokenStorageReference = new Reference('security.context');
30+
if ($container->hasDefinition('security.token_storage') === false) {
31+
$definition->replaceArgument(0, new Reference('security.context'));
3432
}
35-
$definition->replaceArgument(0, $tokenStorageReference);
3633
}
3734
}

Resources/config/security.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</service>
1919

2020
<service id="fos_oauth_server.security.authentication.listener" class="%fos_oauth_server.security.authentication.listener.class%" public="false">
21-
<argument /> <!-- security.token_storage or security.context for Symfony < 2.6 -->
21+
<argument type="service" id="security.token_storage"/>
2222
<argument type="service" id="security.authentication.manager" />
2323
<argument type="service" id="fos_oauth_server.server" />
2424
</service>

0 commit comments

Comments
 (0)