Replies: 2 comments 1 reply
-
You're isMySecurePath must return a boolean not string. You may add the string which should match the current URI public boolean isMySecurePath(String pathToMatch) {
return pathToMatch.matches(currentUri);
} Alternatively you can check the request uri directly and also the request method (Havn't tried it): execute-condition: getRequestURI().matches("/mysite") and getMethod().equals("GET") |
Beta Was this translation helpful? Give feedback.
-
The reason this did not worked was because most of documentation examples had execute-condition's value wrapped in double-quotes like here: But it seems that it can't be a string and it can't be double-quoted. So instead of this:
it should be rather this:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am using bucket4j-spring-boot-starter version 0.8.1. I wanted to restrict one of the rate limiters to method and path, how can i do this?
In v 0.9.0 there is execute_predicates but in v.0.8 there is no such. So at first I wanted to do something like this:
bucket4j.filters[0].rate-limits[0].execute-condition="@securityService.isMySecurePath()"
But all what i am getting out ot this is
Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.lang.Boolean] for value '@securityService.isMySecurePath()'; nested exception is java.lang.IllegalArgumentException: ...
Any advices?
Edit:
Or maybe there is better solution for my use case. I wanted to introduce two rate limiters. One of all paths (500 req/s) and additionally one of my endpoints will handle (50req/s).
Beta Was this translation helpful? Give feedback.
All reactions