The user is not provided with the user "Symfony \ Component \ Security \ Core \ User \ User"

After a day of struggling with simple taks for Symfony 2 with no luck, I decided to ask you guys a solution.

Here is the problem: I would like to do http_basic authentication using doctrine, so users will be asked to enter the username / password that are stored in the database.

So, I have completed the following steps:

1) Created a new object called User using the interactive console generator.

Here's what it looks like:

http://pastebin.com/3RzrwFzL

2) As indicated in the documentation, I implemented UserInterface and added 4 missing methods. Now the object is as follows:

http://pastebin.com/Epw3YrwR

3) I changed security.yml as little as possible so that it works, and looks like this:

http://pastebin.com/tp6Gd7t7

I cleared the cache and tried to access app_dev.php / admin, and of course I get the same error all day:

There is no user user for user "Symfony \ Component \ Security \ Core \ User \ User".

500 Internal Server Error - RuntimeException

Can someone tell me where the problem is? I tried this thousand different ways, and it strange worked for a moment, but when I tried to add sha1 as a coding algorithm instead of plain text and cleared the cache, I returned to the same error. Since then I have not received anything other than This. This is like a hidden cache that gets erased whenever symfony decides: D

I think that the error can also be in 4 methods of the object, but I can not fix them, since there is no documentation on what they should do.

I am currently using RC4.

Thanks in advance, hope someone helps.

+7
source share
4 answers

There was the same problem. This seems to work. I will only use it during the development process later, I will find a solution.!

security: role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] providers: chain_provider: providers: [in_memory, user_db] in_memory: users: cheese: { password: olo, roles: ROLE_ADMIN } user_db: entity: { class: Abc\BaseBundle\Entity\User, property: username } encoders: Symfony\Component\Security\Core\User\User: plaintext Abc\BaseBundle\Entity\User: plaintext firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false panel: pattern: ^/(panel|login_check) anonymous: ~ form_login: login_path: /login check_path: /login_check default_target_path: /panel/ logout: path: /logout target: / 
+4
source

I had this problem.

This happened because I was registered with a user from a previous provider (in_memory). You will have to restore the in_memory part, log out, and then place the new provider.

My suggestion:

The user information was in the session, and she could not get it, since we removed it from security.yml

+8
source

You can save yourself a headache and try friends symfony UserBundle .

At least by looking at this kit, you can find out and fix your own code. It has a lot of well-written code / examples.

0
source

for me, the problem arose in the dev environment. This happened because I have an active session from another project.

Clearing browser cookies.

0
source

All Articles