Record Class OttRateLimitProperties

java.lang.Object
java.lang.Record
com.irurueta.authserver.authorization.api.web.ott.OttRateLimitProperties
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).
generationPerClient - tokens one client address may request in a window (default 20).
generationPerIdentifier - tokens that may be requested for one identifier in a window (default 5).
verificationPerClient - submissions one client address may make in a window (default 30).
verificationPerIdentifier - submissions that may name one identifier 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.ott.rate-limit") public record OttRateLimitProperties(boolean enabled, Duration window, int generationPerClient, int generationPerIdentifier, int verificationPerClient, int verificationPerIdentifier, int maxTrackedKeys) extends Record
Configuration of the rate limiting of the one-time token endpoints (authserver.ott.rate-limit.*): the requests for a token (POST /ott/generate, the phone enrolment) and the submissions of a token or a code (POST /login/ott, POST /login/second-factor/ott, the phone verification).
  • 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.
    • generationPerClient

      private final int generationPerClient
      The field for the generationPerClient record component.
    • generationPerIdentifier

      private final int generationPerIdentifier
      The field for the generationPerIdentifier record component.
    • verificationPerClient

      private final int verificationPerClient
      The field for the verificationPerClient record component.
    • verificationPerIdentifier

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

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

    • OttRateLimitProperties

      public OttRateLimitProperties(@DefaultValue("true") boolean enabled, @DefaultValue("PT15M") Duration window, @DefaultValue("20") int generationPerClient, @DefaultValue("5") int generationPerIdentifier, @DefaultValue("30") int verificationPerClient, @DefaultValue("10") int verificationPerIdentifier, @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
    • generationPerClient

      public int generationPerClient()
      Returns the value of the generationPerClient record component.
      Returns:
      the value of the generationPerClient record component
    • generationPerIdentifier

      public int generationPerIdentifier()
      Returns the value of the generationPerIdentifier record component.
      Returns:
      the value of the generationPerIdentifier record component
    • verificationPerClient

      public int verificationPerClient()
      Returns the value of the verificationPerClient record component.
      Returns:
      the value of the verificationPerClient record component
    • verificationPerIdentifier

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

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