summaryrefslogtreecommitdiffstats
path: root/apps/admin_audit/lib/AppInfo/Application.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/admin_audit/lib/AppInfo/Application.php')
-rw-r--r--apps/admin_audit/lib/AppInfo/Application.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/admin_audit/lib/AppInfo/Application.php b/apps/admin_audit/lib/AppInfo/Application.php
index d3ae4ad26c1..470352f895e 100644
--- a/apps/admin_audit/lib/AppInfo/Application.php
+++ b/apps/admin_audit/lib/AppInfo/Application.php
@@ -33,12 +33,14 @@ use OCA\AdminAudit\Actions\Auth;
use OCA\AdminAudit\Actions\Console;
use OCA\AdminAudit\Actions\Files;
use OCA\AdminAudit\Actions\GroupManagement;
+use OCA\AdminAudit\Actions\Security;
use OCA\AdminAudit\Actions\Sharing;
use OCA\AdminAudit\Actions\Trashbin;
use OCA\AdminAudit\Actions\UserManagement;
use OCA\AdminAudit\Actions\Versions;
use OCP\App\ManagerEvent;
use OCP\AppFramework\App;
+use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\Console\ConsoleEvent;
use OCP\IGroupManager;
use OCP\ILogger;
@@ -75,6 +77,8 @@ class Application extends App {
$this->fileHooks($logger);
$this->trashbinHooks($logger);
$this->versionsHooks($logger);
+
+ $this->securityHooks($logger);
}
protected function userManagementHooks(ILogger $logger) {
@@ -218,4 +222,16 @@ class Application extends App {
Util::connectHook('\OCP\Trashbin', 'preDelete', $trashActions, 'delete');
Util::connectHook('\OCA\Files_Trashbin\Trashbin', 'post_restore', $trashActions, 'restore');
}
+
+ protected function securityHooks(ILogger $logger) {
+ $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
+ $eventDispatcher->addListener(IProvider::EVENT_SUCCESS, function(GenericEvent $event) use ($logger) {
+ $security = new Security($logger);
+ $security->twofactorSuccess($event->getSubject(), $event->getArguments());
+ });
+ $eventDispatcher->addListener(IProvider::EVENT_FAILED, function(GenericEvent $event) use ($logger) {
+ $security = new Security($logger);
+ $security->twofactorFailed($event->getSubject(), $event->getArguments());
+ });
+ }
}