60 lines
2.0 KiB
PHP
60 lines
2.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
*
|
|
* Two-factor TOTP
|
|
*
|
|
* This code is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
*
|
|
*/
|
|
|
|
namespace OCA\TwoFactorTOTP\AppInfo;
|
|
|
|
use OCA\TwoFactorTOTP\Event\DisabledByAdmin;
|
|
use OCA\TwoFactorTOTP\Event\StateChanged;
|
|
use OCA\TwoFactorTOTP\Listener\StateChangeActivity;
|
|
use OCA\TwoFactorTOTP\Listener\StateChangeRegistryUpdater;
|
|
use OCA\TwoFactorTOTP\Listener\UserDeleted;
|
|
use OCA\TwoFactorTOTP\Service\ITotp;
|
|
use OCA\TwoFactorTOTP\Service\Totp;
|
|
use OCP\AppFramework\App;
|
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
|
use OCP\User\Events\UserDeletedEvent;
|
|
|
|
class Application extends App implements IBootstrap {
|
|
public const APP_ID = 'twofactor_totp';
|
|
|
|
public function __construct() {
|
|
parent::__construct(self::APP_ID);
|
|
}
|
|
|
|
public function register(IRegistrationContext $context): void {
|
|
include_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
$context->registerServiceAlias(ITotp::class, Totp::class);
|
|
|
|
$context->registerEventListener(StateChanged::class, StateChangeActivity::class);
|
|
$context->registerEventListener(StateChanged::class, StateChangeRegistryUpdater::class);
|
|
$context->registerEventListener(DisabledByAdmin::class, StateChangeActivity::class);
|
|
$context->registerEventListener(UserDeletedEvent::class, UserDeleted::class);
|
|
}
|
|
|
|
public function boot(IBootContext $context): void {
|
|
}
|
|
}
|