Understanding Symfony/FOSUserBundle Authentication - How is fos_user_security_check handled

Viewed 2140

I am trying to understand the how authentication (user + password) is handled in Symfony 2.8 when using the FOSUserBundle. The setup was no problem and everything works fine, I just want to understand HOW it work.

The login form post username + password to the fos_user_security_check route (/login_check) which is defined in FOSUserBunde\Resources\config\routing\security.xml:

<route id="fos_user_security_check" path="/login_check" methods="POST">
    <default key="_controller">FOSUserBundle:Security:check</default>
</route>

So the FOSUserBundle:Security:check action is responsible for handling the request. However the implementation looks like this:

public function checkAction() {
    throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
}

So I looked at the firewall config in /app/config/security.yml:

security:
    ...
    firewalls:
        ...
        main:
            ...

            form_login:
                provider: fos_userbundle
                csrf_provider: security.csrf.token_manager
                login_path: fos_user_security_login
                check_path: fos_user_security_check

Here check_path also referes to fos_user_security_check... So, where is the authentication actually handeled?

1 Answers
Related