Skip to content

Commit fc4ba11

Browse files
authored
Support custom user checker (#660)
* Add custom user_checker support * Adapt tests * Add changelog
1 parent 978ebd7 commit fc4ba11

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

CHANGELOG-2.0.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This changelog references the relevant changes done in 6.0 versions.
77

88
* Added `NL` translations [[#631](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/631)]
99
* Added support for Symfony 5.1 and greater [[#658](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/658)]
10+
* Added custom user checker support [[#660](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/660)]
1011
* Bumped `twig/twig` supported versions to `1.40` for `1.x` and `2.9` for `2.x` [[#652](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/652)]
1112
* Dropped support for PHP 7.1 [[#651](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/651)]
1213
* Dropped support for Symfony versions anterior to `4.4` [[#648](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/648)]

DependencyInjection/Security/Factory/OAuthFactory.php

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
3535
$container
3636
->setDefinition($providerId, new ChildDefinition('fos_oauth_server.security.authentication.provider'))
3737
->replaceArgument(0, new Reference($userProvider))
38+
->replaceArgument(2, new Reference('security.user_checker.'.$id))
3839
;
3940

4041
$listenerId = 'security.authentication.listener.fos_oauth_server.'.$id;

Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php

+15-3
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,22 @@ public function testCreate()
8888
;
8989

9090
$definition
91-
->expects($this->once())
91+
->expects($this->exactly(2))
9292
->method('replaceArgument')
93-
->with(0, new Reference($userProvider))
94-
->willReturn(null)
93+
->withConsecutive(
94+
[
95+
0,
96+
new Reference($userProvider),
97+
],
98+
[
99+
2,
100+
new Reference('security.user_checker.'.$id),
101+
]
102+
)
103+
->willReturnOnConsecutiveCalls(
104+
$definition,
105+
$definition
106+
)
95107
;
96108

97109
$this->assertSame([

0 commit comments

Comments
 (0)