-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathApiKeyUserToken.php
More file actions
49 lines (41 loc) · 893 Bytes
/
ApiKeyUserToken.php
File metadata and controls
49 lines (41 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Uecode\Bundle\ApiKeyBundle\Security\Authentication\Token;
use Symfony\Component\Security\Core\Authentication\Token\AbstractToken;
/**
* @author Aaron Scherer <aequasi@gmail.com>
*/
class ApiKeyUserToken extends AbstractToken
{
/**
* @var string
*/
protected $apiKey;
public function __construct(array $roles = array())
{
parent::__construct($roles);
$this->setAuthenticated(sizeof($roles) > 0);
}
/**
* Returns the user credentials.
*
* @return mixed The user credentials
*/
public function getCredentials()
{
return $this->apiKey;
}
/**
* @param string $apiKey
*/
public function setApiKey($apiKey)
{
$this->apiKey = $apiKey;
}
/**
* @return string
*/
public function getApiKey()
{
return $this->apiKey;
}
}