1 | <?php |
||
42 | class EnvCheckMiddleware extends CheckMiddleware { |
||
43 | |||
44 | /** @var IHasher */ |
||
45 | private $hasher; |
||
46 | /** @var ISession */ |
||
47 | private $session; |
||
48 | /** @var Environment */ |
||
49 | private $environment; |
||
50 | /** @var IControllerMethodReflector */ |
||
51 | protected $reflector; |
||
52 | /** @var IManager */ |
||
53 | protected $shareManager; |
||
54 | |||
55 | /*** |
||
56 | * Constructor |
||
57 | * |
||
58 | * @param string $appName |
||
59 | * @param IRequest $request |
||
60 | * @param IHasher $hasher |
||
61 | * @param ISession $session |
||
62 | * @param Environment $environment |
||
63 | * @param IControllerMethodReflector $reflector |
||
64 | * @param IURLGenerator $urlGenerator |
||
65 | * @param ILogger $logger |
||
66 | * @param IManager $shareManager |
||
67 | */ |
||
68 | 55 | public function __construct( |
|
92 | |||
93 | /** |
||
94 | * Checks that we have a valid token linked to a valid resource and that the |
||
95 | * user is authorised to access it |
||
96 | * |
||
97 | * Inspects the controller method annotations and if PublicPage is found |
||
98 | * it checks that we have a token and an optional password giving access to a valid resource. |
||
99 | * Once that's done, the environment is setup so that our services can find the resources they |
||
100 | * need. |
||
101 | * |
||
102 | * The checks are not performed on "guest" pages and the environment is not setup. Typical |
||
103 | * guest pages are anonymous error ages |
||
104 | * |
||
105 | * @inheritDoc |
||
106 | */ |
||
107 | 34 | public function beforeController($controller, $methodName) { |
|
118 | |||
119 | /** |
||
120 | * Checks that we have a token and an optional password giving access to a |
||
121 | * valid resource. Sets the token based environment after that |
||
122 | * |
||
123 | * @throws CheckException |
||
124 | */ |
||
125 | 14 | private function validateAndSetTokenBasedEnv() { |
|
140 | |||
141 | /** |
||
142 | * Validates a token to make sure its linked to a valid resource |
||
143 | * |
||
144 | * Uses Share 2.0 |
||
145 | * |
||
146 | * @fixme setIncognitoMode in 8.1 https://github.com/owncloud/core/pull/12912 |
||
147 | * |
||
148 | * @param string $token |
||
149 | * |
||
150 | * @throws CheckException |
||
151 | * @return IShare |
||
152 | */ |
||
153 | 12 | private function getShare($token) { |
|
168 | |||
169 | /** |
||
170 | * Makes sure that the token contains all the information that we need |
||
171 | * |
||
172 | * @param IShare $share |
||
173 | * @param string $token |
||
174 | * |
||
175 | * @throws CheckException |
||
176 | */ |
||
177 | 13 | private function checkShareIsValid($share, $token) { |
|
187 | |||
188 | /** |
||
189 | * Makes sure an item type was set for that token |
||
190 | * |
||
191 | * @param IShare $share |
||
192 | * |
||
193 | * @throws CheckException |
||
194 | */ |
||
195 | 12 | private function checkItemType($share) { |
|
201 | |||
202 | |||
203 | /** |
||
204 | * Checks if a password is required or if the one supplied is working |
||
205 | * |
||
206 | * @param IShare $share |
||
207 | * @param string|null $password optional password |
||
208 | * |
||
209 | * @throws CheckException |
||
210 | */ |
||
211 | 13 | private function checkAuthorisation($share, $password) { |
|
222 | |||
223 | /** |
||
224 | * Authenticate link item with the given password |
||
225 | * or with the session if no password was given. |
||
226 | * |
||
227 | * @param IShare $share |
||
228 | * @param string $password |
||
229 | * |
||
230 | * @return bool true if authorized, an exception is raised otherwise |
||
231 | * |
||
232 | * @throws CheckException |
||
233 | */ |
||
234 | 11 | private function authenticate($share, $password) { |
|
246 | |||
247 | /** |
||
248 | * Validates the given password |
||
249 | * |
||
250 | * @fixme @LukasReschke says: Migrate old hashes to new hash format |
||
251 | * Due to the fact that there is no reasonable functionality to update the password |
||
252 | * of an existing share no migration is yet performed there. |
||
253 | * The only possibility is to update the existing share which will result in a new |
||
254 | * share ID and is a major hack. |
||
255 | * |
||
256 | * In the future the migration should be performed once there is a proper method |
||
257 | * to update the share's password. (for example `$share->updatePassword($password)` |
||
258 | * |
||
259 | * @link https://github.com/owncloud/core/issues/10671 |
||
260 | * |
||
261 | * @param IShare $share |
||
262 | * @param string $password |
||
263 | * |
||
264 | * @throws CheckException |
||
265 | */ |
||
266 | 13 | private function checkPassword($share, $password) { |
|
280 | |||
281 | /** |
||
282 | * Makes sure the user is already properly authenticated when a password is required and none |
||
283 | * was provided |
||
284 | * |
||
285 | * @param IShare $share |
||
286 | * |
||
287 | * @throws CheckException |
||
288 | */ |
||
289 | 4 | private function checkSession($share) { |
|
297 | |||
298 | } |
||
299 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.