Record Class AccountRateLimitProperties

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.api.web.account.AccountRateLimitProperties
Record Components:
enabled - whether requests are limited at all (default true).
window - length of the fixed window the requests are counted in (default 15 minutes).
perClient - requests one client address may make in a window (default 20).
perEmail - requests that may name one e-mail address in a window (default 5).
maxTrackedKeys - addresses tracked at most per kind of key; the oldest is forgotten first, so the memory used stays bounded (default 10 000).

@ConfigurationProperties(prefix="authserver.account.rate-limit") public record AccountRateLimitProperties(boolean enabled, Duration window, int perClient, int perEmail, int maxTrackedKeys) extends Record
Configuration of the rate limiting of the unauthenticated account endpoints (authserver.account.rate-limit.*).
  • Field Details

    • enabled

      private final boolean enabled
      The field for the enabled record component.
    • window

      private final Duration window
      The field for the window record component.
    • perClient

      private final int perClient
      The field for the perClient record component.
    • perEmail

      private final int perEmail
      The field for the perEmail record component.
    • maxTrackedKeys

      private final int maxTrackedKeys
      The field for the maxTrackedKeys record component.
  • Constructor Details

    • AccountRateLimitProperties

      public AccountRateLimitProperties(@DefaultValue("true") boolean enabled, @DefaultValue("PT15M") Duration window, @DefaultValue("20") int perClient, @DefaultValue("5") int perEmail, @DefaultValue("10000") int maxTrackedKeys)
      Validates the configuration.
      Throws:
      IllegalArgumentException - if the window is not positive, or a limit or the number of tracked keys is not positive.
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • enabled

      public boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • window

      public Duration window()
      Returns the value of the window record component.
      Returns:
      the value of the window record component
    • perClient

      public int perClient()
      Returns the value of the perClient record component.
      Returns:
      the value of the perClient record component
    • perEmail

      public int perEmail()
      Returns the value of the perEmail record component.
      Returns:
      the value of the perEmail record component
    • maxTrackedKeys

      public int maxTrackedKeys()
      Returns the value of the maxTrackedKeys record component.
      Returns:
      the value of the maxTrackedKeys record component