diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-09-06 10:04:14 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2023-09-20 20:25:27 +0200 |
commit | e477bb7eaf0d4bd220361ceb47ac4bcca9b438bf (patch) | |
tree | 026fbbaf989b2b522b65be8d2d815ff581864fe3 /lib/private/Security | |
parent | 2bd0f07e5a1bb1a83ec3b1c86c1a1271dcdad9e3 (diff) | |
download | nextcloud-server-e477bb7eaf0d4bd220361ceb47ac4bcca9b438bf.tar.gz nextcloud-server-e477bb7eaf0d4bd220361ceb47ac4bcca9b438bf.zip |
feat(appframework): Expose programmatic rate limiter
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Security')
-rw-r--r-- | lib/private/Security/RateLimiting/Exception/RateLimitExceededException.php | 3 | ||||
-rw-r--r-- | lib/private/Security/RateLimiting/Limiter.php | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/private/Security/RateLimiting/Exception/RateLimitExceededException.php b/lib/private/Security/RateLimiting/Exception/RateLimitExceededException.php index 08091e997ca..baf74927886 100644 --- a/lib/private/Security/RateLimiting/Exception/RateLimitExceededException.php +++ b/lib/private/Security/RateLimiting/Exception/RateLimitExceededException.php @@ -27,8 +27,9 @@ namespace OC\Security\RateLimiting\Exception; use OC\AppFramework\Middleware\Security\Exceptions\SecurityException; use OCP\AppFramework\Http; +use OCP\Security\RateLimiting\IRateLimitExceededException; -class RateLimitExceededException extends SecurityException { +class RateLimitExceededException extends SecurityException implements IRateLimitExceededException { public function __construct() { parent::__construct('Rate limit exceeded', Http::STATUS_TOO_MANY_REQUESTS); } diff --git a/lib/private/Security/RateLimiting/Limiter.php b/lib/private/Security/RateLimiting/Limiter.php index c8c0e2ce101..689e7b14558 100644 --- a/lib/private/Security/RateLimiting/Limiter.php +++ b/lib/private/Security/RateLimiting/Limiter.php @@ -30,8 +30,9 @@ use OC\Security\Normalizer\IpAddress; use OC\Security\RateLimiting\Backend\IBackend; use OC\Security\RateLimiting\Exception\RateLimitExceededException; use OCP\IUser; +use OCP\Security\RateLimiting\ILimiter; -class Limiter { +class Limiter implements ILimiter { public function __construct( private IBackend $backend, ) { |