1 | <?php |
||
27 | class Server |
||
28 | { |
||
29 | /** |
||
30 | * @var EntityCollection |
||
31 | */ |
||
32 | protected $grantExtensions; |
||
33 | |||
34 | /** |
||
35 | * @var ApplicationLoaderInterface |
||
36 | */ |
||
37 | protected $applicationLoader; |
||
38 | |||
39 | /** |
||
40 | * @var AccessTokenLoaderInterface |
||
41 | */ |
||
42 | protected $accessTokenLoader; |
||
43 | |||
44 | /** |
||
45 | * @var EventDispatcherInterface |
||
46 | */ |
||
47 | protected $eventDispatcher; |
||
48 | |||
49 | /** |
||
50 | * @var RandomTokenGenerator |
||
51 | */ |
||
52 | protected $randomTokenGenerator; |
||
53 | |||
54 | /** |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $tokenOptions; |
||
58 | |||
59 | /** |
||
60 | * Construct. |
||
61 | * |
||
62 | * @param EventDispatcherInterface $eventDispatcher |
||
63 | * @param ApplicationLoaderInterface $applicationLoader |
||
64 | * @param AccessTokenLoaderInterface $accessTokenLoader |
||
65 | * @param RandomTokenGenerator $randomTokenGenerator |
||
66 | * @param array $tokenOptions |
||
67 | * @param array $grantExtensions |
||
68 | */ |
||
69 | public function __construct( |
||
97 | |||
98 | /** |
||
99 | * Register an extension under given grant type. |
||
100 | * |
||
101 | * @param string $grantType |
||
102 | * @param GrantExtensionInterface $extension |
||
103 | */ |
||
104 | public function registerGrantExtension($grantType, GrantExtensionInterface $extension) |
||
108 | |||
109 | /** |
||
110 | * Validate given request parameters and build a |
||
111 | * LoginAttempt object with it. |
||
112 | * |
||
113 | * @param array $data |
||
114 | * @param array $headers |
||
115 | * @param array $query |
||
116 | * |
||
117 | * @return LoginAttempt |
||
118 | */ |
||
119 | protected function createLoginAttempt(array $data, array $headers, array $query) |
||
147 | |||
148 | /** |
||
149 | * Loads application for given login attempt. |
||
150 | * |
||
151 | * @param LoginAttempt $loginAttempt |
||
152 | * |
||
153 | * @return ApplicationInterface |
||
154 | * |
||
155 | * @throws InvalidGrantException |
||
156 | */ |
||
157 | protected function loadApplication(LoginAttempt $loginAttempt) |
||
172 | |||
173 | /** |
||
174 | * Runs grant extension to load accounts. |
||
175 | * |
||
176 | * @param ApplicationInterface $application |
||
177 | * @param LoginAttempt $loginAttempt |
||
178 | * |
||
179 | * @return AccountInterface |
||
180 | * |
||
181 | * @throws \InvalidArgumentException |
||
182 | * @throws UnknownGrantTypeException |
||
183 | */ |
||
184 | protected function loadAccount( |
||
194 | |||
195 | /** |
||
196 | * Grant given credentials, or throws an exception if invalid |
||
197 | * credentials for application or account. |
||
198 | * |
||
199 | * @param array $data login request data |
||
200 | * @param array $headers optionnal login request headers |
||
201 | * @param array $query optionnal login request query |
||
202 | * |
||
203 | * @return AccessTokenInterface |
||
204 | */ |
||
205 | public function grant(array $data, array $headers = array(), array $query = array()) |
||
248 | |||
249 | /** |
||
250 | * Tests if given hash match a valid AccessToken. |
||
251 | * |
||
252 | * @param string $hash |
||
253 | * |
||
254 | * @return AccessToken |
||
255 | * |
||
256 | * @throws InvalidAccessTokenException |
||
257 | */ |
||
258 | public function check($hash) |
||
266 | } |
||
267 |