I use Symfony 2 and the FOSUserBundle. I can login, logout and view Profile.
Problem: When i go to "/register", fill out the form and press enter i get the following error:
You have requested a non-existent service "security.user_checker". 500 Internal Server Error - ServiceNotFoundException
It seems that I have do to some additional configuration or so, but I can't find anything about it.
Part of config.yml:
fos_user:
db_driver: orm
firewall_name: fos_user
user_class: Blogger\BlogBundle\Entity\User
security.yml:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
fos_user:
id: fos_user.user_manager
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
fos_user:
pattern: ^/
provider: fos_user
form_login:
check_path: /login_check
login_path: /login
logout:
path: /logout
target: /
anonymous: ~
access_control:
- { path: /secured/admin, roles: ROLE_ADMIN }
- { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
UPDATE
Stack trace:
Make sure you specify a version for FOSUserBundle. The repository head is aligned with Symfony head, not 2.0.9.
[FOSUserBundle]
git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
target=/bundles/FOS/UserBundle
version=1.0.0
If you're updating FOSUserBundle (or any bundle for that matter) you need to make sure you mimic changes made in the FOSUserBundle to any files you overwrite.
In my particular case, in the RegistrationController FOSUserBundle changed a value from security.user_checker to fos_user.user_checker in the authenticateUser method, so I made the same change in my controller.
Every time you do an update of the vendors, you need to make sure files (controllers, services etc) you're overwriting in your bundle are not depending on a service class or method that has been removed.
Do you register services right ? Or maybe You forgot add a routing for this service ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.