/Security/Firewall/FacebookListener.php

http://github.com/FriendsOfSymfony/FOSFacebookBundle · PHP · 29 lines · 13 code · 5 blank · 11 comment · 0 complexity · 3c555907ad05d30c5c37f6f43d2877ef 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\Firewall;
  11. use FOS\FacebookBundle\Security\Authentication\Token\FacebookUserToken;
  12. use Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener;
  13. use Symfony\Component\HttpFoundation\Request;
  14. /**
  15. * Facebook authentication listener.
  16. */
  17. class FacebookListener extends AbstractAuthenticationListener
  18. {
  19. protected function attemptAuthentication(Request $request)
  20. {
  21. $accessToken = $request->get('access_token');
  22. return $this->authenticationManager->authenticate(new FacebookUserToken($this->providerKey, '', array(), $accessToken));
  23. }
  24. }