1515use Symfony \Component \Security \Core \Authentication \Token \Storage \TokenStorageInterface ;
1616use Symfony \Component \Security \Core \Authorization \AuthorizationCheckerInterface ;
1717use Symfony \Component \Security \Core \Role \RoleHierarchyInterface ;
18+ use Symfony \Component \Validator \Validator \ValidatorInterface ;
1819use Symfony \Component \Workflow \Event \GuardEvent ;
1920
2021/**
@@ -28,15 +29,17 @@ class GuardListener
2829 private $ authenticationChecker ;
2930 private $ trustResolver ;
3031 private $ roleHierarchy ;
32+ private $ validator ;
3133
32- public function __construct ($ configuration , ExpressionLanguage $ expressionLanguage , TokenStorageInterface $ tokenStorage , AuthorizationCheckerInterface $ authenticationChecker , AuthenticationTrustResolverInterface $ trustResolver , RoleHierarchyInterface $ roleHierarchy = null )
34+ public function __construct ($ configuration , ExpressionLanguage $ expressionLanguage , TokenStorageInterface $ tokenStorage , AuthorizationCheckerInterface $ authenticationChecker , AuthenticationTrustResolverInterface $ trustResolver , RoleHierarchyInterface $ roleHierarchy = null , ValidatorInterface $ validator = null )
3335 {
3436 $ this ->configuration = $ configuration ;
3537 $ this ->expressionLanguage = $ expressionLanguage ;
3638 $ this ->tokenStorage = $ tokenStorage ;
3739 $ this ->authenticationChecker = $ authenticationChecker ;
3840 $ this ->trustResolver = $ trustResolver ;
3941 $ this ->roleHierarchy = $ roleHierarchy ;
42+ $ this ->validator = $ validator ;
4043 }
4144
4245 public function onTransition (GuardEvent $ event , $ eventName )
@@ -72,6 +75,8 @@ private function getVariables(GuardEvent $event)
7275 'auth_checker ' => $ this ->authenticationChecker ,
7376 // needed for the is_* expression function
7477 'trust_resolver ' => $ this ->trustResolver ,
78+ // needed for the is_valid expression function
79+ 'validator ' => $ this ->validator ,
7580 );
7681
7782 return $ variables ;
0 commit comments