-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for Method level @ratelimiting annoation #250
- Loading branch information
1 parent
74780e8
commit 0860e0c
Showing
3 changed files
with
26 additions
and
23 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
...va/com/giffing/bucket4j/spring/boot/starter/examples/ehcache/EhcacheGeneralSuiteTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
package com.giffing.bucket4j.spring.boot.starter.examples.ehcache; | ||
|
||
import com.giffing.bucket4j.spring.boot.starter.general.tests.filter.method.MethodTestSuite; | ||
import com.giffing.bucket4j.spring.boot.starter.general.tests.filter.servlet.ServletTestSuite; | ||
import org.junit.platform.suite.api.SelectClasses; | ||
import org.junit.platform.suite.api.Suite; | ||
|
||
@Suite | ||
@SelectClasses({ | ||
ServletTestSuite.class, | ||
MethodTestSuite.class, | ||
}) | ||
public class EhcacheGeneralSuiteTest { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,35 @@ | ||
@startuml | ||
|
||
== First Request - 1 Token available == | ||
|
||
User -> Bucket4jFilter: webRequest | ||
box "Webserver" #LightBlue | ||
participant Bucket4jFilter | ||
participant SpringSecurityFilter | ||
|
||
Bucket4jFilter -> Bucket4jFilter : check remaining tokens | ||
Bucket4jFilter -> SpringSecurityFilter : tokens available proceed | ||
SpringSecurityFilter -> SpringSecurityFilter : authenticate | ||
SpringSecurityFilter -> Bucket4jFilter : authentication Failed 401 | ||
Bucket4jFilter -> Bucket4jFilter : if response status 401 consume token | ||
Bucket4jFilter -> User : response 401 | ||
end box | ||
User -> Bucket4jFilter: request | ||
|
||
box "Webserver" #f5e4e4 | ||
|
||
Bucket4jFilter -> Bucket4jFilter : estimate_remaining_tokens | ||
participant Bucket4jFilter | ||
participant SpringSecurityFilter | ||
alt 1 token available | ||
|
||
note right of Bucket4jFilter: There is one token available. \nThe request will not be aborted | ||
Bucket4jFilter -> SpringSecurityFilter : request | ||
SpringSecurityFilter -> SpringSecurityFilter : authenticate | ||
SpringSecurityFilter -> Bucket4jFilter : response(401) | ||
alt HTTP Response Status == 401 | ||
note right of Bucket4jFilter: The token will only be consumed\n if the HTTP Status is 401\n | ||
Bucket4jFilter -> Bucket4jFilter : consume_token | ||
end | ||
Bucket4jFilter -> User : response(401) | ||
|
||
else 0 token available | ||
note right of Bucket4jFilter: The token was consumed \nbecause of the HTTP Response Status 401 | ||
Bucket4jFilter -> Bucket4jFilter : reject request | ||
Bucket4jFilter -> User : response\n(429 Too Many Requests) | ||
end | ||
|
||
|
||
== Second Request - 0 Token available == | ||
|
||
|
||
User -> Bucket4jFilter: webRequest | ||
box "Webserver" #LightBlue | ||
participant Bucket4jFilter | ||
participant SpringSecurityFilter | ||
|
||
Bucket4jFilter -> Bucket4jFilter : check remaining tokens -> no token available | ||
Bucket4jFilter -> User : reject request 429 | ||
end box | ||
|
||
|
||
@enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.