forked from FriendsOfSymfony/FOSOAuthServerBundle
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Symfony 5.4 deprecation warnings free
Symfony 5.4 force the use of native return type declarations
- Loading branch information
Klapaudius
committed
Jan 13, 2022
1 parent
e0d06ba
commit 1c4691c
Showing
5 changed files
with
24 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
namespace FOS\OAuthServerBundle\DependencyInjection\Security\Factory; | ||
|
||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface; | ||
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface; | ||
use Symfony\Component\Config\Definition\Builder\NodeDefinition; | ||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; | ||
use Symfony\Component\DependencyInjection\ChildDefinition; | ||
|
@@ -26,9 +25,9 @@ | |
* | ||
* @author Arnaud Le Blanc <[email protected]> | ||
*/ | ||
class OAuthFactory implements SecurityFactoryInterface, AuthenticatorFactoryInterface | ||
class OAuthFactory implements AuthenticatorFactoryInterface | ||
{ | ||
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId) | ||
public function createAuthenticator(ContainerBuilder $container, string $firewallName, array $config, string $userProviderId): string | ||
{ | ||
$authenticatorId = 'security.authenticator.oauth2.'.$firewallName; | ||
$firewallEventDispatcherId = 'security.event_dispatcher.'.$firewallName; | ||
|
@@ -70,43 +69,15 @@ public function createAuthenticator(ContainerBuilder $container, string $firewal | |
return $authenticatorId; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint) | ||
{ | ||
// NOTE: done like this to avoid PHPStan complaining about a missing class for both Symfony v3 and Symfony v4 | ||
$definitionDecorator = 'Symfony\\Component\\DependencyInjection\\DefinitionDecorator'; | ||
$childDefinition = 'Symfony\\Component\\DependencyInjection\\ChildDefinition'; | ||
$definitionClass = $childDefinition; | ||
if (class_exists($definitionDecorator)) { | ||
$definitionClass = $definitionDecorator; | ||
} | ||
|
||
$providerId = 'security.authentication.provider.fos_oauth_server.'.$id; | ||
$container | ||
->setDefinition($providerId, new $definitionClass('fos_oauth_server.security.authentication.provider')) | ||
->replaceArgument(0, new Reference($userProvider)) | ||
; | ||
|
||
$listenerId = 'security.authentication.listener.fos_oauth_server.'.$id; | ||
$container->setDefinition($listenerId, new $definitionClass('fos_oauth_server.security.authentication.listener')); | ||
|
||
return [$providerId, $listenerId, 'fos_oauth_server.security.entry_point']; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPosition() | ||
public function getPriority(): int | ||
{ | ||
return 'pre_auth'; | ||
return 0; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getKey() | ||
public function getKey(): string | ||
{ | ||
return 'fos_oauth'; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters