1 | <?php |
||
25 | class Server |
||
26 | { |
||
27 | /** |
||
28 | * @var EntityCollection |
||
29 | */ |
||
30 | protected $grantExtensions; |
||
31 | |||
32 | /** |
||
33 | * @var ApplicationLoaderInterface |
||
34 | */ |
||
35 | protected $applicationLoader; |
||
36 | |||
37 | /** |
||
38 | * @var EventDispatcherInterface |
||
39 | */ |
||
40 | protected $eventDispatcher; |
||
41 | |||
42 | /** |
||
43 | * @var RandomTokenGenerator |
||
44 | */ |
||
45 | protected $randomTokenGenerator; |
||
46 | |||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $tokenOptions; |
||
51 | |||
52 | /** |
||
53 | * Construct. |
||
54 | * |
||
55 | * @param EventDispatcherInterface $eventDispatcher |
||
56 | * @param ApplicationLoaderInterface $applicationLoader |
||
57 | * @param RandomTokenGenerator $randomTokenGenerator |
||
58 | * @param array $tokenOptions |
||
59 | * @param array $grantExtensions |
||
60 | */ |
||
61 | 18 | public function __construct( |
|
87 | |||
88 | /** |
||
89 | * Register an extension under given grant type. |
||
90 | * |
||
91 | * @param string $grantType |
||
92 | * @param GrantExtensionInterface $extension |
||
93 | */ |
||
94 | 18 | public function registerGrantExtension($grantType, GrantExtensionInterface $extension) |
|
98 | |||
99 | /** |
||
100 | * Validate given request parameters and build a |
||
101 | * LoginAttempt object with it. |
||
102 | * |
||
103 | * @param array $data |
||
104 | * @param array $headers |
||
105 | * @param array $query |
||
106 | * |
||
107 | * @return LoginAttempt |
||
108 | */ |
||
109 | 18 | protected function createLoginAttempt(array $data, array $headers, array $query) |
|
137 | |||
138 | /** |
||
139 | * Loads application for given login attempt. |
||
140 | * |
||
141 | * @param LoginAttempt $loginAttempt |
||
142 | * |
||
143 | * @return ApplicationInterface |
||
144 | * |
||
145 | * @throws InvalidGrantException |
||
146 | */ |
||
147 | 14 | protected function loadApplication(LoginAttempt $loginAttempt) |
|
162 | |||
163 | /** |
||
164 | * Runs grant extension to load accounts. |
||
165 | * |
||
166 | * @param ApplicationInterface $application |
||
167 | * @param LoginAttempt $loginAttempt |
||
168 | * |
||
169 | * @return AccountInterface |
||
170 | * |
||
171 | * @throws \InvalidArgumentException |
||
172 | * @throws UnknownGrantTypeException |
||
173 | */ |
||
174 | 12 | protected function loadAccount( |
|
184 | |||
185 | /** |
||
186 | * Grant given credentials, or throws an exception if invalid |
||
187 | * credentials for application or account. |
||
188 | * |
||
189 | * @param array $data login request data |
||
190 | * @param array $headers optionnal login request headers |
||
191 | * @param array $query optionnal login request query |
||
192 | * |
||
193 | * @return AccessTokenInterface |
||
194 | */ |
||
195 | 18 | public function grant(array $data, array $headers = array(), array $query = array()) |
|
236 | } |
||
237 |