Skip to content

[Security] UsernamePasswordJsonAuthenticationListener requires custom failure handler to prevent redirect to login #22483

Closed
@lsmith77

Description

@lsmith77
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes
Symfony version 3.3-dev

Right now UsernamePasswordJsonAuthenticationListener defaults to using DefaultAuthenticationFailureHandler which means that a redirect is made rather than returning a 4xx error. I guess it makes sense to have the ability to define a custom failure handler but there should be a way to not have a redirect.

I looked into DefaultAuthenticationFailureHandler and I do not see a clean way to get this behavior, maybe we should add a throw_exception option to make it possible to simply re-throw the AuthenticationException so that it can be handled appropriately elsewhere or if there should be an option return_error_reponse which accepts an HTTP status code as a value that would then be used in the response.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions