Symfony4 - Auth Core Loop Using Database Provider

I am desperate: I have been using Symfony for many years, and today I am fixated on the main stuff. Since FOSUserBundle is not yet implemented for Sf4, I decided to create a really basic user object in the database to load the user.

But when I enter my username / password in BasicAuth windows in my web browser (chrome), it does not register me and does not loop around again and again.

Here is my security file:

security:
    encoders:
        App\Entity\User:
            algorithm: bcrypt

    providers:
        native_provider:
            entity:
                class: App\Entity\User
                property: username
                manager_name: native_users

    firewalls:
        main:
            pattern:    ^/
            http_basic: ~
            provider: native_provider

    access_control:
        - { path: ^/, roles: ROLE_USER }

    role_hierarchy:
        ROLE_ADMIN: ROLE_USER

And my User class is exactly the same as in the symfony example: https://symfony.com/doc/current/security/entity_provider.html#create-your-user-entity

Finally, I created some user devices using [nelmio / alice] [1]:

App\Entity\User:
    user_1:
        id: '<uuid()>'
        username: 'admin'
        password: '\$2y\$10\$574w3EitCqOaHmhu4ER49.KPG2EMtcQlYrO0vdPyYW/EuqTHMCB0C'
        email: 'admin@test.com'
        isActive: true

'\ $2y\$10\$574w3EitCqOaHmhu4ER49.KPG2EMtcQlYrO0vdPyYW/EuqTHMCB0C' "admin", bcrypt.

, auth . ?

!

+1

Source: https://habr.com/ru/post/1692785/


All Articles