Class RbacRateLimiter

java.lang.Object
com.rale4j.sb.security.RbacRateLimiter
All Implemented Interfaces:
RateLimitStrategy

@Component("rbac") public class RbacRateLimiter extends Object implements RateLimitStrategy
Rate-limiting strategy based on Role-Based Access Control (RBAC).
  • Constructor Details

    • RbacRateLimiter

      public RbacRateLimiter()
  • Method Details

    • allowRequest

      public boolean allowRequest(String key, int limit, int duration)
      Allows or denies a request based on the rate limit.
      Specified by:
      allowRequest in interface RateLimitStrategy
      Parameters:
      key - the key to identify the rate limit bucket
      limit - the maximum number of requests allowed
      duration - the duration in seconds for the rate limit
      Returns:
      true if the request is allowed, false otherwise