1 | <?php |
||
26 | class Server |
||
27 | { |
||
28 | /** |
||
29 | * @var GrantExtensionInterface[] |
||
30 | */ |
||
31 | protected $grantExtensions; |
||
32 | |||
33 | /** |
||
34 | * @var ApplicationLoaderInterface |
||
35 | */ |
||
36 | protected $applicationLoader; |
||
37 | |||
38 | /** |
||
39 | * @var EventDispatcherInterface |
||
40 | */ |
||
41 | protected $eventDispatcher; |
||
42 | |||
43 | /** |
||
44 | * @var RandomTokenGenerator |
||
45 | */ |
||
46 | protected $randomTokenGenerator; |
||
47 | |||
48 | /** |
||
49 | * @var int |
||
50 | */ |
||
51 | protected $accessTokenTtl; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | protected $accessTokenClassName; |
||
57 | |||
58 | /** |
||
59 | * @var int |
||
60 | */ |
||
61 | protected $refreshTokenTtl; |
||
62 | |||
63 | /** |
||
64 | * @var string |
||
65 | */ |
||
66 | protected $refreshTokenClassName; |
||
67 | |||
68 | /** |
||
69 | * Construct. |
||
70 | * |
||
71 | * @param EventDispatcherInterface $eventDispatcher |
||
72 | * @param ApplicationLoaderInterface $applicationLoader |
||
73 | * @param int $accessTokenTtl |
||
74 | * @param string $accessTokenClassName |
||
75 | * @param int $refreshTokenTtl |
||
76 | * @param string $refreshTokenClassName |
||
77 | * @param RandomTokenGenerator $randomTokenGenerator |
||
78 | * @param array $grantExtensions |
||
79 | */ |
||
80 | public function __construct( |
||
105 | |||
106 | /** |
||
107 | * Register an extension under given grant type. |
||
108 | * |
||
109 | * @param string $grantType |
||
110 | * @param GrantExtensionInterface $extension |
||
111 | */ |
||
112 | public function registerGrantExtension($grantType, GrantExtensionInterface $extension) |
||
116 | |||
117 | /** |
||
118 | * Validate given request parameters and build a |
||
119 | * LoginAttempt object with it. |
||
120 | * |
||
121 | * @param array $data |
||
122 | * @param array $headers |
||
123 | * @param array $query |
||
124 | * |
||
125 | * @return LoginAttempt |
||
126 | */ |
||
127 | protected function createLoginAttempt(array $data, array $headers, array $query) |
||
155 | |||
156 | /** |
||
157 | * Loads application for given login attempt. |
||
158 | * |
||
159 | * @param LoginAttempt $loginAttempt |
||
160 | * |
||
161 | * @return ApplicationInterface |
||
162 | * |
||
163 | * @throws InvalidGrantException |
||
164 | */ |
||
165 | protected function loadApplication(LoginAttempt $loginAttempt) |
||
180 | |||
181 | /** |
||
182 | * Runs grant extension to load accounts. |
||
183 | * |
||
184 | * @param ApplicationInterface $application |
||
185 | * @param LoginAttempt $loginAttempt |
||
186 | * |
||
187 | * @return AccountInterface |
||
188 | * |
||
189 | * @throws \InvalidArgumentException |
||
190 | * @throws UnknownGrantTypeException |
||
191 | */ |
||
192 | protected function loadAccount( |
||
202 | |||
203 | /** |
||
204 | * Grant given credentials, or throws an exception if invalid |
||
205 | * credentials for application or account. |
||
206 | * |
||
207 | * @param array $data login request data |
||
208 | * @param array $headers optionnal login request headers |
||
209 | * @param array $query optionnal login request query |
||
210 | * |
||
211 | * @return AccessTokenInterface |
||
212 | */ |
||
213 | public function grant(array $data, array $headers = array(), array $query = array()) |
||
253 | } |
||
254 |