1 | <?php |
||
17 | trait RequestValidatorTrait |
||
18 | { |
||
19 | /** |
||
20 | * Get the Emitter. |
||
21 | * |
||
22 | * @return EmitterInterface |
||
23 | */ |
||
24 | abstract public function getEmitter(); |
||
25 | |||
26 | /** |
||
27 | * @return ClientRepositoryInterface |
||
28 | */ |
||
29 | abstract public function getClientRepository(); |
||
30 | |||
31 | /** |
||
32 | * Return the grant identifier that can be used in matching up requests. |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | abstract public function getIdentifier(); |
||
37 | |||
38 | /** |
||
39 | * Validate the client. |
||
40 | * |
||
41 | * @param ServerRequestInterface $request |
||
42 | * |
||
43 | * @throws OAuthServerException |
||
44 | * |
||
45 | * @return ClientEntityInterface |
||
46 | */ |
||
47 | 54 | public function validateClient(ServerRequestInterface $request) |
|
79 | |||
80 | /** |
||
81 | * Validate redirectUri from the request. |
||
82 | * If a redirect URI is provided ensure it matches what is pre-registered |
||
83 | * |
||
84 | * @param string $redirectUri |
||
85 | * @param ClientEntityInterface $client |
||
86 | * @param ServerRequestInterface $request |
||
87 | * |
||
88 | * @throws OAuthServerException |
||
89 | */ |
||
90 | 34 | public function validateRedirectUri( |
|
107 | |||
108 | /** |
||
109 | * Retrieve request parameter. |
||
110 | * |
||
111 | * @param string $parameter |
||
112 | * @param ServerRequestInterface $request |
||
113 | * @param mixed $default |
||
114 | * |
||
115 | * @return null|string |
||
116 | */ |
||
117 | 54 | protected function getRequestParameter($parameter, ServerRequestInterface $request, $default = null) |
|
123 | |||
124 | /** |
||
125 | * Retrieve HTTP Basic Auth credentials with the Authorization header |
||
126 | * of a request. First index of the returned array is the username, |
||
127 | * second is the password (so list() will work). If the header does |
||
128 | * not exist, or is otherwise an invalid HTTP Basic header, return |
||
129 | * [null, null]. |
||
130 | * |
||
131 | * @param ServerRequestInterface $request |
||
132 | * |
||
133 | * @return string[]|null[] |
||
134 | */ |
||
135 | 59 | public function getBasicAuthCredentials(ServerRequestInterface $request) |
|
156 | |||
157 | /** |
||
158 | * Retrieve query string parameter. |
||
159 | * |
||
160 | * @param string $parameter |
||
161 | * @param ServerRequestInterface $request |
||
162 | * @param mixed $default |
||
163 | * |
||
164 | * @return null|string |
||
165 | */ |
||
166 | 21 | protected function getQueryStringParameter($parameter, ServerRequestInterface $request, $default = null) |
|
170 | |||
171 | /** |
||
172 | * Retrieve cookie parameter. |
||
173 | * |
||
174 | * @param string $parameter |
||
175 | * @param ServerRequestInterface $request |
||
176 | * @param mixed $default |
||
177 | * |
||
178 | * @return null|string |
||
179 | */ |
||
180 | 1 | protected function getCookieParameter($parameter, ServerRequestInterface $request, $default = null) |
|
184 | |||
185 | /** |
||
186 | * Retrieve server parameter. |
||
187 | * |
||
188 | * @param string $parameter |
||
189 | * @param ServerRequestInterface $request |
||
190 | * @param mixed $default |
||
191 | * |
||
192 | * @return null|string |
||
193 | */ |
||
194 | 20 | protected function getServerParameter($parameter, ServerRequestInterface $request, $default = null) |
|
198 | } |
||
199 |