Skip to content

Commit

Permalink
Support custom user checker (FriendsOfSymfony#660)
Browse files Browse the repository at this point in the history
* Add custom user_checker support

* Adapt tests

* Add changelog
  • Loading branch information
deguif authored Sep 21, 2020
1 parent 978ebd7 commit fc4ba11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This changelog references the relevant changes done in 6.0 versions.

* Added `NL` translations [[#631](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/631)]
* Added support for Symfony 5.1 and greater [[#658](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/658)]
* Added custom user checker support [[#660](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/660)]
* 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)]
* Dropped support for PHP 7.1 [[#651](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/651)]
* Dropped support for Symfony versions anterior to `4.4` [[#648](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/pull/648)]
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/Security/Factory/OAuthFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider,
$container
->setDefinition($providerId, new ChildDefinition('fos_oauth_server.security.authentication.provider'))
->replaceArgument(0, new Reference($userProvider))
->replaceArgument(2, new Reference('security.user_checker.'.$id))
;

$listenerId = 'security.authentication.listener.fos_oauth_server.'.$id;
Expand Down
18 changes: 15 additions & 3 deletions Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,22 @@ public function testCreate()
;

$definition
->expects($this->once())
->expects($this->exactly(2))
->method('replaceArgument')
->with(0, new Reference($userProvider))
->willReturn(null)
->withConsecutive(
[
0,
new Reference($userProvider),
],
[
2,
new Reference('security.user_checker.'.$id),
]
)
->willReturnOnConsecutiveCalls(
$definition,
$definition
)
;

$this->assertSame([
Expand Down

0 comments on commit fc4ba11

Please sign in to comment.