Thanks to visit codestin.com
Credit goes to github.com

Skip to content

SimpleForm authentication + csrf token gives incorrect container compilation #10093

Closed
@freyr

Description

@freyr

I've encountered weird behaviour of symfony that in my opinion is a bug:
I want to use SimpleForm authentication that was introduced in 2.4 and i want to set it with csrf token in login form, but when i add token an \InvalidArgumentException('Missing simple authenticator') is thrown. I've checked this and here is what i found.

SimpleFormAuthenticationListener has 12 parameters in constructor. Parameter 11th is token interface and 12th is simple form authenticator interface. When i set my csrf token to be disabled then in appDevDebugProjectContainer.php this 11th parameter is set to null and 12th parameter is my authenticator object. But when i enable crsf token in yml file by setting: csrf_provider: security.csrf.token_manager then in appDevDebugProjectContainer.php there is suddenly 13 parameters in listener constructor: 11th is token interface, 12th is set to null and 13th is my authenticator object. And that is why i get exception cause listener expects my authenticator to be on 12th position not 13th...

here is my security conf:
simple_form:
authenticator: webservice.security.authenticator
check_path: login_check
login_path: login
username_parameter: login[email]
password_parameter: login[password]
csrf_parameter: login[token]
intention: authenticate
remember_me: true
csrf_provider: security.csrf.token_manager

Maybe i do something wrong but i manage to make it work by creating my own listener with 13 parameters and pass constructor call to original one omitting this additional null parameter. When i run that, everything was ok.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions