diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2023-08-15 18:58:52 +0200 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2024-08-14 15:41:27 +0200 |
commit | 6e176840c882cfe11152de6350788d74374a54ae (patch) | |
tree | 36c324e1d646051ba36988094fdeb28371e39f1d /lib/public | |
parent | 0f10cabf2a7ff6652f7b29e81f3682fac941e647 (diff) | |
download | nextcloud-server-dept-remove-csrf-dependency-from-request.tar.gz nextcloud-server-dept-remove-csrf-dependency-from-request.zip |
feat: move csrf validation out of requestdept-remove-csrf-dependency-from-request
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/IRequest.php | 1 | ||||
-rw-r--r-- | lib/public/Security/CSRF/ICsrfValidator.php | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index 18efd7a6d16..db82d72891e 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -177,6 +177,7 @@ interface IRequest { * * @return bool true if CSRF check passed * @since 6.0.0 + * @deprecated 30.0.0 use \OCP\Security\CSRF\ICsrfValidator::validate instead */ public function passesCSRFCheck(): bool; diff --git a/lib/public/Security/CSRF/ICsrfValidator.php b/lib/public/Security/CSRF/ICsrfValidator.php new file mode 100644 index 00000000000..2c64c825f04 --- /dev/null +++ b/lib/public/Security/CSRF/ICsrfValidator.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +namespace OCP\Security\CSRF; + +use OCP\IRequest; + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +/** + * @since 31.0.0 + */ +interface ICsrfValidator { + /** + * Check if a request uses a valid csrf token. + * + * @since 31.0.0 + */ + public function validate(IRequest $request): bool; +} |