Annotations
Annotation Parameters#
User Identification Generation Strategy#
Create your own class that extends SignStrategic and return the user identifier. You can register this class as a Bean if needed.
Request Record Verification Strategy#
When the judgeAfterReturn
parameter is true, this function will run after the interface call, and you can determine whether the request is recorded based on the result
.
If judgeAfterReturn
is false, it will run before the interface call, and result
will be null.
Explanation of 'ban'#
When 'ban' is set to 0, all actions within the specified time will be recorded, and expired records will be deleted when the next action occurs.
When 'ban' is not 0, requests exceeding the maximum limit will be recorded in the ban list, and all request records will be deleted after the ban period ends.
Custom Token Limit Algorithm#
The default algorithm records all operations precisely and is represented by CompleteLimit
. You can also use the token bucket algorithm TokenBucket
.
You can specify the default rate limiting algorithm globally by adding the configuration simple-auth.func.limit-plan=tokenbucket
, or you can implement the TokenLimit
interface yourself.
After implementing the interface, you can specify it globally through configuration: simple-auth.func.limit-plan={full-qualified class name}
, or you can add it to specific Controllers using annotations.