K
K
KOS_MOS2014-07-09 19:29:39
symfony
KOS_MOS, 2014-07-09 19:29:39

Why is the user not being authenticated in Symfony using http authentication?

There is a site on symphony, the /admin section of the site is available only to the admin, http-authorization is used, the user provider is in-memory.
When entering /admin, a login and password are requested, authentication occurs and the section becomes available, after that I go to /home, I get the user instance in the code and it is already Null:
is_null($this->getUser()); // true
securuty.yml

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        in_memory:
            memory:
                users:
                    admin: { password: admin, roles: 'ROLE_ADMIN' }

    firewalls:
        secured_area:
            pattern:   ^/
            anonymous: ~
            http_basic:
                realm: "Secured Demo Area"

    access_control:
        - { path: ^/admin, role: ROLE_ADMIN }

Friends, tell me what's wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question