PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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