RateLimitTestController.php 728 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Testing\Controller;
  7. use OCP\AppFramework\Controller;
  8. use OCP\AppFramework\Http\JSONResponse;
  9. class RateLimitTestController extends Controller {
  10. /**
  11. * @PublicPage
  12. * @NoCSRFRequired
  13. *
  14. * @UserRateThrottle(limit=5, period=100)
  15. * @AnonRateThrottle(limit=1, period=100)
  16. *
  17. * @return JSONResponse
  18. */
  19. public function userAndAnonProtected() {
  20. return new JSONResponse();
  21. }
  22. /**
  23. * @PublicPage
  24. * @NoCSRFRequired
  25. *
  26. * @AnonRateThrottle(limit=1, period=10)
  27. *
  28. * @return JSONResponse
  29. */
  30. public function onlyAnonProtected() {
  31. return new JSONResponse();
  32. }
  33. }