Body: <p>Problem: 
  I have a JSON endpoint and like to limit access to it. 
  I.e. to prevent double submits on contact forms or brute force attempts. </p>
  
  <p>One solution that came to my mind was rate-limiting the requests, but I did not find a Craft way to archive this with my controllers. </p>
  
  <p>Another idea was to set the CSRF token to invalid after X requests. 
  Any help would be highly appreciated. </p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-24T19:20:38.443Z
Comments.Text: Not a real answer, but there's is a guide on how to do it in Yii (which is the framework Craft uses) here that might be helpful: https://www.yiiframework.com/doc/guide/2.0/en/rest-rate-limiting
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-01-27T10:53:57.170Z
Comments.Text: I was aware of the option, since craft has their very own implementation of the user model, i do not see any chance to use the behavior of yii. (please correct me if am wrong)
Comments.UserDisplayName: nfo
Tags: <json><security><api>
Title: Rest Controller and API Rate Limits or how to set CSRF token invalid
ThreadText: # Rest Controller and API Rate Limits or how to set CSRF token invalid
  
  (Asked by: username_0 on 2020-01-24)
  
  Problem:
  I have a JSON endpoint and like to limit access to it.
  I.e. to prevent double submits on contact forms or brute force attempts.
  
  One solution that came to my mind was rate-limiting the requests, but I did not find a Craft way to archive this with my controllers.
  
  Another idea was to set the CSRF token to invalid after X requests.
  Any help would be highly appreciated.
  
  **Tags:** json, security, api
  
  > **Comments:**
  > **username_1**: Not a real answer, but there's is a guide on how to do it in Yii (which is the framework Craft uses) here that might be helpful: https://www.yiiframework.com/doc/guide/2.0/en/rest-rate-limiting  
  > **username_0**: I was aware of the option, since craft has their very own implementation of the user model, i do not see any chance to use the behavior of yii. (please correct me if am wrong)  
  
  ---
  
  ## 0 answers
  
  