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

# Class IdRateLimitPasswordResetService

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

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

public final class IdRateLimitPasswordResetService extends Object implements IdRateLimitPasswordResetServiceType
A rate limiting service for password resets.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static IdRateLimitPasswordResetServiceType`
  `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 IdRateLimitPasswordResetServiceType 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 `IdRateLimitPasswordResetServiceType`
    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