Record Class DeviceRateLimitProperties

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.api.web.implicit.DeviceRateLimitProperties
Record Components:
enabled - whether attempts are limited at all (default true).
window - length of the fixed window the attempts are counted in (default 15 minutes).
perClient - attempts one client address may make in a window (default 30).
perUser - attempts one signed-in user may make in a window (default 10).
maxTrackedKeys - keys tracked at most per kind of limit; the oldest is forgotten first, so the memory used stays bounded (default 10 000).

@ConfigurationProperties(prefix="authserver.device.rate-limit") public record DeviceRateLimitProperties(boolean enabled, Duration window, int perClient, int perUser, int maxTrackedKeys) extends Record
Configuration of the limit on the attempts to verify a user code (authserver.device.rate-limit.*): the user code is short, so the attempts a signed-in user and a client address may make in a window are bounded, on top of the expiry of the code itself.
  • 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.
    • perUser

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

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

    • DeviceRateLimitProperties

      public DeviceRateLimitProperties(@DefaultValue("true") boolean enabled, @DefaultValue("PT15M") Duration window, @DefaultValue("30") int perClient, @DefaultValue("10") int perUser, @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
    • perUser

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

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