Skip to content

The service "security.authentication.provider.dao.main" has a dependency on a non-existent service "fos_user.user_checker".  #2855

@treadmillian

Description

@treadmillian

Symfony FOSUserBundle versions: v2.1.2

symfony/symfony: v3.4.15

Description of the problem including expected versus actual behavior:

Followed the guide https://symfony.com/doc/master/bundles/FOSUserBundle/index.html to the letter, but receive this error:

The service "security.authentication.provider.dao.main" has a dependency on a non-existent service "fos_user.user_checker". 

Steps to reproduce:

  1. Just updating the security.yml file causes the issue. Is the service fos_user.user_checker meant to be set-up somewhere? If so, how?

From:

firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            anonymous: ~

To:

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            user_checker: fos_user.user_checker
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager

            logout:       true
            anonymous:    true

Provide logs (if relevant):

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 31:
                                                                               
  The service "security.authentication.provider.dao.main" has a dependency on  
   a non-existent service "fos_user.user_checker".                             
                                                                               

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

                                                                                   
  [RuntimeException]                                                               
  An error occurred when executing the "'cache:clear --no-warmup'" command:        
                                                                                   
                                                                                   
                                                                                   
                                                                                   
  In CheckExceptionOnInvalidReferenceBehaviorPass.php line 31:                     
                                                                                   
    The service "security.authentication.provider.dao.main" has a dependency on    
     a non-existent service "fos_user.user_checker".

routes:

php bin/console debug:router
 ----------------------------------- ---------- -------- ------ ----------------------------------- 
  Name                                Method     Scheme   Host   Path                               
 ----------------------------------- ---------- -------- ------ ----------------------------------- 
  _wdt                                ANY        ANY      ANY    /_wdt/{token}                      
  _profiler_home                      ANY        ANY      ANY    /_profiler/                        
  _profiler_search                    ANY        ANY      ANY    /_profiler/search                  
  _profiler_search_bar                ANY        ANY      ANY    /_profiler/search_bar              
  _profiler_phpinfo                   ANY        ANY      ANY    /_profiler/phpinfo                 
  _profiler_search_results            ANY        ANY      ANY    /_profiler/{token}/search/results  
  _profiler_open_file                 ANY        ANY      ANY    /_profiler/open                    
  _profiler                           ANY        ANY      ANY    /_profiler/{token}                 
  _profiler_router                    ANY        ANY      ANY    /_profiler/{token}/router          
  _profiler_exception                 ANY        ANY      ANY    /_profiler/{token}/exception       
  _profiler_exception_css             ANY        ANY      ANY    /_profiler/{token}/exception.css   
  _twig_error_test                    ANY        ANY      ANY    /_error/{code}.{_format}           
  fos_user_security_login             GET|POST   ANY      ANY    /login                             
  fos_user_security_check             POST       ANY      ANY    /login_check                       
  fos_user_security_logout            GET|POST   ANY      ANY    /logout                            
  fos_user_profile_show               GET        ANY      ANY    /profile/                          
  fos_user_profile_edit               GET|POST   ANY      ANY    /profile/edit                      
  fos_user_registration_register      GET|POST   ANY      ANY    /register/                         
  fos_user_registration_check_email   GET        ANY      ANY    /register/check-email              
  fos_user_registration_confirm       GET        ANY      ANY    /register/confirm/{token}          
  fos_user_registration_confirmed     GET        ANY      ANY    /register/confirmed                
  fos_user_resetting_request          GET        ANY      ANY    /resetting/request                 
  fos_user_resetting_send_email       POST       ANY      ANY    /resetting/send-email              
  fos_user_resetting_check_email      GET        ANY      ANY    /resetting/check-email             
  fos_user_resetting_reset            GET|POST   ANY      ANY    /resetting/reset/{token}           
  fos_user_change_password            GET|POST   ANY      ANY    /profile/change-password           
  app_homepage                        ANY        ANY      ANY    /                                  
 ----------------------------------- ---------- -------- ------ ----------------------------------- 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions