Skip to content

[Security] Pass Passport to LoginFailureEvent #37585

@romaricdrigon

Description

@romaricdrigon

Description

With the new authenticator-based Security component (5.1+)

When Credentials verification fails, a LoginFailureEvent event is raised.
Currently, its arguments are:
AuthenticationException $exception AuthenticatorInterface $authenticator Request $request ?Response $response string $firewallName

It would be useful to also pass it the Passport whose verification failed.
Typical use case: when a User try to log in with an invalid API key, I would like to store which API key was used. In some scenario, building the Passport from the Request is complex, so having to re-parse the Request is not great.

Extra suggestion; also sending the passport (or null) to onAuthenticationFailure, as right now it won't be stored in AuthenticationException.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions