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 (defaulttrue).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 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 theperUserrecord component.private final DurationThe field for thewindowrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDeviceRateLimitProperties(boolean enabled, Duration window, int perClient, int perUser, 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.intperUser()Returns the value of theperUserrecord 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. -
perUser
private final int perUserThe field for theperUserrecord component. -
maxTrackedKeys
private final int maxTrackedKeysThe field for themaxTrackedKeysrecord 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
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
-
perUser
public int perUser()Returns the value of theperUserrecord component.- Returns:
- the value of the
perUserrecord component
-
maxTrackedKeys
public int maxTrackedKeys()Returns the value of themaxTrackedKeysrecord component.- Returns:
- the value of the
maxTrackedKeysrecord component
-