From 10bfd1d90745ad0d05a9a3e0e446ba2307d3f649 Mon Sep 17 00:00:00 2001 From: penekhun Date: Sun, 11 Feb 2024 12:26:22 +0900 Subject: [PATCH] docs: Update README.md --- README.md | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 7f13023..5914d44 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,6 @@ You can easily configure method-level security in your RestController through annotations. -This includes the ability to implement an IP-based ban on -specific methods, which is activated when certain traffic thresholds are reached. - > 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. @@ -21,20 +18,16 @@ specific methods, which is activated when certain traffic thresholds are reached ## Dependencies -For gradle, - ```groovy -annotationProcessor 'io.github.easypeel-security:easypeel-method-security:{{VERSION}}' +annotationProcessor 'io.github.easypeel-security:easypeel-method-security:0.0.3' ``` -For maven, - ```xml io.github.easypeel-security easypeel-method-security - {{VERSION}} + 0.0.3 provided ``` @@ -43,6 +36,11 @@ For maven, ### 1. MethodBan +The @MethodBan enables you to implement a simple Rate Limit within your controller. +If you need more details, please check the [details] page. + +[details]: https://github.com/easypeel-security/easypeel-method-security/wiki/MethodBan + **1.1. Only IP based ban :** ```java @@ -54,25 +52,25 @@ public String hello() { } ``` -> Once a same IP accesses an API `3 times` within `10 seconds`, they are prevented from accessing -> the -> same API for `1000 banSeconds`. +> Once a `same IP` accesses an API `3 times` within `10 seconds`, they are prevented from accessing +> the same API for `1000 banSeconds`. **1.2. IP & User based ban :** ```java -@Secured(ROLES.ENTERPRISE) -@PostMapping("/job-posting") -@MethodBan(times = 2, seconds = 10, banSeconds = 1000, +@PostMapping("/") +@MethodBan(times = 3, seconds = 10, banSeconds = 1000, + banMessage = "You're writing too fast. Please try again later.", additionalFilter = @ParameterFilter(name = "enterpriseUser")) // this -public ApiResponse createJobPosting( +public void createJobPosting( @CurrentUser EnterpriseUserAccount enterpriseUser) { + // ... } ``` -> Once a same IP and User Credential accesses an API `2 times` within `10 seconds`, they are +> Once a `same IP and User Credential` accesses an API `3 times` within `10 seconds`, they are > prevented from accessing the same API for `1000 banSeconds`. ### 2. Another Feature is Coming Soon!