public function authenticate(TokenInterface $token) { /** * @var SignedRequestToken $token */ $user = $this->provider->loadUserByUsername($token->getUsername()); if (!$user instanceof UserInterface) { throw new AuthenticationServiceException('The user provider must return a UserInterface object.'); } $signedData = $token->getSignedData(); $token = new SignedRequestToken($user->getUsername(), $user->getRoles()); $token->setSignedData($signedData); $token->setUser($user); $token->setAuthenticated(true); $this->userChecker->checkPostAuth($user); return $token; }