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