Symfony2 won't load custom authentication provider, loads DaoAuthenticationProvider

后端 未结 2 1697
鱼传尺愫
鱼传尺愫 2021-01-16 19:01

This is a continuation of my last question.

Hi,

I\'m implementing, in a Symfony2 application, a custom authentication provider in order to authentic

相关标签:
2条回答
  • 2021-01-16 19:44

    A had to create something like this a week ago. At the and, I created a custom user provider, where I simply call the api and with the response i create the user or not.

    I would advise to read this:

    http://symfony.com/doc/2.0/cookbook/security/custom_provider.html

    0 讨论(0)
  • 2021-01-16 19:46

    the line return $this->authenticationManager->authenticate(new WordnikUserToken($username, $password, $this->providerKey)); in the WordnikListener goes to Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager (classes.php) authenticate. $this->providers are DaoAuthentificationProvider, WordnikProvider and AnonymousAuthentificationProvider. From the DaoAuthentificationProvider it only uses the method supports($token): return $token instanceof UsernamePasswordToken && $this->providerKey === $token->getProviderKey();

    which returns false so next in line is WordnikProvider.

    Oh..misread: the error is in the constructor: parent::__construct($userChecker, $providerKey, $hideUserNotFoundExceptions); seems to fail. Running PHP 5.4.10 or so I DON'T have an error!!

    Either rm -rf vendor and run composer install again or try using a different PHP version!!

    0 讨论(0)
提交回复
热议问题