From 1210dae10589515d6f3824c75639342c5e1d52dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 2 Oct 2015 14:51:41 +0200 Subject: remove old implementation for login/register/recover --- .../Provider/WallabagAuthenticationProvider.php | 89 ---------------------- 1 file changed, 89 deletions(-) delete mode 100644 src/Wallabag/CoreBundle/Security/Authentication/Provider/WallabagAuthenticationProvider.php (limited to 'src/Wallabag/CoreBundle/Security/Authentication/Provider/WallabagAuthenticationProvider.php') diff --git a/src/Wallabag/CoreBundle/Security/Authentication/Provider/WallabagAuthenticationProvider.php b/src/Wallabag/CoreBundle/Security/Authentication/Provider/WallabagAuthenticationProvider.php deleted file mode 100644 index cf3cb051..00000000 --- a/src/Wallabag/CoreBundle/Security/Authentication/Provider/WallabagAuthenticationProvider.php +++ /dev/null @@ -1,89 +0,0 @@ -encoderFactory = $encoderFactory; - $this->userProvider = $userProvider; - } - - /** - * {@inheritdoc} - */ - protected function checkAuthentication(UserInterface $user, UsernamePasswordToken $token) - { - $currentUser = $token->getUser(); - if ($currentUser instanceof UserInterface) { - if ($currentUser->getPassword() !== $user->getPassword()) { - throw new BadCredentialsException('The credentials were changed from another session.'); - } - } else { - if ('' === ($presentedPassword = $token->getCredentials())) { - throw new BadCredentialsException('The presented password cannot be empty.'); - } - - // give username, it's used to hash the password - $encoder = $this->encoderFactory->getEncoder($user); - $encoder->setUsername($user->getUsername()); - - if (!$encoder->isPasswordValid($user->getPassword(), $presentedPassword, $user->getSalt())) { - throw new BadCredentialsException('The presented password is invalid.'); - } - } - } - - /** - * {@inheritdoc} - */ - protected function retrieveUser($username, UsernamePasswordToken $token) - { - $user = $token->getUser(); - if ($user instanceof UserInterface) { - return $user; - } - - try { - $user = $this->userProvider->loadUserByUsername($username); - - if (!$user instanceof UserInterface) { - throw new AuthenticationServiceException('The user provider must return a UserInterface object.'); - } - - return $user; - } catch (UsernameNotFoundException $notFound) { - $notFound->setUsername($username); - throw $notFound; - } catch (\Exception $repositoryProblem) { - $ex = new AuthenticationServiceException($repositoryProblem->getMessage(), 0, $repositoryProblem); - $ex->setToken($token); - throw $ex; - } - } -} -- cgit v1.2.3