PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/Security/Authentication/Token/FacebookUserToken.php

http://github.com/FriendsOfSymfony/FOSFacebookBundle
PHP | 62 lines | 39 code | 15 blank | 8 comment | 1 complexity | 32ebe692b7482c8a8996dda743c49f89 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\Authentication\Token;
13
14use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
15
16class FacebookUserToken extends AbstractToken
17{
18    private $providerKey;
19
20    protected $accessToken;
21
22    public function __construct($providerKey, $uid = '', array $roles = array(), $accessToken = null)
23    {
24        parent::__construct($roles);
25
26        $this->setUser($uid);
27
28        if (!empty($uid)) {
29            $this->setAuthenticated(true);
30        }
31
32        $this->providerKey = $providerKey;
33
34        $this->accessToken = $accessToken;
35    }
36
37    public function getCredentials()
38    {
39        return '';
40    }
41
42    public function getProviderKey()
43    {
44        return $this->providerKey;
45    }
46
47    public function getAccessToken()
48    {
49        return $this->accessToken;
50    }
51
52    public function serialize()
53    {
54        return serialize(array($this->providerKey, parent::serialize()));
55    }
56
57    public function unserialize($str)
58    {
59        list($this->providerKey, $parentStr) = unserialize($str);
60        parent::unserialize($parentStr);
61    }
62}