Record Class AbuseAttemptContext

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.abuse.AbuseAttemptContext
Record Components:
attemptType - what the caller is about to do
username - optional — login/password-change attempts always know it, an anonymous reset request might not
clientAddress - optional — best-effort remote identifier
tenant - TenantId.DEFAULT for single-tenant deployments
at - attempt timestamp; the service does not call Instant.now() on its own

public record AbuseAttemptContext(AbuseAttemptType attemptType, Optional<String> username, Optional<String> clientAddress, TenantId tenant, Instant at) extends Record
Adapter-neutral attempt context passed into AbuseDetectionService.evaluate(AbuseAttemptContext) and AbuseDetectionService.recordOutcome(AbuseAttemptContext, AttemptOutcome).

Every field is structural: usernames are stored verbatim, client addresses are opaque strings, the tenant defaults to TenantId.DEFAULT. No password or token material ever appears here (CWE-209 / CWE-522).

  • Constructor Details

    • AbuseAttemptContext

      public AbuseAttemptContext(AbuseAttemptType attemptType, Optional<String> username, Optional<String> clientAddress, TenantId tenant, Instant at)
      Creates an instance of a AbuseAttemptContext record class.
      Parameters:
      attemptType - the value for the attemptType record component
      username - the value for the username record component
      clientAddress - the value for the clientAddress record component
      tenant - the value for the tenant record component
      at - the value for the at record component
  • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • attemptType

      public AbuseAttemptType attemptType()
      Returns the value of the attemptType record component.
      Returns:
      the value of the attemptType record component
    • username

      public Optional<String> username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • clientAddress

      public Optional<String> clientAddress()
      Returns the value of the clientAddress record component.
      Returns:
      the value of the clientAddress record component
    • tenant

      public TenantId tenant()
      Returns the value of the tenant record component.
      Returns:
      the value of the tenant record component
    • at

      public Instant at()
      Returns the value of the at record component.
      Returns:
      the value of the at record component