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 (defaulttrue).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 Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanThe field for theenabledrecord component.private final intThe field for themaxTrackedKeysrecord component.private final intThe field for theperClientrecord component.private final intThe field for theperEmailrecord component.private final DurationThe field for thewindowrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionAccountRateLimitProperties(boolean enabled, Duration window, int perClient, int perEmail, 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.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxTrackedKeysrecord component.intReturns the value of theperClientrecord component.intperEmail()Returns the value of theperEmailrecord component.final StringtoString()Returns a string representation of this record class.window()Returns the value of thewindowrecord component.
-
Field Details
-
enabled
private final boolean enabledThe field for theenabledrecord component. -
window
The field for thewindowrecord component. -
perClient
private final int perClientThe field for theperClientrecord component. -
perEmail
private final int perEmailThe field for theperEmailrecord component. -
maxTrackedKeys
private final int maxTrackedKeysThe field for themaxTrackedKeysrecord 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
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
-
perClient
public int perClient()Returns the value of theperClientrecord component.- Returns:
- the value of the
perClientrecord component
-
perEmail
public int perEmail()Returns the value of theperEmailrecord component.- Returns:
- the value of the
perEmailrecord component
-
maxTrackedKeys
public int maxTrackedKeys()Returns the value of themaxTrackedKeysrecord component.- Returns:
- the value of the
maxTrackedKeysrecord component
-