1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OAuth; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use League\OAuth2\Server\Entities\ClientEntityInterface; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @Entity |
10
|
|
|
* @Table(name="Client") |
11
|
|
|
*/ |
12
|
|
|
class Client implements ClientEntityInterface |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @var string $id |
16
|
|
|
* @Id |
17
|
|
|
* @Column(type="string",length=40) |
18
|
|
|
* @GeneratedValue |
19
|
|
|
*/ |
20
|
|
|
private $id; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string $secret |
24
|
|
|
* @Column(type="string",length=40) |
25
|
|
|
*/ |
26
|
|
|
private $secret; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string $name |
30
|
|
|
* @Column(type="string",length=255) |
31
|
|
|
*/ |
32
|
|
|
private $name; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var bool $autoApprove |
36
|
|
|
* @Column(type="boolean") |
37
|
|
|
*/ |
38
|
|
|
private $autoApprove = false; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var ArrayCollection $endPoints |
42
|
|
|
* @OneToMany(targetEntity="OAuth\EndPoint", mappedBy="clientId") |
43
|
|
|
*/ |
44
|
|
|
private $endPoints; |
45
|
|
|
|
46
|
|
|
public function __construct() |
47
|
|
|
{ |
48
|
|
|
$this->endPoints = new ArrayCollection(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return string |
53
|
|
|
*/ |
54
|
|
|
public function getId() |
55
|
|
|
{ |
56
|
|
|
return $this->id; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param string $id |
61
|
|
|
* @return Client |
62
|
|
|
*/ |
63
|
|
|
public function setId($id) |
64
|
|
|
{ |
65
|
|
|
$this->id = $id; |
66
|
|
|
return $this; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return string |
71
|
|
|
*/ |
72
|
|
|
public function getSecret() |
73
|
|
|
{ |
74
|
|
|
return $this->secret; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param string $secret |
79
|
|
|
* @return Client |
80
|
|
|
*/ |
81
|
|
|
public function setSecret($secret) |
82
|
|
|
{ |
83
|
|
|
$this->secret = $secret; |
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return string |
89
|
|
|
*/ |
90
|
|
|
public function getName() |
91
|
|
|
{ |
92
|
|
|
return $this->name; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @param string $name |
97
|
|
|
* @return Client |
98
|
|
|
*/ |
99
|
|
|
public function setName($name) |
100
|
|
|
{ |
101
|
|
|
$this->name = $name; |
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return bool |
107
|
|
|
*/ |
108
|
|
|
public function isAutoApprove() |
109
|
|
|
{ |
110
|
|
|
return $this->autoApprove; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @param bool $autoApprove |
115
|
|
|
* @return Client |
116
|
|
|
*/ |
117
|
|
|
public function setAutoApprove($autoApprove) |
118
|
|
|
{ |
119
|
|
|
$this->autoApprove = $autoApprove; |
120
|
|
|
return $this; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* @return mixed |
125
|
|
|
*/ |
126
|
|
|
public function getEndPoints() |
127
|
|
|
{ |
128
|
|
|
return $this->endPoints; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @param mixed $endPoints |
133
|
|
|
* @return Client |
134
|
|
|
*/ |
135
|
|
|
public function setEndPoints($endPoints) |
136
|
|
|
{ |
137
|
|
|
$this->endPoints = $endPoints; |
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return mixed |
143
|
|
|
*/ |
144
|
|
|
public function getIdentifier() |
145
|
|
|
{ |
146
|
|
|
// TODO: Implement getIdentifier() method. |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @return string |
151
|
|
|
*/ |
152
|
|
|
public function getRedirectUri() |
153
|
|
|
{ |
154
|
|
|
// TODO: Implement getRedirectUri() method. |
155
|
|
|
return '/blah'; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
|
159
|
|
|
} |