Anti-replay attack

1. Pass authentication: each token has a validity period

Time interval, each token generation time + time interval <current time

 

2. Current limit on the interface

Limit a user's maximum number of visits in one minute.

Implementing the timer yourself is more complicated, and you can use the cache. Put the number of user visits into the cache and set the validity period to 1 minute. Each time the user accesses the cache, the value increases by 1, and the cache becomes invalid after one minute.

 

3. Verification code

Guess you like

Origin www.cnblogs.com/tommaoxiaoqi/p/12688938.html