10000 [Security] default `authenticatorName` for programmatic login · Issue #60221 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Security] default authenticatorName for programmatic login #60221
Closed
@kbond

Description

@kbond

Description

If your firewall has two authenticators (ie form_login & remember_me), when using Security::login() you are required to pass the authenticator name. If you don't, you get the following exception:

Too many authenticators were found for the current firewall "main". You must provide an instance of "AuthenticatorInterface" to login programmatically. The available authenticators for the firewall "main" are "security.authenticator.form_login.main" ,"security.authenticator.remember_me.main".

This requires your code to have knowledge of your config. I'd like to suggest the ability to set a default authenticator for the firewall.

Example

security:
    firewalls:
        main:
            default_authenticator: form_login # new config option
            form_login: ~
            remember_me: ~
$security->login($user);

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)Security

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0