Skip to content

Commit be351a9

Browse files
fix(account): revoke user certificates when deleting pfx
Call CRL revocation by user UID before deleting the PFX file. Use CESSATION_OF_OPERATION with a reason description to keep auditability when certificates are removed by the account owner. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 8086e66 commit be351a9

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/Service/AccountService.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
use OCA\Libresign\Db\SignRequestMapper;
1818
use OCA\Libresign\Db\UserElement;
1919
use OCA\Libresign\Db\UserElementMapper;
20+
use OCA\Libresign\Enum\CRLReason;
2021
use OCA\Libresign\Enum\FileStatus;
2122
use OCA\Libresign\Exception\InvalidPasswordException;
2223
use OCA\Libresign\Exception\LibresignException;
2324
use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory;
2425
use OCA\Libresign\Handler\SignEngine\Pkcs12Handler;
2526
use OCA\Libresign\Helper\FileUploadHelper;
2627
use OCA\Libresign\Helper\ValidateHelper;
28+
use OCA\Libresign\Service\Crl\CrlService;
2729
use OCA\Settings\Mailer\NewUserMailHelper;
2830
use OCP\Accounts\IAccountManager;
2931
use OCP\AppFramework\Db\DoesNotExistException;
@@ -78,6 +80,7 @@ public function __construct(
7880
private IClientService $clientService,
7981
private ITimeFactory $timeFactory,
8082
private FileUploadHelper $uploadHelper,
83+
private CrlService $crlService,
8184
) {
8285
}
8386

@@ -565,7 +568,16 @@ public function uploadPfx(array $file, IUser $user): void {
565568
}
566569

567570
public function deletePfx(IUser $user): void {
568-
$this->pkcs12Handler->deletePfx($user->getUID());
571+
$uid = $user->getUID();
572+
573+
$this->crlService->revokeUserCertificates(
574+
$uid,
575+
CRLReason::CESSATION_OF_OPERATION,
576+
'Certificate deleted by account owner.',
577+
$uid,
578+
);
579+
580+
$this->pkcs12Handler->deletePfx($uid);
569581
}
570582

571583
/**

0 commit comments

Comments
 (0)