Class IdRateLimitUserLoginService

java.lang.Object
com.io7m.idstore.server.service.ratelimit.IdRateLimitUserLoginService
All Implemented Interfaces:
IdRateLimiterType, IdRateLimitUserLoginServiceType, com.io7m.repetoir.core.RPServiceType

public final class IdRateLimitUserLoginService extends Object implements IdRateLimitUserLoginServiceType
A rate limiting service for logins.
  • Method Details

    • create

      public static IdRateLimitUserLoginServiceType create(IdMetricsServiceType metrics, long expiration, TimeUnit timeUnit)
      Create a rate limit service.
      Parameters:
      metrics - The metrics service
      expiration - The expiration for tokens
      timeUnit - The time unit for expirations
      Returns:
      A rate limiter
    • isAllowedByRateLimit

      public boolean isAllowedByRateLimit(String host)
      Specified by:
      isAllowedByRateLimit in interface IdRateLimitUserLoginServiceType
      Parameters:
      host - The host performing the action
      Returns:
      true if the given operation is allowed by rate limiting
    • description

      public String description()
      Specified by:
      description in interface com.io7m.repetoir.core.RPServiceType
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • waitTime

      public Duration waitTime()
      Specified by:
      waitTime in interface IdRateLimiterType
      Returns:
      The suggested wait time if a rate limit is exceeded