Skip to content

GuardAuthenticationProvider::authenticate does not follow interface specification #26942

@biomedia-thomas

Description

@biomedia-thomas
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.8

If the authenticate method in GuardAuthenticationProvider does not find a GuardAuthenticator for the token passed to the function it falls through to the end of the function:

    public function authenticate(TokenInterface $token)
    {
        ....

        // no matching authenticator found - but there will be multiple GuardAuthenticationProvider
        // instances that will be checked if you have multiple firewalls.
    }

There is no return statement so implicitly null is returned. However, the AuthenticationManagerInterface that is implemented by this class states the return value should be "An authenticated TokenInterface instance, never null"

  /**
     * Attempts to authenticate a TokenInterface object.
     *
     * @param TokenInterface $token The TokenInterface instance to authenticate
     *
     * @return TokenInterface An authenticated TokenInterface instance, never null
     *
     * @throws AuthenticationException if the authentication fails
     */
    public function authenticate(TokenInterface $token);

I ran into this when using the scheb/two-factor-bundle that uses this interface and assumes null is never returned.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy