Interface RateLimitKeyResolver


public interface RateLimitKeyResolver

Says which key a request counts under.

RateLimitKeyResolver tenant = request -> request.getHeader("X-Tenant");
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Whether the key is known only once the request has been authenticated.
    The key, or null when the request has none -- nobody is signed in, it has no session -- and the limit does not apply to it.
  • Method Details

    • resolve

      String resolve(HttpServer.Request request)
      The key, or null when the request has none -- nobody is signed in, it has no session -- and the limit does not apply to it.
    • needsAuthentication

      default boolean needsAuthentication()
      Whether the key is known only once the request has been authenticated. A limit whose key needs that is applied after sign-in; any other is applied first of all, before the request costs anything.