|
1
|
|
|
<?php
|
|
2
|
|
|
/**
|
|
3
|
|
|
*
|
|
4
|
|
|
* @author Semih Serhat Karakaya
|
|
5
|
|
|
* @copyright Copyright (c) 2017, ownCloud GmbH.
|
|
6
|
|
|
* @license AGPL-3.0
|
|
7
|
|
|
*
|
|
8
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
10
|
|
|
* as published by the Free Software Foundation.
|
|
11
|
|
|
*
|
|
12
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
|
|
* GNU Affero General Public License for more details.
|
|
16
|
|
|
*
|
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
19
|
|
|
*
|
|
20
|
|
|
*/
|
|
21
|
|
|
namespace OCA\Security\AppInfo;
|
|
22
|
|
|
|
|
23
|
|
|
use OC\AppFramework\Utility\TimeFactory;
|
|
24
|
|
|
use OCA\Security\SecurityConfig;
|
|
25
|
|
|
use \OCP\AppFramework\App;
|
|
26
|
|
|
|
|
27
|
|
|
use \OCA\Security\Throttle;
|
|
28
|
|
|
use \OCA\Security\Hooks;
|
|
29
|
|
|
use \OCA\Security\Db\DbService;
|
|
30
|
|
|
use \OCA\Security\PasswordValidator;
|
|
31
|
|
|
|
|
32
|
|
|
class Application extends App {
|
|
33
|
|
|
|
|
34
|
|
|
public function __construct(array $urlParams=array()){
|
|
35
|
|
|
parent::__construct('security', $urlParams);
|
|
36
|
|
|
|
|
37
|
|
|
$container = $this->getContainer();
|
|
38
|
|
|
|
|
39
|
|
|
$container->registerService('DbService', function($c) {
|
|
40
|
|
|
return new DbService(
|
|
41
|
|
|
$c->query('ServerContainer')->getDb(),
|
|
42
|
|
|
$c->query('OCP\AppFramework\Utility\ITimeFactory')
|
|
43
|
|
|
);
|
|
44
|
|
|
});
|
|
45
|
|
|
|
|
46
|
|
|
$container->registerService('Throttle', function($c) {
|
|
47
|
|
|
return new Throttle(
|
|
48
|
|
|
$c->query('DbService')
|
|
49
|
|
|
);
|
|
50
|
|
|
});
|
|
51
|
|
|
|
|
52
|
|
|
$container->registerService('SecurityConfig', function($c) {
|
|
53
|
|
|
return new SecurityConfig(
|
|
54
|
|
|
$c->query('OCP\IConfig')
|
|
55
|
|
|
);
|
|
56
|
|
|
});
|
|
57
|
|
|
|
|
58
|
|
|
$container->registerService('PasswordValidator', function($c) {
|
|
59
|
|
|
return new PasswordValidator(
|
|
60
|
|
|
$c->query('SecurityConfig'),
|
|
61
|
|
|
$c->query('OCP\IL10N')
|
|
62
|
|
|
);
|
|
63
|
|
|
});
|
|
64
|
|
|
|
|
65
|
|
|
$container->registerService('Hooks', function($c) {
|
|
66
|
|
|
return new Hooks(
|
|
67
|
|
|
$c->query('ServerContainer')->getUserManager(),
|
|
68
|
|
|
$c->query('Throttle'),
|
|
69
|
|
|
$c->query('Request'),
|
|
70
|
|
|
$c->query('PasswordValidator'),
|
|
71
|
|
|
\OC::$server->getEventDispatcher()
|
|
72
|
|
|
);
|
|
73
|
|
|
});
|
|
74
|
|
|
|
|
75
|
|
|
}
|
|
76
|
|
|
} |