| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Kaliop\IdentityManagementBundle\Security\Firewall; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Symfony\Component\Security\Http\Firewall\ListenerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Symfony\Component\Security\Core\SecurityContextInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Symfony\Component\HttpKernel\Event\GetResponseEvent; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Symfony\Component\Security\Core\Exception\AuthenticationException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Kaliop\IdentityManagementBundle\Security\Authentication\Token\IPToken; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | class IPListener implements ListenerInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     protected $securityContext; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |     protected $authenticationManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |         $this->securityContext = $securityContext; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |         $this->authenticationManager = $authenticationManager; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 23 |  |  |     public function handle(GetResponseEvent $event) | 
            
                                                        
            
                                    
            
            
                | 24 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 25 |  |  |         $token = new IPToken(); | 
            
                                                        
            
                                    
            
            
                | 26 |  |  |         $token->setClientIp($event->getRequest()->getClientIp()); | 
            
                                                        
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 28 |  |  |         /// @todo check what to return exactly when auth-by-ip is not successful: return, throw, set 403 response? | 
            
                                                        
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 30 |  |  |         try { | 
            
                                                        
            
                                    
            
            
                | 31 |  |  |             $authToken = $this->authenticationManager->authenticate($token); | 
            
                                                        
            
                                    
            
            
                | 32 |  |  |             $this->securityContext->setToken($authToken); | 
            
                                                        
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 34 |  |  |             return; | 
            
                                                        
            
                                    
            
            
                | 35 |  |  |         } catch (AuthenticationException $failed) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 36 |  |  |             // ... you might log something here | 
            
                                                        
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 38 |  |  |             // To deny the authentication clear the token. This will redirect to the login page. | 
            
                                                        
            
                                    
            
            
                | 39 |  |  |             // Make sure to only clear your token, not those of other authentication listeners. | 
            
                                                        
            
                                    
            
            
                | 40 |  |  |             // $token = $this->securityContext->getToken(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 41 |  |  |             // if ($token instanceof WsseUserToken && $this->providerKey === $token->getProviderKey()) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 42 |  |  |             //     $this->securityContext->setToken(null); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 43 |  |  |             // } | 
            
                                                        
            
                                    
            
            
                | 44 |  |  |             // return; | 
            
                                                        
            
                                    
            
            
                | 45 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 47 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |  | 
            
                        
Scrutinizer analyzes your
composer.json/composer.lockfile if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.