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 (defaulttrue).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 Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for theenabledrecord component.private final intThe field for thegenerationPerClientrecord component.private final intThe field for thegenerationPerIdentifierrecord component.private final intThe field for themaxTrackedKeysrecord component.private final intThe field for theverificationPerClientrecord component.private final intThe field for theverificationPerIdentifierrecord component.private final DurationThe field for thewindowrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionOttRateLimitProperties(boolean enabled, Duration window, int generationPerClient, int generationPerIdentifier, int verificationPerClient, int verificationPerIdentifier, int maxTrackedKeys) Validates the configuration. -
Method Summary
Modifier and TypeMethodDescriptionbooleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.intReturns the value of thegenerationPerClientrecord component.intReturns the value of thegenerationPerIdentifierrecord component.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxTrackedKeysrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of theverificationPerClientrecord component.intReturns the value of theverificationPerIdentifierrecord component.window()Returns the value of thewindowrecord component.
-
Field Details
-
enabled
private final boolean enabledThe field for theenabledrecord component. -
window
The field for thewindowrecord component. -
generationPerClient
private final int generationPerClientThe field for thegenerationPerClientrecord component. -
generationPerIdentifier
private final int generationPerIdentifierThe field for thegenerationPerIdentifierrecord component. -
verificationPerClient
private final int verificationPerClientThe field for theverificationPerClientrecord component. -
verificationPerIdentifier
private final int verificationPerIdentifierThe field for theverificationPerIdentifierrecord component. -
maxTrackedKeys
private final int maxTrackedKeysThe field for themaxTrackedKeysrecord 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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
enabled
public boolean enabled()Returns the value of theenabledrecord component.- Returns:
- the value of the
enabledrecord component
-
window
Returns the value of thewindowrecord component.- Returns:
- the value of the
windowrecord component
-
generationPerClient
public int generationPerClient()Returns the value of thegenerationPerClientrecord component.- Returns:
- the value of the
generationPerClientrecord component
-
generationPerIdentifier
public int generationPerIdentifier()Returns the value of thegenerationPerIdentifierrecord component.- Returns:
- the value of the
generationPerIdentifierrecord component
-
verificationPerClient
public int verificationPerClient()Returns the value of theverificationPerClientrecord component.- Returns:
- the value of the
verificationPerClientrecord component
-
verificationPerIdentifier
public int verificationPerIdentifier()Returns the value of theverificationPerIdentifierrecord component.- Returns:
- the value of the
verificationPerIdentifierrecord component
-
maxTrackedKeys
public int maxTrackedKeys()Returns the value of themaxTrackedKeysrecord component.- Returns:
- the value of the
maxTrackedKeysrecord component
-