Record Class TenantCredentialContext

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.tenant.TenantCredentialContext

public record TenantCredentialContext(TenantId tenantId) extends Record
Tenant scope of an in-flight credential operation.

Single-tenant deployments never need to construct this explicitly — the framework supplies SINGLE_TENANT_DEFAULT when no tenant is resolved. Multi-tenant deployments resolve the TenantId from the inbound request (subdomain, header, authenticated subject) and pass it through.

The context carries the tenantId only; it deliberately does not embed the candidate username, the email address, or any other personally identifying value. Tenant routing decisions live at this scope; subject routing decisions live in AccessContext / PasswordContext.

Public failure surfaces must never reveal whether a given tenant exists (CWE-203, CWE-209). The framework guarantees that the TenantId is not formatted into CompromisedPasswordResult, AbuseDecision, CredentialVerificationResult or any other adapter-neutral verdict.

  • Field Details

    • SINGLE_TENANT_DEFAULT

      public static final TenantCredentialContext SINGLE_TENANT_DEFAULT
      Default value for tenant-unaware code paths and single-tenant deployments.
  • Constructor Details

    • TenantCredentialContext

      public TenantCredentialContext(TenantId tenantId)
      Creates an instance of a TenantCredentialContext record class.
      Parameters:
      tenantId - the value for the tenantId record component
  • Method Details

    • of

      public static TenantCredentialContext of(TenantId tenantId)
      Convenience factory.
    • 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.
    • tenantId

      public TenantId tenantId()
      Returns the value of the tenantId record component.
      Returns:
      the value of the tenantId record component