Package com.io7m.idstore.server.service.ratelimit

# Class IdRateLimitAdminLoginService

java.lang.Object
com.io7m.idstore.server.service.ratelimit.IdRateLimitAdminLoginService

All Implemented Interfaces:
  `IdRateLimitAdminLoginServiceType`, `IdRateLimiterType`, `com.io7m.repetoir.core.RPServiceType`

public final class IdRateLimitAdminLoginService extends Object implements IdRateLimitAdminLoginServiceType
A rate limiting service for logins.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static IdRateLimitAdminLoginServiceType`
  `create(IdMetricsServiceType metrics, long expiration, TimeUnit timeUnit)`
  Create a rate limit service.
  `String`
  `description()`
  `boolean`
  `isAllowedByRateLimit(String host)`
  `String`
  `toString()`
  `Duration`
  `waitTime()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### create

    public static IdRateLimitAdminLoginServiceType 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 `IdRateLimitAdminLoginServiceType`
    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