/Security/Logout/FacebookHandler.php

http://github.com/FriendsOfSymfony/FOSFacebookBundle · PHP · 37 lines · 18 code · 6 blank · 13 comment · 0 complexity · bf5ff78ebd56d33cbb94cb1f1fa1056b MD5 · raw file

  1. <?php
  2. /*
  3. * This file is part of the FOSFacebookBundle package.
  4. *
  5. * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace FOS\FacebookBundle\Security\Logout;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  14. use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
  15. /**
  16. * Listener for the logout action
  17. *
  18. * This handler will clear the application's Facebook cookie.
  19. */
  20. class FacebookHandler implements LogoutHandlerInterface
  21. {
  22. private $facebook;
  23. public function __construct(\BaseFacebook $facebook)
  24. {
  25. $this->facebook = $facebook;
  26. }
  27. public function logout(Request $request, Response $response, TokenInterface $token)
  28. {
  29. $response->headers->clearCookie('fbsr_'.$this->facebook->getAppId());
  30. }
  31. }