You can easily configure method-level security in your RestController through annotations.
Since it's still in beta, the software currently has limited features. If you're interested in following the project's progress, please press the ⭐ button to stay updated.
⚠️ Requires Spring Boot 3.x
implementation 'org.easypeelsecurity:easypeel-method-security:0.0.4'
annotationProcessor 'org.easypeelsecurity:easypeel-method-security:0.0.4'
The @MethodBan enables you to implement a simple Rate Limit within your controller. If you need more details, please check the details page.
1.1. Only IP based ban :
@GetMapping("/")
@MethodBan(times = 3, seconds = 10, banSeconds = 1000) // this
public String hello() {
return "Hello World!";
}
Once a
same IP
accesses an API3 times
within10 seconds
, they are prevented from accessing the same API for1000 banSeconds
.
1.2. IP & User based ban :
@PostMapping("/")
@MethodBan(times = 3, seconds = 10, banSeconds = 1000,
banMessage = "You're writing too fast. Please try again later.",
additionalFilter = @ParameterFilter(name = "enterpriseUser")) // this
public void createJobPosting(
@CurrentUser EnterpriseUserAccount enterpriseUser) {
// ...
}
Once a
same IP and User Credential
accesses an API3 times
within10 seconds
, they are prevented from accessing the same API for1000 banSeconds
.
Contributions are welcome! Please feel free to submit a Pull Request. More information can be found in the CONTRIBUTING.md file.
This project is licensed under the terms of the apache 2.0 license.