diff options
author | Thomas Citharel <tcit@tcit.fr> | 2017-04-30 09:16:55 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2017-06-14 17:53:52 +0200 |
commit | 0f8268c93e6210d368f9dcd1900274871a9eacdf (patch) | |
tree | 251024ae114d2a14a67399ba28d02ddb6d031bad /src/Wallabag/ApiBundle/Entity/Client.php | |
parent | f93a3109a5f0999dbbd69131c9e5041c390120c9 (diff) | |
download | wallabag-0f8268c93e6210d368f9dcd1900274871a9eacdf.tar.gz wallabag-0f8268c93e6210d368f9dcd1900274871a9eacdf.tar.zst wallabag-0f8268c93e6210d368f9dcd1900274871a9eacdf.zip |
Add client_credentials as grant_typeoauth-changes
Therefore, username and password are no longer needed
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Allow to have global clients, auth through direct token or auth code and bring scopes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
fix review
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
remove redirect uri requirement on specific clients
add back password and depreciate it
enforce state
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Allow apps to register themselves
A handful of changes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
change timeout values
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
set access_token lifetime to 1 year and double for refresh_token
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'src/Wallabag/ApiBundle/Entity/Client.php')
-rw-r--r-- | src/Wallabag/ApiBundle/Entity/Client.php | 87 |
1 files changed, 85 insertions, 2 deletions
diff --git a/src/Wallabag/ApiBundle/Entity/Client.php b/src/Wallabag/ApiBundle/Entity/Client.php index c15fd3fa..24444c9f 100644 --- a/src/Wallabag/ApiBundle/Entity/Client.php +++ b/src/Wallabag/ApiBundle/Entity/Client.php | |||
@@ -8,6 +8,7 @@ use Wallabag\UserBundle\Entity\User; | |||
8 | use JMS\Serializer\Annotation\Groups; | 8 | use JMS\Serializer\Annotation\Groups; |
9 | use JMS\Serializer\Annotation\SerializedName; | 9 | use JMS\Serializer\Annotation\SerializedName; |
10 | use JMS\Serializer\Annotation\VirtualProperty; | 10 | use JMS\Serializer\Annotation\VirtualProperty; |
11 | use Symfony\Component\Validator\Constraints as Assert; | ||
11 | 12 | ||
12 | /** | 13 | /** |
13 | * @ORM\Table("oauth2_clients") | 14 | * @ORM\Table("oauth2_clients") |
@@ -51,13 +52,39 @@ class Client extends BaseClient | |||
51 | 52 | ||
52 | /** | 53 | /** |
53 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") | 54 | * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="clients") |
55 | * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true) | ||
54 | */ | 56 | */ |
55 | private $user; | 57 | private $user; |
56 | 58 | ||
57 | public function __construct(User $user) | 59 | /** |
60 | * @ORM\Column(type="string", nullable=true) | ||
61 | */ | ||
62 | private $image; | ||
63 | |||
64 | /** | ||
65 | * @ORM\Column(type="string", nullable=true) | ||
66 | */ | ||
67 | private $description; | ||
68 | |||
69 | /** | ||
70 | * @ORM\Column(type="string", nullable=true) | ||
71 | */ | ||
72 | private $appUrl; | ||
73 | |||
74 | /** | ||
75 | * @ORM\Column(type="datetime", nullable=true) | ||
76 | */ | ||
77 | private $createdAt; | ||
78 | |||
79 | /** | ||
80 | * Client constructor. | ||
81 | * @param User|null $user | ||
82 | */ | ||
83 | public function __construct(User $user = null) | ||
58 | { | 84 | { |
59 | parent::__construct(); | 85 | parent::__construct(); |
60 | $this->user = $user; | 86 | $this->user = $user; |
87 | $this->createdAt = new \DateTime(); | ||
61 | } | 88 | } |
62 | 89 | ||
63 | /** | 90 | /** |
@@ -99,6 +126,62 @@ class Client extends BaseClient | |||
99 | */ | 126 | */ |
100 | public function getClientId() | 127 | public function getClientId() |
101 | { | 128 | { |
102 | return $this->getId().'_'.$this->getRandomId(); | 129 | return $this->getId() . '_' . $this->getRandomId(); |
130 | } | ||
131 | |||
132 | /** | ||
133 | * @return string | ||
134 | */ | ||
135 | public function getImage() | ||
136 | { | ||
137 | return $this->image; | ||
138 | } | ||
139 | |||
140 | /** | ||
141 | * @param string $image | ||
142 | */ | ||
143 | public function setImage($image) | ||
144 | { | ||
145 | $this->image = $image; | ||
146 | } | ||
147 | |||
148 | /** | ||
149 | * @return string | ||
150 | */ | ||
151 | public function getDescription() | ||
152 | { | ||
153 | return $this->description; | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * @param string $description | ||
158 | */ | ||
159 | public function setDescription($description) | ||
160 | { | ||
161 | $this->description = $description; | ||
162 | } | ||
163 | |||
164 | /** | ||
165 | * @return string | ||
166 | */ | ||
167 | public function getAppUrl() | ||
168 | { | ||
169 | return $this->appUrl; | ||
170 | } | ||
171 | |||
172 | /** | ||
173 | * @param string $appUrl | ||
174 | */ | ||
175 | public function setAppUrl($appUrl) | ||
176 | { | ||
177 | $this->appUrl = $appUrl; | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * @return \DateTime | ||
182 | */ | ||
183 | public function getCreatedAt() | ||
184 | { | ||
185 | return $this->createdAt; | ||
103 | } | 186 | } |
104 | } | 187 | } |