2018-01-17 08:51:03 -05:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-01-17 08:51:03 -05:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
/**
|
2024-05-24 13:43:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-01-17 08:51:03 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCA\AdminAudit\Actions;
|
2020-04-09 05:48:10 -04:00
|
|
|
|
2023-06-30 06:50:28 -04:00
|
|
|
use OCP\Authentication\TwoFactorAuth\IProvider;
|
2018-01-17 08:51:03 -05:00
|
|
|
use OCP\IUser;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class Sharing logs the sharing actions
|
|
|
|
|
*
|
|
|
|
|
* @package OCA\AdminAudit\Actions
|
|
|
|
|
*/
|
|
|
|
|
class Security extends Action {
|
|
|
|
|
/**
|
2023-06-30 06:50:28 -04:00
|
|
|
* Logs failed twofactor challenge
|
2018-01-17 08:51:03 -05:00
|
|
|
*/
|
2023-06-30 06:50:28 -04:00
|
|
|
public function twofactorFailed(IUser $user, IProvider $provider): void {
|
|
|
|
|
$params = [
|
|
|
|
|
'displayName' => $user->getDisplayName(),
|
|
|
|
|
'uid' => $user->getUID(),
|
|
|
|
|
'provider' => $provider->getDisplayName(),
|
|
|
|
|
];
|
2018-01-17 08:51:03 -05:00
|
|
|
|
|
|
|
|
$this->log(
|
|
|
|
|
'Failed two factor attempt by user %s (%s) with provider %s',
|
|
|
|
|
$params,
|
|
|
|
|
[
|
2018-01-25 07:44:47 -05:00
|
|
|
'displayName',
|
2018-01-17 08:51:03 -05:00
|
|
|
'uid',
|
|
|
|
|
'provider',
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-06-30 06:50:28 -04:00
|
|
|
* Logs successful twofactor challenge
|
2018-01-17 08:51:03 -05:00
|
|
|
*/
|
2023-06-30 06:50:28 -04:00
|
|
|
public function twofactorSuccess(IUser $user, IProvider $provider): void {
|
|
|
|
|
$params = [
|
|
|
|
|
'displayName' => $user->getDisplayName(),
|
|
|
|
|
'uid' => $user->getUID(),
|
|
|
|
|
'provider' => $provider->getDisplayName(),
|
|
|
|
|
];
|
2018-01-17 08:51:03 -05:00
|
|
|
|
|
|
|
|
$this->log(
|
|
|
|
|
'Successful two factor attempt by user %s (%s) with provider %s',
|
|
|
|
|
$params,
|
|
|
|
|
[
|
2018-01-25 07:44:47 -05:00
|
|
|
'displayName',
|
2018-01-17 08:51:03 -05:00
|
|
|
'uid',
|
|
|
|
|
'provider',
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|