2023-04-24 11:13:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2023-04-24 11:13:18 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace OCP\AppFramework\Http\Attribute;
|
|
|
|
|
|
|
|
|
|
use Attribute;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-27 12:46:09 -04:00
|
|
|
* Attribute for controller methods that require password confirmation, if
|
|
|
|
|
* supported by the active authentication backend.
|
|
|
|
|
*
|
|
|
|
|
* The exact enforcement behavior depends on the password confirmation
|
|
|
|
|
* middleware.
|
|
|
|
|
*
|
|
|
|
|
* In non-strict mode, this normally relies on a recent prior confirmation,
|
|
|
|
|
* currently defined by the middleware as within the last 30 minutes.
|
|
|
|
|
*
|
|
|
|
|
* In strict mode, confirmation is attempted as part of the current request.
|
2026-05-28 09:51:10 -04:00
|
|
|
* Credentials must be provided via Basic HTTP authentication.
|
2023-04-24 11:13:18 -04:00
|
|
|
*
|
|
|
|
|
* @since 27.0.0
|
|
|
|
|
*/
|
|
|
|
|
#[Attribute]
|
|
|
|
|
class PasswordConfirmationRequired {
|
2024-11-27 11:01:25 -05:00
|
|
|
/**
|
2026-05-27 12:46:09 -04:00
|
|
|
* @param bool $strict Whether password confirmation must happen as part of
|
2026-05-27 17:31:39 -04:00
|
|
|
* the current request instead of relying on a recent
|
|
|
|
|
* prior confirmation.
|
2024-11-27 11:01:25 -05:00
|
|
|
*
|
|
|
|
|
* @since 31.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function __construct(
|
|
|
|
|
protected bool $strict = false,
|
|
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-27 12:46:09 -04:00
|
|
|
* Returns whether password confirmation must happen during the current request.
|
|
|
|
|
*
|
2024-11-27 11:01:25 -05:00
|
|
|
* @since 31.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getStrict(): bool {
|
|
|
|
|
return $this->strict;
|
|
|
|
|
}
|
2023-04-24 11:13:18 -04:00
|
|
|
}
|